lib/rouge/lexers/fsharp.rb in rouge-3.4.1 vs lib/rouge/lexers/fsharp.rb in rouge-3.5.0

- old
+ new

@@ -44,15 +44,15 @@ operator = %r([\[\];,{}_()!$%&*+./:<=>?@^|~#-]+) id = /([a-z][\w']*)|(``[^`\n\r\t]+``)/i upper_id = /[A-Z][\w']*/ state :root do - rule /\s+/m, Text - rule /false|true|[(][)]|\[\]/, Name::Builtin::Pseudo - rule /#{upper_id}(?=\s*[.])/, Name::Namespace, :dotted + rule %r/\s+/m, Text + rule %r/false|true|[(][)]|\[\]/, Name::Builtin::Pseudo + rule %r/#{upper_id}(?=\s*[.])/, Name::Namespace, :dotted rule upper_id, Name::Class - rule /[(][*](?![)])/, Comment, :comment + rule %r/[(][*](?![)])/, Comment, :comment rule %r(//.*?$), Comment::Single rule id do |m| match = m[0] if self.class.keywords.include? match token Keyword @@ -72,46 +72,46 @@ else token Operator end end - rule /-?\d[\d_]*(.[\d_]*)?(e[+-]?\d[\d_]*)/i, Num::Float - rule /0x\h[\h_]*/i, Num::Hex - rule /0o[0-7][0-7_]*/i, Num::Oct - rule /0b[01][01_]*/i, Num::Bin - rule /\d[\d_]*/, Num::Integer + rule %r/-?\d[\d_]*(.[\d_]*)?(e[+-]?\d[\d_]*)/i, Num::Float + rule %r/0x\h[\h_]*/i, Num::Hex + rule %r/0o[0-7][0-7_]*/i, Num::Oct + rule %r/0b[01][01_]*/i, Num::Bin + rule %r/\d[\d_]*/, Num::Integer - rule /'(?:(\\[\\"'ntbr ])|(\\[0-9]{3})|(\\x\h{2}))'/, Str::Char - rule /'[.]'/, Str::Char - rule /'/, Keyword - rule /"/, Str::Double, :string - rule /[~?]#{id}/, Name::Variable + rule %r/'(?:(\\[\\"'ntbr ])|(\\[0-9]{3})|(\\x\h{2}))'/, Str::Char + rule %r/'[.]'/, Str::Char + rule %r/'/, Keyword + rule %r/"/, Str::Double, :string + rule %r/[~?]#{id}/, Name::Variable end state :comment do - rule /[^(*)]+/, Comment + rule %r/[^(*)]+/, Comment rule(/[(][*]/) { token Comment; push } - rule /[*][)]/, Comment, :pop! - rule /[(*)]/, Comment + rule %r/[*][)]/, Comment, :pop! + rule %r/[(*)]/, Comment end state :string do - rule /[^\\"]+/, Str::Double + rule %r/[^\\"]+/, Str::Double mixin :escape_sequence - rule /\\\n/, Str::Double - rule /"/, Str::Double, :pop! + rule %r/\\\n/, Str::Double + rule %r/"/, Str::Double, :pop! end state :escape_sequence do - rule /\\[\\"'ntbr]/, Str::Escape - rule /\\\d{3}/, Str::Escape - rule /\\x\h{2}/, Str::Escape + rule %r/\\[\\"'ntbr]/, Str::Escape + rule %r/\\\d{3}/, Str::Escape + rule %r/\\x\h{2}/, Str::Escape end state :dotted do - rule /\s+/m, Text - rule /[.]/, Punctuation - rule /#{upper_id}(?=\s*[.])/, Name::Namespace + rule %r/\s+/m, Text + rule %r/[.]/, Punctuation + rule %r/#{upper_id}(?=\s*[.])/, Name::Namespace rule upper_id, Name::Class, :pop! rule id, Name, :pop! end end end