lib/rouge/lexers/toml.rb in rouge-3.30.0 vs lib/rouge/lexers/toml.rb in rouge-4.0.0

- old
+ new

@@ -3,14 +3,14 @@ module Rouge module Lexers class TOML < RegexLexer title "TOML" - desc 'the TOML configuration format (https://github.com/mojombo/toml)' + desc 'the TOML configuration format (https://github.com/toml-lang/toml)' tag 'toml' - filenames '*.toml', 'Pipfile' + filenames '*.toml', 'Pipfile', 'poetry.lock' mimetypes 'text/x-toml' # bare keys and quoted keys identifier = %r/(?:\S+|"[^"]+"|'[^']+')/ @@ -22,12 +22,10 @@ rule %r/(#{identifier})(\s*)(=)(\s*)(\{)/ do groups Name::Namespace, Text, Operator, Text, Punctuation push :inline end - rule %r/(?<!=)\s*\[[\S]+\]/, Name::Namespace - rule %r/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z/, Literal::Date rule %r/[+-]?\d+(?:_\d+)*\.\d+(?:_\d+)*(?:[eE][+-]?\d+(?:_\d+)*)?/, Num::Float rule %r/[+-]?\d+(?:_\d+)*[eE][+-]?\d+(?:_\d+)*/, Num::Float rule %r/[+-]?(?:nan|inf)/, Num::Float @@ -38,9 +36,11 @@ rule %r/[+-]?\d+(?:_\d+)*/, Num::Integer end state :root do mixin :basic + + rule %r/(?<!=)\s*\[.*?\]+/, Name::Namespace rule %r/(#{identifier})(\s*)(=)/ do groups Name::Property, Text, Punctuation push :value end