tartrazine/lexers/glsl.xml

65 lines
2.4 KiB
XML

<lexer>
<config>
<name>GLSL</name>
<alias>glsl</alias>
<filename>*.vert</filename>
<filename>*.frag</filename>
<filename>*.geo</filename>
<mime_type>text/x-glslsrc</mime_type>
</config>
<rules>
<state name="root">
<rule pattern="^#.*">
<token type="CommentPreproc"/>
</rule>
<rule pattern="//.*">
<token type="CommentSingle"/>
</rule>
<rule pattern="/(\\\n)?[*](.|\n)*?[*](\\\n)?/">
<token type="CommentMultiline"/>
</rule>
<rule pattern="\+|-|~|!=?|\*|/|%|&lt;&lt;|&gt;&gt;|&lt;=?|&gt;=?|==?|&amp;&amp;?|\^|\|\|?">
<token type="Operator"/>
</rule>
<rule pattern="[?:]">
<token type="Operator"/>
</rule>
<rule pattern="\bdefined\b">
<token type="Operator"/>
</rule>
<rule pattern="[;{}(),\[\]]">
<token type="Punctuation"/>
</rule>
<rule pattern="[+-]?\d*\.\d+([eE][-+]?\d+)?">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="[+-]?\d+\.\d*([eE][-+]?\d+)?">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="0[xX][0-9a-fA-F]*">
<token type="LiteralNumberHex"/>
</rule>
<rule pattern="0[0-7]*">
<token type="LiteralNumberOct"/>
</rule>
<rule pattern="[1-9][0-9]*">
<token type="LiteralNumberInteger"/>
</rule>
<rule pattern="\b(sampler3DsamplerCube|sampler2DShadow|sampler1DShadow|invariant|sampler1D|sampler2D|attribute|mat3mat4|centroid|continue|varying|uniform|discard|mat4x4|mat3x3|mat2x3|mat4x2|mat3x2|mat2x2|mat2x4|mat3x4|struct|return|mat4x3|bvec4|false|ivec4|ivec3|const|float|inout|ivec2|break|while|bvec3|bvec2|vec3|else|true|void|bool|vec2|vec4|mat2|for|out|int|in|do|if)\b">
<token type="Keyword"/>
</rule>
<rule pattern="\b(sampler2DRectShadow|sampler2DRect|sampler3DRect|namespace|precision|interface|volatile|template|unsigned|external|noinline|mediump|typedef|default|switch|static|extern|inline|sizeof|output|packed|double|public|fvec3|class|union|short|highp|fixed|input|fvec4|hvec2|hvec3|hvec4|dvec2|dvec3|dvec4|fvec2|using|long|this|enum|lowp|cast|goto|half|asm)\b">
<token type="Keyword"/>
</rule>
<rule pattern="[a-zA-Z_]\w*">
<token type="Name"/>
</rule>
<rule pattern="\.">
<token type="Punctuation"/>
</rule>
<rule pattern="\s+">
<token type="Text"/>
</rule>
</state>
</rules>
</lexer>