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 | eea3f27860ac7d13672d57a32a4d91b8c7b13444 (patch) | |
| tree | c725391028a21585d3d36bd8ea44e0bb97b26ed4 /tests/examplefiles | |
| parent | f1c65ef22ab1a288b4604d7080b663d99180ab47 (diff) | |
| download | pygments-git-eea3f27860ac7d13672d57a32a4d91b8c7b13444.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/examplefiles')
| -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?; +} |
