diff --git a/lib/rouge/lexers/jsl.rb b/lib/rouge/lexers/jsl.rb index 40571fad35..2c435dec96 100644 --- a/lib/rouge/lexers/jsl.rb +++ b/lib/rouge/lexers/jsl.rb @@ -14,22 +14,20 @@ class JSL < RegexLexer rule %r/\s+/m, Text::Whitespace rule %r(//.*?$), Comment::Single - rule %r(/\*.*?\*/)m, Comment::Multiline + rule %r'/[*].*', Comment::Multiline, :comment # messages - rule %r/(<<)(.*?)(\(|;)/ do |m| - groups Operator, Name::Function, Punctuation - end + rule %r/<\|=:]/, Operator + rule %r/[-+*\/!%&<>\|=:`^]/, Operator rule %r/[\[\](){},;]/, Punctuation end + state :message do + rule %r/\s+/m, Text::Whitespace + rule %r/[a-z_][\w\s'%.\\]*/i, Name::Function + rule %r/[(),;]/, Punctuation, :pop! + rule %r/[&|!=<>]/, Operator, :pop! + end + state :dq do rule %r/\\![btrnNf0\\"]/, Str::Escape rule %r/\\/, Str::Double rule %r/"/, Str::Double, :pop! rule %r/[^\\"]+/m, Str::Double end + + state :comment do + rule %r'/[*]', Comment::Multiline, :comment + rule %r'[*]/', Comment::Multiline, :pop! + rule %r'[^/*]+', Comment::Multiline + rule %r'[/*]', Comment::Multiline + end end end end diff --git a/spec/visual/samples/jsl b/spec/visual/samples/jsl index 8eeae87ace..54c38a0bd5 100644 --- a/spec/visual/samples/jsl +++ b/spec/visual/samples/jsl @@ -5,6 +5,14 @@ dt << Distribution( Column( :age ), Histograms Only( 1 ) ); Multi-line comment */ +/* + Nested + /* + Comments + */ + Work +*/ + escapeSequence = "This is an \!b escaped sequence"; escapeQuote = "This is a \!" quotation mark"; escapeStr = "\[This is """"""" an escaped string]\" @@ -16,9 +24,12 @@ a name with spaces = 5; scientificNotation = 5e9; decimal = 1.234; +missing = .; date = 01jan00; dateTime = 12dec1999:12:30:00.45; New Window( "Rouge Test", - Text Box( "Syntax highlighting is great!" ) + tb = Text Box( "Syntax highlighting is great!" ) ); + +If(tb << Get Text != "", "I'm still formatted correctly!");