Skip to content

Commit

Permalink
Allow empty prefix in Turtle lexer (#1494)
Browse files Browse the repository at this point in the history
An empty prefix (`:` as distinct from `<prefix>:`) is permitted in
Terse RDF Triple Language. However, the current lexer requires at least
one character before the `:`. This commit removes that requirement.
  • Loading branch information
pyrmont committed May 12, 2020
1 parent 03be225 commit 6266fc7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rouge/lexers/turtle.rb
Expand Up @@ -53,7 +53,7 @@ class Turtle < RegexLexer

rule %r/\s+/, Text::Whitespace

rule %r/[^:;<>#\@"\(\).\[\]\{\} ]+:/, Name::Namespace
rule %r/[^:;<>#\@"\(\).\[\]\{\} ]*:/, Name::Namespace
rule %r/[^:;<>#\@"\(\).\[\]\{\} ]+/, Name
end
end
Expand Down
8 changes: 7 additions & 1 deletion spec/visual/samples/turtle
Expand Up @@ -52,9 +52,15 @@
dcterms:modified "2015-09-06T23:59:12"^^xsd:dateTime ;
owl:versionInfo "5.0" ;
adms:versionNotes "Lepší než předtim"@cs, "This version is better"@en .

<https://data.cssz.cz/resource/dataset/zanikle-duchody/id1> a adms:Identifier ;
skos:notation "https://data.cssz.cz/dataset/pocet-zaniklych-duchodu-v-ceske-republice"^^<http://purl.org/spar/datacite/url> .

<https://data.cssz.cz/resource/dataset/zanikle-duchody/id2> a adms:Identifier ;
skos:notation "https://data.cssz.cz/dataset/zanikle-duchody"^^<http://purl.org/spar/datacite/url> .

@prefix : <http://example.org/#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

: a :AdditionalTest ;
rdfs:comment ":-)"^^: .

0 comments on commit 6266fc7

Please sign in to comment.