mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-13 23:12:24 +00:00
171 lines
5.1 KiB
XML
171 lines
5.1 KiB
XML
<lexer>
|
|
<config>
|
|
<name>Turtle</name>
|
|
<alias>turtle</alias>
|
|
<filename>*.ttl</filename>
|
|
<mime_type>text/turtle</mime_type>
|
|
<mime_type>application/x-turtle</mime_type>
|
|
<case_insensitive>true</case_insensitive>
|
|
<not_multiline>true</not_multiline>
|
|
</config>
|
|
<rules>
|
|
<state name="triple-double-quoted-string">
|
|
<rule pattern=""""">
|
|
<token type="LiteralString"/>
|
|
<push state="end-of-string"/>
|
|
</rule>
|
|
<rule pattern="[^\\]+">
|
|
<token type="LiteralString"/>
|
|
</rule>
|
|
<rule pattern="\\">
|
|
<token type="LiteralString"/>
|
|
<push state="string-escape"/>
|
|
</rule>
|
|
</state>
|
|
<state name="single-double-quoted-string">
|
|
<rule pattern=""">
|
|
<token type="LiteralString"/>
|
|
<push state="end-of-string"/>
|
|
</rule>
|
|
<rule pattern="[^"\\\n]+">
|
|
<token type="LiteralString"/>
|
|
</rule>
|
|
<rule pattern="\\">
|
|
<token type="LiteralString"/>
|
|
<push state="string-escape"/>
|
|
</rule>
|
|
</state>
|
|
<state name="triple-single-quoted-string">
|
|
<rule pattern="'''">
|
|
<token type="LiteralString"/>
|
|
<push state="end-of-string"/>
|
|
</rule>
|
|
<rule pattern="[^\\]+">
|
|
<token type="LiteralString"/>
|
|
</rule>
|
|
<rule pattern="\\">
|
|
<token type="LiteralString"/>
|
|
<push state="string-escape"/>
|
|
</rule>
|
|
</state>
|
|
<state name="single-single-quoted-string">
|
|
<rule pattern="'">
|
|
<token type="LiteralString"/>
|
|
<push state="end-of-string"/>
|
|
</rule>
|
|
<rule pattern="[^'\\\n]+">
|
|
<token type="LiteralString"/>
|
|
</rule>
|
|
<rule pattern="\\">
|
|
<token type="LiteralString"/>
|
|
<push state="string-escape"/>
|
|
</rule>
|
|
</state>
|
|
<state name="string-escape">
|
|
<rule pattern=".">
|
|
<token type="LiteralString"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
</state>
|
|
<state name="end-of-string">
|
|
<rule pattern="(@)([a-z]+(:?-[a-z0-9]+)*)">
|
|
<bygroups>
|
|
<token type="Operator"/>
|
|
<token type="GenericEmph"/>
|
|
<token type="GenericEmph"/>
|
|
</bygroups>
|
|
<pop depth="2"/>
|
|
</rule>
|
|
<rule pattern="(\^\^)(<[^<>"{}|^`\\\x00-\x20]*>)">
|
|
<bygroups>
|
|
<token type="Operator"/>
|
|
<token type="GenericEmph"/>
|
|
</bygroups>
|
|
<pop depth="2"/>
|
|
</rule>
|
|
<rule pattern="(\^\^)((?:[a-z][\w-]*)?\:)([a-z][\w-]*)">
|
|
<bygroups>
|
|
<token type="Operator"/>
|
|
<token type="GenericEmph"/>
|
|
<token type="GenericEmph"/>
|
|
</bygroups>
|
|
<pop depth="2"/>
|
|
</rule>
|
|
<rule>
|
|
<pop depth="2"/>
|
|
</rule>
|
|
</state>
|
|
<state name="root">
|
|
<rule pattern="\s+">
|
|
<token type="TextWhitespace"/>
|
|
</rule>
|
|
<rule pattern="(@base|BASE)(\s+)(<[^<>"{}|^`\\\x00-\x20]*>)(\s*)(\.?)">
|
|
<bygroups>
|
|
<token type="Keyword"/>
|
|
<token type="TextWhitespace"/>
|
|
<token type="NameVariable"/>
|
|
<token type="TextWhitespace"/>
|
|
<token type="Punctuation"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="(@prefix|PREFIX)(\s+)((?:[a-z][\w-]*)?\:)(\s+)(<[^<>"{}|^`\\\x00-\x20]*>)(\s*)(\.?)">
|
|
<bygroups>
|
|
<token type="Keyword"/>
|
|
<token type="TextWhitespace"/>
|
|
<token type="NameNamespace"/>
|
|
<token type="TextWhitespace"/>
|
|
<token type="NameVariable"/>
|
|
<token type="TextWhitespace"/>
|
|
<token type="Punctuation"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="(?<=\s)a(?=\s)">
|
|
<token type="KeywordType"/>
|
|
</rule>
|
|
<rule pattern="(<[^<>"{}|^`\\\x00-\x20]*>)">
|
|
<token type="NameVariable"/>
|
|
</rule>
|
|
<rule pattern="((?:[a-z][\w-]*)?\:)([a-z][\w-]*)">
|
|
<bygroups>
|
|
<token type="NameNamespace"/>
|
|
<token type="NameTag"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="#[^\n]+">
|
|
<token type="Comment"/>
|
|
</rule>
|
|
<rule pattern="\b(true|false)\b">
|
|
<token type="Literal"/>
|
|
</rule>
|
|
<rule pattern="[+\-]?\d*\.\d+">
|
|
<token type="LiteralNumberFloat"/>
|
|
</rule>
|
|
<rule pattern="[+\-]?\d*(:?\.\d+)?E[+\-]?\d+">
|
|
<token type="LiteralNumberFloat"/>
|
|
</rule>
|
|
<rule pattern="[+\-]?\d+">
|
|
<token type="LiteralNumberInteger"/>
|
|
</rule>
|
|
<rule pattern="[\[\](){}.;,:^]">
|
|
<token type="Punctuation"/>
|
|
</rule>
|
|
<rule pattern=""""">
|
|
<token type="LiteralString"/>
|
|
<push state="triple-double-quoted-string"/>
|
|
</rule>
|
|
<rule pattern=""">
|
|
<token type="LiteralString"/>
|
|
<push state="single-double-quoted-string"/>
|
|
</rule>
|
|
<rule pattern="'''">
|
|
<token type="LiteralString"/>
|
|
<push state="triple-single-quoted-string"/>
|
|
</rule>
|
|
<rule pattern="'">
|
|
<token type="LiteralString"/>
|
|
<push state="single-single-quoted-string"/>
|
|
</rule>
|
|
</state>
|
|
</rules>
|
|
</lexer>
|