lib/rouge/lexers/shell.rb in rouge-2.0.1 vs lib/rouge/lexers/shell.rb in rouge-2.0.2

- old
+ new

@@ -45,11 +45,10 @@ groups Name::Variable, Operator end rule /[\[\]{}()=]/, Operator rule /&&|\|\|/, Operator - # rule /\|\|/, Operator rule /<<</, Operator # here-string rule /<<-?\s*(\'?)\\?(\w+)\1/ do |m| lsh = Str::Heredoc token lsh @@ -68,25 +67,32 @@ rule /(?:\$#?)?"/, Str::Double, :pop! mixin :interp rule /[^"`\\$]+/, Str::Double end + state :ansi_string do + rule /\\./, Str::Escape + rule /[^\\']+/, Str::Single + mixin :single_quotes + end + state :single_quotes do rule /'/, Str::Single, :pop! rule /[^']+/, Str::Single end state :data do rule /\s+/, Text rule /\\./, Str::Escape rule /\$?"/, Str::Double, :double_quotes + rule /\$'/, Str::Single, :ansi_string # single quotes are much easier than double quotes - we can # literally just scan until the next single quote. # POSIX: Enclosing characters in single-quotes ( '' ) # shall preserve the literal value of each character within the # single-quotes. A single-quote cannot occur within single-quotes. - rule /$?'/, Str::Single, :single_quotes + rule /'/, Str::Single, :single_quotes rule /\*/, Keyword rule /;/, Text rule /[^=\*\s{}()$"'`\\<]+/, Text