mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 05:22:23 +00:00
113 lines
3.8 KiB
XML
113 lines
3.8 KiB
XML
|
<lexer>
|
||
|
<config>
|
||
|
<name>QML</name>
|
||
|
<alias>qml</alias>
|
||
|
<alias>qbs</alias>
|
||
|
<filename>*.qml</filename>
|
||
|
<filename>*.qbs</filename>
|
||
|
<mime_type>application/x-qml</mime_type>
|
||
|
<mime_type>application/x-qt.qbs+qml</mime_type>
|
||
|
<dot_all>true</dot_all>
|
||
|
</config>
|
||
|
<rules>
|
||
|
<state name="root">
|
||
|
<rule pattern="^(?=\s|/|<!--)">
|
||
|
<token type="Text"/>
|
||
|
<push state="slashstartsregex"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="commentsandwhitespace"/>
|
||
|
</rule>
|
||
|
<rule pattern="\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?">
|
||
|
<token type="Operator"/>
|
||
|
<push state="slashstartsregex"/>
|
||
|
</rule>
|
||
|
<rule pattern="[{(\[;,]">
|
||
|
<token type="Punctuation"/>
|
||
|
<push state="slashstartsregex"/>
|
||
|
</rule>
|
||
|
<rule pattern="[})\].]">
|
||
|
<token type="Punctuation"/>
|
||
|
</rule>
|
||
|
<rule pattern="\bid\s*:\s*[A-Za-z][\w.]*">
|
||
|
<token type="KeywordDeclaration"/>
|
||
|
<push state="slashstartsregex"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b[A-Za-z][\w.]*\s*:">
|
||
|
<token type="Keyword"/>
|
||
|
<push state="slashstartsregex"/>
|
||
|
</rule>
|
||
|
<rule pattern="(for|in|while|do|break|return|continue|switch|case|default|if|else|throw|try|catch|finally|new|delete|typeof|instanceof|void|this)\b">
|
||
|
<token type="Keyword"/>
|
||
|
<push state="slashstartsregex"/>
|
||
|
</rule>
|
||
|
<rule pattern="(var|let|with|function)\b">
|
||
|
<token type="KeywordDeclaration"/>
|
||
|
<push state="slashstartsregex"/>
|
||
|
</rule>
|
||
|
<rule pattern="(abstract|boolean|byte|char|class|const|debugger|double|enum|export|extends|final|float|goto|implements|import|int|interface|long|native|package|private|protected|public|short|static|super|synchronized|throws|transient|volatile)\b">
|
||
|
<token type="KeywordReserved"/>
|
||
|
</rule>
|
||
|
<rule pattern="(true|false|null|NaN|Infinity|undefined)\b">
|
||
|
<token type="KeywordConstant"/>
|
||
|
</rule>
|
||
|
<rule pattern="(Array|Boolean|Date|Error|Function|Math|netscape|Number|Object|Packages|RegExp|String|sun|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|window)\b">
|
||
|
<token type="NameBuiltin"/>
|
||
|
</rule>
|
||
|
<rule pattern="[$a-zA-Z_]\w*">
|
||
|
<token type="NameOther"/>
|
||
|
</rule>
|
||
|
<rule pattern="[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?">
|
||
|
<token type="LiteralNumberFloat"/>
|
||
|
</rule>
|
||
|
<rule pattern="0x[0-9a-fA-F]+">
|
||
|
<token type="LiteralNumberHex"/>
|
||
|
</rule>
|
||
|
<rule pattern="[0-9]+">
|
||
|
<token type="LiteralNumberInteger"/>
|
||
|
</rule>
|
||
|
<rule pattern=""(\\\\|\\"|[^"])*"">
|
||
|
<token type="LiteralStringDouble"/>
|
||
|
</rule>
|
||
|
<rule pattern="'(\\\\|\\'|[^'])*'">
|
||
|
<token type="LiteralStringSingle"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="commentsandwhitespace">
|
||
|
<rule pattern="\s+">
|
||
|
<token type="Text"/>
|
||
|
</rule>
|
||
|
<rule pattern="<!--">
|
||
|
<token type="Comment"/>
|
||
|
</rule>
|
||
|
<rule pattern="//.*?\n">
|
||
|
<token type="CommentSingle"/>
|
||
|
</rule>
|
||
|
<rule pattern="/\*.*?\*/">
|
||
|
<token type="CommentMultiline"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="slashstartsregex">
|
||
|
<rule>
|
||
|
<include state="commentsandwhitespace"/>
|
||
|
</rule>
|
||
|
<rule pattern="/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/([gim]+\b|\B)">
|
||
|
<token type="LiteralStringRegex"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="(?=/)">
|
||
|
<token type="Text"/>
|
||
|
<push state="#pop" state="badregex"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="badregex">
|
||
|
<rule pattern="\n">
|
||
|
<token type="Text"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
</rules>
|
||
|
</lexer>
|