diff --git a/lib/rouge/lexers/sparql.rb b/lib/rouge/lexers/sparql.rb index 3bbe64b5bb..4a9c2a4831 100644 --- a/lib/rouge/lexers/sparql.rb +++ b/lib/rouge/lexers/sparql.rb @@ -35,12 +35,12 @@ def self.keywords state :root do rule %r(\s+)m, Text::Whitespace rule %r(#.*), Comment::Single - + rule %r("""), Str::Double, :string_double_literal rule %r("), Str::Double, :string_double rule %r('''), Str::Single, :string_single_literal rule %r('), Str::Single, :string_single - + rule %r([$?]\w+), Name::Variable rule %r((\w*:)(\w+)?) do |m| token Name::Namespace, m[1] @@ -48,7 +48,8 @@ def self.keywords end rule %r(<[^>]*>), Name::Namespace rule %r(true|false)i, Keyword::Constant - + rule %r/a\b/, Keyword + rule %r([A-Z]\w+\b)i do |m| if self.class.builtins.include? m[0].upcase token Name::Builtin @@ -101,7 +102,7 @@ def self.keywords end mixin :string_single_common end - + state :string_single_literal do rule %r(''') do token Str::Single diff --git a/spec/visual/samples/sparql b/spec/visual/samples/sparql index fbd97f69ab..fc75931a9f 100644 --- a/spec/visual/samples/sparql +++ b/spec/visual/samples/sparql @@ -52,3 +52,11 @@ false '''The librarian said, "Perhaps you would enjoy 'War and Peace'."''' """The librarian said, 'Perhaps you would enjoy "War and Peace".'""" "\u4444 and \U88888888" + +# `a` keyword +PREFIX : +SELECT ?item ?itemLabel +WHERE +{ + ?item a :Test . +}