Skip to content

Commit

Permalink
issue #7: source fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
pejuko committed Nov 4, 2012
1 parent 1be6b65 commit 2649e28
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/coderay/scanners/bash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ def scan_tokens encoder, options
kind = :comment
elsif match = scan(/[^"]#/)
kind = :ident
elsif match = scan(/(?:\. |source ).*/)
elsif match = scan(/\.+/)
kind = :plain
elsif match = scan(/(?:\.|source)\s+/)
kind = :reserved
elsif match = scan(/(?:\\.|,)/)
kind = :plain
Expand Down
2 changes: 1 addition & 1 deletion test/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class TestArray < Test::Unit::TestCase

def test_0010_Array
eb_file = File.join($current_dir, "json.sh")
assert_equal(["cat",:ident," ",:space,"$1",:predefined_constant," ",:space,"|",:plain," ",:space,"while",:reserved," ",:space,"read",:method," ",:space,"json;",:instance_variable," ",:space,"do",:reserved," ",:space,"if",:reserved," ",:space,"[",:reserved,"[",:reserved," ",:space,"${",:instance_variable,"array2",:instance_variable,"[",:operator,"0",:key,"]",:operator,"}",:instance_variable," ",:space,"=",:operator,"=",:operator," ",:space,"1",:integer," ",:space,"]",:reserved,"]",:reserved,";",:delimiter," ",:space,"then",:reserved,"\n",:end_line,"echo",:method," ",:space,"$json",:instance_variable," ",:space,"|",:plain," ",:space,".",:plain,".",:plain,".",:plain,".",:plain,".",:plain,".",:plain,"\n",:end_line],
assert_equal(["cat",:ident," ",:space,"$1",:predefined_constant," ",:space,"|",:plain," ",:space,"while",:reserved," ",:space,"read",:method," ",:space,"json;",:instance_variable," ",:space,"do",:reserved," ",:space,"if",:reserved," ",:space,"[",:reserved,"[",:reserved," ",:space,"${",:instance_variable,"array2",:instance_variable,"[",:operator,"0",:key,"]",:operator,"}",:instance_variable," ",:space,"=",:operator,"=",:operator," ",:space,"1",:integer," ",:space,"]",:reserved,"]",:reserved,";",:delimiter," ",:space,"then",:reserved,"\n",:end_line,"echo",:method," ",:space,"$json",:instance_variable," ",:space,"|",:plain," ",:space,"......",:plain,"\n",:end_line],
CodeRay.scan(File.read(eb_file), :bash).tokens)
end

Expand Down

0 comments on commit 2649e28

Please sign in to comment.