diff options
author | Lucas Werkmeister <mail@lucaswerkmeister.de> | 2019-07-20 22:22:50 +0200 |
---|---|---|
committer | Lucas Werkmeister <mail@lucaswerkmeister.de> | 2019-07-20 22:22:50 +0200 |
commit | 63b7f3c535b3d8a63a612862025fb04967b20155 (patch) | |
tree | aaa1b317615e624e096e4010297bb7443ff51aac /tests | |
parent | 3d51447a9c1e75933ced7fd1ebf5c6c60676366d (diff) | |
download | pygments-63b7f3c535b3d8a63a612862025fb04967b20155.tar.gz |
Add lexer for ShExC
ShExC [1] is one syntax for the ShEx (shape expressions) language [2] to
describe the structure of RDF graphs (the other two syntaxes are based on
JSON-LD and RDF and don?t need special lexers). It is syntactically similar to
SPARQL, which is why a lot of the productions of ShExCLexer are copied from
SparqlLexer, but at the same time has enough differences that I feel it?s
better to simply copy the productions rather than trying to share them between
the two lexers (compare e.?g. PN_LOCAL_ESCAPE_CHARS or IRIREF).
The example file purports to be a brief schema for Pygments lexers, which I put
together from scratch to avoid licensing issues with existing example schemas;
it should not be taken too seriously.
[1]: https://shex.io/shex-semantics/#shexc
[2]: https://shexspec.github.io/primer/
Diffstat (limited to 'tests')
-rw-r--r-- | tests/examplefiles/example.shex | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/examplefiles/example.shex b/tests/examplefiles/example.shex new file mode 100644 index 00000000..8fab2c85 --- /dev/null +++ b/tests/examplefiles/example.shex @@ -0,0 +1,20 @@ +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> +PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> +PREFIX schema: <http://schema.org/> +PREFIX skos: <http://www.w3.org/2004/02/skos/core#> +PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> +PREFIX ex: <http://pygments.example/#> + +ex:Lexer { + rdfs:label xsd:string; + skos:altLabel xsd:string*; + ex:filenames xsd:string+; + ex:mimetypes xsd:string+; + ex:priority xsd:decimal MinInclusive 0.0 MaxExclusive 1.0; # seems to be the de facto range of currently defined priorities + ex:lexes @ex:Language*; +} + +ex:Language { + schema:description rdf:langString*; + schema:url IRI?; +} |