tartrazine/lexers/actionscript_3.xml

163 lines
5.3 KiB
XML
Raw Normal View History

2024-08-02 20:03:49 +00:00
<lexer>
<config>
<name>ActionScript 3</name>
<alias>as3</alias>
<alias>actionscript3</alias>
<filename>*.as</filename>
<mime_type>application/x-actionscript3</mime_type>
<mime_type>text/x-actionscript3</mime_type>
<mime_type>text/actionscript3</mime_type>
<dot_all>true</dot_all>
</config>
<rules>
<state name="funcparams">
<rule pattern="\s+">
<token type="Text"/>
</rule>
<rule pattern="(\s*)(\.\.\.)?([$a-zA-Z_]\w*)(\s*)(:)(\s*)([$a-zA-Z_]\w*(?:\.&lt;\w+&gt;)?|\*)(\s*)">
<bygroups>
<token type="Text"/>
<token type="Punctuation"/>
<token type="Name"/>
<token type="Text"/>
<token type="Operator"/>
<token type="Text"/>
<token type="KeywordType"/>
<token type="Text"/>
</bygroups>
<push state="defval"/>
</rule>
<rule pattern="\)">
<token type="Operator"/>
<push state="type"/>
</rule>
</state>
<state name="type">
<rule pattern="(\s*)(:)(\s*)([$a-zA-Z_]\w*(?:\.&lt;\w+&gt;)?|\*)">
<bygroups>
<token type="Text"/>
<token type="Operator"/>
<token type="Text"/>
<token type="KeywordType"/>
</bygroups>
<pop depth="2"/>
</rule>
<rule pattern="\s+">
<token type="Text"/>
<pop depth="2"/>
</rule>
<rule>
<pop depth="2"/>
</rule>
</state>
<state name="defval">
<rule pattern="(=)(\s*)([^(),]+)(\s*)(,?)">
<bygroups>
<token type="Operator"/>
<token type="Text"/>
<usingself state="root"/>
<token type="Text"/>
<token type="Operator"/>
</bygroups>
<pop depth="1"/>
</rule>
<rule pattern=",">
<token type="Operator"/>
<pop depth="1"/>
</rule>
<rule>
<pop depth="1"/>
</rule>
</state>
<state name="root">
<rule pattern="\s+">
<token type="Text"/>
</rule>
<rule pattern="(function\s+)([$a-zA-Z_]\w*)(\s*)(\()">
<bygroups>
<token type="KeywordDeclaration"/>
<token type="NameFunction"/>
<token type="Text"/>
<token type="Operator"/>
</bygroups>
<push state="funcparams"/>
</rule>
<rule pattern="(var|const)(\s+)([$a-zA-Z_]\w*)(\s*)(:)(\s*)([$a-zA-Z_]\w*(?:\.&lt;\w+&gt;)?)">
<bygroups>
<token type="KeywordDeclaration"/>
<token type="Text"/>
<token type="Name"/>
<token type="Text"/>
<token type="Punctuation"/>
<token type="Text"/>
<token type="KeywordType"/>
</bygroups>
</rule>
<rule pattern="(import|package)(\s+)((?:[$a-zA-Z_]\w*|\.)+)(\s*)">
<bygroups>
<token type="Keyword"/>
<token type="Text"/>
<token type="NameNamespace"/>
<token type="Text"/>
</bygroups>
</rule>
<rule pattern="(new)(\s+)([$a-zA-Z_]\w*(?:\.&lt;\w+&gt;)?)(\s*)(\()">
<bygroups>
<token type="Keyword"/>
<token type="Text"/>
<token type="KeywordType"/>
<token type="Text"/>
<token type="Operator"/>
</bygroups>
</rule>
<rule pattern="//.*?\n">
<token type="CommentSingle"/>
</rule>
<rule pattern="/\*.*?\*/">
<token type="CommentMultiline"/>
</rule>
<rule pattern="/(\\\\|\\/|[^\n])*/[gisx]*">
<token type="LiteralStringRegex"/>
</rule>
<rule pattern="(\.)([$a-zA-Z_]\w*)">
<bygroups>
<token type="Operator"/>
<token type="NameAttribute"/>
</bygroups>
</rule>
<rule pattern="(case|default|for|each|in|while|do|break|return|continue|if|else|throw|try|catch|with|new|typeof|arguments|instanceof|this|switch|import|include|as|is)\b">
<token type="Keyword"/>
</rule>
<rule pattern="(class|public|final|internal|native|override|private|protected|static|import|extends|implements|interface|intrinsic|return|super|dynamic|function|const|get|namespace|package|set)\b">
<token type="KeywordDeclaration"/>
</rule>
<rule pattern="(true|false|null|NaN|Infinity|-Infinity|undefined|void)\b">
<token type="KeywordConstant"/>
</rule>
<rule pattern="(decodeURI|decodeURIComponent|encodeURI|escape|eval|isFinite|isNaN|isXMLName|clearInterval|fscommand|getTimer|getURL|getVersion|isFinite|parseFloat|parseInt|setInterval|trace|updateAfterEvent|unescape)\b">
<token type="NameFunction"/>
</rule>
<rule pattern="[$a-zA-Z_]\w*">
<token type="Name"/>
</rule>
<rule pattern="[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="0x[0-9a-f]+">
<token type="LiteralNumberHex"/>
</rule>
<rule pattern="[0-9]+">
<token type="LiteralNumberInteger"/>
</rule>
<rule pattern="&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
<token type="LiteralStringDouble"/>
</rule>
<rule pattern="&#39;(\\\\|\\&#39;|[^&#39;])*&#39;">
<token type="LiteralStringSingle"/>
</rule>
<rule pattern="[~^*!%&amp;&lt;&gt;|+=:;,/?\\{}\[\]().-]+">
<token type="Operator"/>
</rule>
</state>
</rules>
</lexer>