lib/rouge/lexers/turtle.rb in rouge-3.4.1 vs lib/rouge/lexers/turtle.rb in rouge-3.5.0
- old
+ new
@@ -5,60 +5,57 @@
module Lexers
class Turtle < RegexLexer
title "Turtle/TriG"
desc "Terse RDF Triple Language, TriG"
tag 'turtle'
- filenames *%w(*.ttl *.trig)
- mimetypes *%w(
- text/turtle
- application/trig
- )
+ filenames '*.ttl', '*.trig'
+ mimetypes 'text/turtle', 'application/trig'
state :root do
- rule /@base\b/, Keyword::Declaration
- rule /@prefix\b/, Keyword::Declaration
- rule /true\b/, Keyword::Constant
- rule /false\b/, Keyword::Constant
+ rule %r/@base\b/, Keyword::Declaration
+ rule %r/@prefix\b/, Keyword::Declaration
+ rule %r/true\b/, Keyword::Constant
+ rule %r/false\b/, Keyword::Constant
- rule /""".*?"""/m, Literal::String
- rule /"([^"\\]|\\.)*"/, Literal::String
- rule /'''.*?'''/m, Literal::String
- rule /'([^'\\]|\\.)*'/, Literal::String
+ rule %r/""".*?"""/m, Literal::String
+ rule %r/"([^"\\]|\\.)*"/, Literal::String
+ rule %r/'''.*?'''/m, Literal::String
+ rule %r/'([^'\\]|\\.)*'/, Literal::String
- rule /#.*$/, Comment::Single
+ rule %r/#.*$/, Comment::Single
- rule /@[^\s,.; ]+/, Name::Attribute
+ rule %r/@[^\s,.;]+/, Name::Attribute
- rule /[+-]?[0-9]+\.[0-9]*E[+-]?[0-9]+/, Literal::Number::Float
- rule /[+-]?\.[0-9]+E[+-]?[0-9]+/, Literal::Number::Float
- rule /[+-]?[0-9]+E[+-]?[0-9]+/, Literal::Number::Float
+ rule %r/[+-]?[0-9]+\.[0-9]*E[+-]?[0-9]+/, Literal::Number::Float
+ rule %r/[+-]?\.[0-9]+E[+-]?[0-9]+/, Literal::Number::Float
+ rule %r/[+-]?[0-9]+E[+-]?[0-9]+/, Literal::Number::Float
- rule /[+-]?[0-9]*\.[0-9]+?/, Literal::Number::Float
+ rule %r/[+-]?[0-9]*\.[0-9]+?/, Literal::Number::Float
- rule /[+-]?[0-9]+/, Literal::Number::Integer
+ rule %r/[+-]?[0-9]+/, Literal::Number::Integer
- rule /\./, Punctuation
- rule /,/, Punctuation
- rule /;/, Punctuation
- rule /\(/, Punctuation
- rule /\)/, Punctuation
- rule /\{/, Punctuation
- rule /\}/, Punctuation
- rule /\[/, Punctuation
- rule /\]/, Punctuation
- rule /\^\^/, Punctuation
+ rule %r/\./, Punctuation
+ rule %r/,/, Punctuation
+ rule %r/;/, Punctuation
+ rule %r/\(/, Punctuation
+ rule %r/\)/, Punctuation
+ rule %r/\{/, Punctuation
+ rule %r/\}/, Punctuation
+ rule %r/\[/, Punctuation
+ rule %r/\]/, Punctuation
+ rule %r/\^\^/, Punctuation
- rule /<[^>]*>/, Name::Label
+ rule %r/<[^>]*>/, Name::Label
- rule /base\b/i, Keyword::Declaration
- rule /prefix\b/i, Keyword::Declaration
- rule /GRAPH\b/, Keyword
- rule /a\b/, Keyword
+ rule %r/base\b/i, Keyword::Declaration
+ rule %r/prefix\b/i, Keyword::Declaration
+ rule %r/GRAPH\b/, Keyword
+ rule %r/a\b/, Keyword
- rule /\s+/, Text::Whitespace
+ rule %r/\s+/, Text::Whitespace
- rule /[^:;<>#\@"\(\).\[\]\{\} ]+:/, Name::Namespace
- rule /[^:;<>#\@"\(\).\[\]\{\} ]+/, Name
+ rule %r/[^:;<>#\@"\(\).\[\]\{\} ]+:/, Name::Namespace
+ rule %r/[^:;<>#\@"\(\).\[\]\{\} ]+/, Name
end
end
end
end