tartrazine/lexers/blitzbasic.xml

141 lines
4.5 KiB
XML
Raw Normal View History

2024-08-02 20:03:49 +00:00
<lexer>
<config>
<name>BlitzBasic</name>
<alias>blitzbasic</alias>
<alias>b3d</alias>
<alias>bplus</alias>
<filename>*.bb</filename>
<filename>*.decls</filename>
<mime_type>text/x-bb</mime_type>
<case_insensitive>true</case_insensitive>
</config>
<rules>
<state name="string">
<rule pattern="&#34;&#34;">
<token type="LiteralStringDouble"/>
</rule>
<rule pattern="&#34;C?">
<token type="LiteralStringDouble"/>
<pop depth="1"/>
</rule>
<rule pattern="[^&#34;]+">
<token type="LiteralStringDouble"/>
</rule>
</state>
<state name="root">
<rule pattern="[ \t]+">
<token type="Text"/>
</rule>
<rule pattern=";.*?\n">
<token type="CommentSingle"/>
</rule>
<rule pattern="&#34;">
<token type="LiteralStringDouble"/>
<push state="string"/>
</rule>
<rule pattern="[0-9]+\.[0-9]*(?!\.)">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="\.[0-9]+(?!\.)">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="[0-9]+">
<token type="LiteralNumberInteger"/>
</rule>
<rule pattern="\$[0-9a-f]+">
<token type="LiteralNumberHex"/>
</rule>
<rule pattern="\%[10]+">
<token type="LiteralNumberBin"/>
</rule>
<rule pattern="\b(Before|Handle|After|First|Float|Last|Sgn|Abs|Not|And|Int|Mod|Str|Sar|Shr|Shl|Or)\b">
<token type="Operator"/>
</rule>
<rule pattern="([+\-*/~=&lt;&gt;^])">
<token type="Operator"/>
</rule>
<rule pattern="[(),:\[\]\\]">
<token type="Punctuation"/>
</rule>
<rule pattern="\.([ \t]*)([a-z]\w*)">
<token type="NameLabel"/>
</rule>
<rule pattern="\b(New)\b([ \t]+)([a-z]\w*)">
<bygroups>
<token type="KeywordReserved"/>
<token type="Text"/>
<token type="NameClass"/>
</bygroups>
</rule>
<rule pattern="\b(Gosub|Goto)\b([ \t]+)([a-z]\w*)">
<bygroups>
<token type="KeywordReserved"/>
<token type="Text"/>
<token type="NameLabel"/>
</bygroups>
</rule>
<rule pattern="\b(Object)\b([ \t]*)([.])([ \t]*)([a-z]\w*)\b">
<bygroups>
<token type="Operator"/>
<token type="Text"/>
<token type="Punctuation"/>
<token type="Text"/>
<token type="NameClass"/>
</bygroups>
</rule>
<rule pattern="\b([a-z]\w*)(?:([ \t]*)(@{1,2}|[#$%])|([ \t]*)([.])([ \t]*)(?:([a-z]\w*)))?\b([ \t]*)(\()">
<bygroups>
<token type="NameFunction"/>
<token type="Text"/>
<token type="KeywordType"/>
<token type="Text"/>
<token type="Punctuation"/>
<token type="Text"/>
<token type="NameClass"/>
<token type="Text"/>
<token type="Punctuation"/>
</bygroups>
</rule>
<rule pattern="\b(Function)\b([ \t]+)([a-z]\w*)(?:([ \t]*)(@{1,2}|[#$%])|([ \t]*)([.])([ \t]*)(?:([a-z]\w*)))?">
<bygroups>
<token type="KeywordReserved"/>
<token type="Text"/>
<token type="NameFunction"/>
<token type="Text"/>
<token type="KeywordType"/>
<token type="Text"/>
<token type="Punctuation"/>
<token type="Text"/>
<token type="NameClass"/>
</bygroups>
</rule>
<rule pattern="\b(Type)([ \t]+)([a-z]\w*)">
<bygroups>
<token type="KeywordReserved"/>
<token type="Text"/>
<token type="NameClass"/>
</bygroups>
</rule>
<rule pattern="\b(Pi|True|False|Null)\b">
<token type="KeywordConstant"/>
</rule>
<rule pattern="\b(Local|Global|Const|Field|Dim)\b">
<token type="KeywordDeclaration"/>
</rule>
<rule pattern="\b(Function|Restore|Default|Forever|Include|Return|Repeat|ElseIf|Delete|Insert|Select|EndIf|Until|While|Gosub|Type|Goto|Else|Data|Next|Step|Each|Case|Wend|Exit|Read|Then|For|New|Asc|Len|Chr|End|To|If)\b">
<token type="KeywordReserved"/>
</rule>
<rule pattern="([a-z]\w*)(?:([ \t]*)(@{1,2}|[#$%])|([ \t]*)([.])([ \t]*)(?:([a-z]\w*)))?">
<bygroups>
<token type="NameVariable"/>
<token type="Text"/>
<token type="KeywordType"/>
<token type="Text"/>
<token type="Punctuation"/>
<token type="Text"/>
<token type="NameClass"/>
</bygroups>
</rule>
</state>
</rules>
</lexer>