mirror of
https://github.com/cheat/cheat.git
synced 2024-12-26 06:29:45 +01:00
88 lines
2.8 KiB
XML
88 lines
2.8 KiB
XML
|
<lexer>
|
||
|
<config>
|
||
|
<name>GraphQL</name>
|
||
|
<alias>graphql</alias>
|
||
|
<alias>graphqls</alias>
|
||
|
<alias>gql</alias>
|
||
|
<filename>*.graphql</filename>
|
||
|
<filename>*.graphqls</filename>
|
||
|
</config>
|
||
|
<rules>
|
||
|
<state name="root">
|
||
|
<rule pattern="(query|mutation|subscription|fragment|scalar|implements|interface|union|enum|input|type)">
|
||
|
<token type="KeywordDeclaration"/>
|
||
|
<push state="type"/>
|
||
|
</rule>
|
||
|
<rule pattern="(on|extend|schema|directive|\.\.\.)">
|
||
|
<token type="KeywordDeclaration"/>
|
||
|
</rule>
|
||
|
<rule pattern="(QUERY|MUTATION|SUBSCRIPTION|FIELD|FRAGMENT_DEFINITION|FRAGMENT_SPREAD|INLINE_FRAGMENT|SCHEMA|SCALAR|OBJECT|FIELD_DEFINITION|ARGUMENT_DEFINITION|INTERFACE|UNION|ENUM|ENUM_VALUE|INPUT_OBJECT|INPUT_FIELD_DEFINITION)\b">
|
||
|
<token type="KeywordConstant"/>
|
||
|
</rule>
|
||
|
<rule pattern="[^\W\d]\w*">
|
||
|
<token type="NameProperty"/>
|
||
|
</rule>
|
||
|
<rule pattern="\@\w+">
|
||
|
<token type="NameDecorator"/>
|
||
|
</rule>
|
||
|
<rule pattern=":">
|
||
|
<token type="Punctuation"/>
|
||
|
<push state="type"/>
|
||
|
</rule>
|
||
|
<rule pattern="[\(\)\{\}\[\],!\|=]">
|
||
|
<token type="Punctuation"/>
|
||
|
</rule>
|
||
|
<rule pattern="\$\w+">
|
||
|
<token type="NameVariable"/>
|
||
|
</rule>
|
||
|
<rule pattern="\d+i">
|
||
|
<token type="LiteralNumber"/>
|
||
|
</rule>
|
||
|
<rule pattern="\d+\.\d*([Ee][-+]\d+)?i">
|
||
|
<token type="LiteralNumber"/>
|
||
|
</rule>
|
||
|
<rule pattern="\.\d+([Ee][-+]\d+)?i">
|
||
|
<token type="LiteralNumber"/>
|
||
|
</rule>
|
||
|
<rule pattern="\d+[Ee][-+]\d+i">
|
||
|
<token type="LiteralNumber"/>
|
||
|
</rule>
|
||
|
<rule pattern="\d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)">
|
||
|
<token type="LiteralNumberFloat"/>
|
||
|
</rule>
|
||
|
<rule pattern="\.\d+([eE][+\-]?\d+)?">
|
||
|
<token type="LiteralNumberFloat"/>
|
||
|
</rule>
|
||
|
<rule pattern="(0|[1-9][0-9]*)">
|
||
|
<token type="LiteralNumberInteger"/>
|
||
|
</rule>
|
||
|
<rule pattern=""""[\x00-\x7F]*?"""">
|
||
|
<token type="LiteralString"/>
|
||
|
</rule>
|
||
|
<rule pattern=""(\\["\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])"">
|
||
|
<token type="LiteralStringChar"/>
|
||
|
</rule>
|
||
|
<rule pattern=""(\\\\|\\"|[^"])*"">
|
||
|
<token type="LiteralString"/>
|
||
|
</rule>
|
||
|
<rule pattern=""(true|false|null)*"">
|
||
|
<token type="Literal"/>
|
||
|
</rule>
|
||
|
<rule pattern="[\r\n\s]+">
|
||
|
<token type="TextWhitespace"/>
|
||
|
</rule>
|
||
|
<rule pattern="#[^\r\n]*">
|
||
|
<token type="Comment"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="type">
|
||
|
<rule pattern="[^\W\d]\w*">
|
||
|
<token type="NameClass"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="root"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
</rules>
|
||
|
</lexer>
|