tartrazine/lexers/angular2.xml

108 lines
3.1 KiB
XML

<lexer>
<config>
<name>Angular2</name>
<alias>ng2</alias>
</config>
<rules>
<state name="attr">
<rule pattern="&#34;.*?&#34;">
<token type="LiteralString"/>
<pop depth="1"/>
</rule>
<rule pattern="&#39;.*?&#39;">
<token type="LiteralString"/>
<pop depth="1"/>
</rule>
<rule pattern="[^\s&gt;]+">
<token type="LiteralString"/>
<pop depth="1"/>
</rule>
</state>
<state name="root">
<rule pattern="[^{([*#]+">
<token type="Other"/>
</rule>
<rule pattern="(\{\{)(\s*)">
<bygroups>
<token type="CommentPreproc"/>
<token type="Text"/>
</bygroups>
<push state="ngExpression"/>
</rule>
<rule pattern="([([]+)([\w:.-]+)([\])]+)(\s*)(=)(\s*)">
<bygroups>
<token type="Punctuation"/>
<token type="NameAttribute"/>
<token type="Punctuation"/>
<token type="Text"/>
<token type="Operator"/>
<token type="Text"/>
</bygroups>
<push state="attr"/>
</rule>
<rule pattern="([([]+)([\w:.-]+)([\])]+)(\s*)">
<bygroups>
<token type="Punctuation"/>
<token type="NameAttribute"/>
<token type="Punctuation"/>
<token type="Text"/>
</bygroups>
</rule>
<rule pattern="([*#])([\w:.-]+)(\s*)(=)(\s*)">
<bygroups>
<token type="Punctuation"/>
<token type="NameAttribute"/>
<token type="Punctuation"/>
<token type="Operator"/>
</bygroups>
<push state="attr"/>
</rule>
<rule pattern="([*#])([\w:.-]+)(\s*)">
<bygroups>
<token type="Punctuation"/>
<token type="NameAttribute"/>
<token type="Punctuation"/>
</bygroups>
</rule>
</state>
<state name="ngExpression">
<rule pattern="\s+(\|\s+)?">
<token type="Text"/>
</rule>
<rule pattern="\}\}">
<token type="CommentPreproc"/>
<pop depth="1"/>
</rule>
<rule pattern=":?(true|false)">
<token type="LiteralStringBoolean"/>
</rule>
<rule pattern=":?&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
<token type="LiteralStringDouble"/>
</rule>
<rule pattern=":?&#39;(\\\\|\\&#39;|[^&#39;])*&#39;">
<token type="LiteralStringSingle"/>
</rule>
<rule pattern="[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?">
<token type="LiteralNumber"/>
</rule>
<rule pattern="[a-zA-Z][\w-]*(\(.*\))?">
<token type="NameVariable"/>
</rule>
<rule pattern="\.[\w-]+(\(.*\))?">
<token type="NameVariable"/>
</rule>
<rule pattern="(\?)(\s*)([^}\s]+)(\s*)(:)(\s*)([^}\s]+)(\s*)">
<bygroups>
<token type="Operator"/>
<token type="Text"/>
<token type="LiteralString"/>
<token type="Text"/>
<token type="Operator"/>
<token type="Text"/>
<token type="LiteralString"/>
<token type="Text"/>
</bygroups>
</rule>
</state>
</rules>
</lexer>