<lexer>
  <config>
    <name>Ring</name>
    <alias>ring</alias>
    <filename>*.ring</filename>
    <filename>*.rh</filename>
    <filename>*.rform</filename>
    <mime_type>text/x-ring</mime_type>
    <case_insensitive>true</case_insensitive>
  </config>
  <rules>
    <state name="root">
      <rule pattern="\s+"><token type="Text"/></rule>
      <rule pattern="//.*?\n"><token type="CommentSingle"/></rule>
      <rule pattern="#.*?\n"><token type="CommentSingle"/></rule>
      <rule pattern="/\*"><token type="CommentMultiline"/><push state="comment"/></rule>
      <rule pattern="^\s*(changeringkeyword|changeringoperator|disablehashcomments|enablehashcomments|loadsyntax)\b"><token type="CommentPreproc"/></rule>
      <rule pattern=":[a-zA-Z_@$][\w@$]*"><token type="LiteralStringSymbol"/></rule>
      <rule pattern="&quot;"><token type="LiteralStringDouble"/><push state="string-double"/></rule>
      <rule pattern="&#x27;"><token type="LiteralStringSingle"/><push state="string-single"/></rule>
      <rule pattern="`"><token type="LiteralStringBacktick"/><push state="string-backtick"/></rule>
      <rule pattern="(\bclass)(\s+)(\w+)"><bygroups><token type="KeywordDeclaration"/><token type="Text"/><token type="NameClass"/></bygroups></rule>
      <rule pattern="(\bfrom)(\s+)(\w+)"><bygroups><token type="KeywordDeclaration"/><token type="Text"/><token type="NameClass"/></bygroups></rule>
      <rule pattern="(\bfunc|def|function)(\s+)(\w+)"><bygroups><token type="KeywordDeclaration"/><token type="Text"/><token type="NameFunction"/></bygroups></rule>
      <rule pattern="(\bpackage|import)(\s+)([a-zA-Z_@$][\w@$.]*)"><bygroups><token type="KeywordNamespace"/><token type="Text"/><token type="NameNamespace"/></bygroups></rule>
      <rule pattern="(\bnew)(\s+)(\w+)"><bygroups><token type="KeywordPseudo"/><token type="Text"/><token type="NameClass"/></bygroups></rule>
      <rule pattern="\b(if|but|elseif|else|other|ok|endif|end|switch|on|case|off|endswitch|for|in|to|step|next|endfor|foreach|while|endwhile|do|again|return|bye|exit|break|loop|continue|call)\b"><token type="Keyword"/></rule>
      <rule pattern="\b(try|catch|done|endtry)\b"><token type="Keyword"/></rule>
      <rule pattern="\b(class|endclass|from|func|def|function|endfunc|endfunction|package|endpackage|private)\b"><token type="KeywordDeclaration"/></rule>
      <rule pattern="\b(load|import)\b"><token type="KeywordNamespace"/></rule>
      <rule pattern="\b(new|self|this|super)\b"><token type="KeywordPseudo"/></rule>
      <rule pattern="\b(see|put|give|get)\b"><token type="Keyword"/></rule>
      <rule pattern="\b(true|false|nl|null|tab|cr|sysargv|ccatcherror|ringoptionalfunctions)\b"><token type="NameBuiltinPseudo"/></rule>
      <rule pattern="\b(and|or|not)\b"><token type="OperatorWord"/></rule>
      <rule pattern="\b(acos|add|addattribute|adddays|addmethod|ascii|asin|assert|atan|atan2|attributes|binarysearch|bytes2double|bytes2float|bytes2int|callgarbagecollector|callgc|ceil|cfunctions|char|chdir|checkoverflow|classes|classname|clearerr|clock|clockspersecond|closelib|copy|cos|cosh|currentdir|date|dec|decimals|del|diffdays|dir|direxists|double2bytes|eval|exefilename|exefolder|exp|fabs|fclose|feof|ferror|fexists|fflush|fgetc|fgetpos|fgets|filename|find|float2bytes|floor|fopen|fputc|fputs|fread|freopen|fseek|fsetpos|ftell|functions|fwrite|getarch|getattribute|getchar|getfilesize|getnumber|getpathtype|getpointer|getptr|getstring|globals|hex|hex2str|importpackage|input|insert|int2bytes|intvalue|isalnum|isalpha|isandroid|isattribute|iscfunction|isclass|iscntrl|isdigit|isfreebsd|isfunction|isglobal|isgraph|islinux|islist|islocal|islower|ismacosx|ismethod|ismsdos|isnull|isnumber|isobject|ispackage|ispackageclass|ispointer|isprint|isprivateattribute|isprivatemethod|ispunct|isspace|isstring|isunix|isupper|iswindows|iswindows64|isxdigit|left|len|lines|list|list2str|loadlib|locals|log|log10|lower|max|memcpy|memorycopy|mergemethods|methods|min|murmur3hash|newlist|nofprocessors|nothing|nullpointer|nullptr|number|obj2ptr|object2pointer|objectid|optionalfunc|packageclasses|packagename|packages|parentclassname|perror|pointer2object|pointer2string|pointercompare|pow|prevfilename|print|print2str|ptr2obj|ptr2str|ptrcmp|puts|raise|random|randomize|read|ref|reference|refcount|remove|rename|reverse|rewind|right|ring_give|ring_see|ring_state_delete|ring_state_filetokens|ring_state_findvar|ring_state_init|ring_state_main|ring_state_mainfile|ring_state_new|ring_state_newvar|ring_state_resume|ring_state_runcode|ring_state_runcodeatins|ring_state_runfile|ring_state_runobjectfile|ring_state_scannererror|ring_state_setvar|ring_state_stringtokens|ringvm_callfunc|ringvm_calllist|ringvm_cfunctionslist|ringvm_classeslist|ringvm_codelist|ringvm_evalinscope|ringvm_fileslist|ringvm_functionslist|ringvm_genarray|ringvm_give|ringvm_hideerrormsg|ringvm_info|ringvm_ismempool|ringvm_memorylist|ringvm_packageslist|ringvm_passerror|ringvm_runcode|ringvm_scopescount|ringvm_see|ringvm_settrace|ringvm_tracedata|ringvm_traceevent|ringvm_tracefunc|setattribute|setpointer|setptr|shutdown|sin|sinh|sort|space|sqrt|srandom|str2hex|str2hexcstyle|str2list|strcmp|string|substr|swap|sysget|sysset|syssleep|system|sysunset|tan|tanh|tempfile|tempname|time|timelist|trim|type|ungetc|unsigned|upper|uptime|variablepointer|varptr|version|windowsnl|write)\b(?=\s*\()"><token type="NameBuiltin"/></rule>
      <rule pattern="0x[a-f0-9_]+"><token type="LiteralNumberHex"/></rule>
      <rule pattern="0b[01_]+"><token type="LiteralNumberBin"/></rule>
      <rule pattern="0o[0-7_]+"><token type="LiteralNumberOct"/></rule>
      <rule pattern="[0-9]+(?:_[0-9]+)*\.[0-9]*(?:_[0-9]+)*([eE][-+]?[0-9]+)?"><token type="LiteralNumberFloat"/></rule>
      <rule pattern="[0-9]+(?:_[0-9]+)*"><token type="LiteralNumberInteger"/></rule>
      <rule pattern="(\+\+|\-\-|\*\*|\^\^|!=|&lt;=|&gt;=|&lt;&lt;|&gt;&gt;|&amp;&amp;|\|\|)"><token type="Operator"/></rule>
      <rule pattern="(\+=|-=|\*=|/=|%=|&lt;&lt;=|&gt;&gt;=|&amp;=|\|=|\^=)"><token type="Operator"/></rule>
      <rule pattern="[-+/*%=&lt;&gt;&amp;|!~.:^?]"><token type="Operator"/></rule>
      <rule pattern="[\[\](){},;]"><token type="Punctuation"/></rule>
      <rule pattern="[a-zA-Z_@$][\w@$]*"><token type="Name"/></rule>
    </state>
    <state name="comment">
      <rule pattern="[^*/]+"><token type="CommentMultiline"/></rule>
      <rule pattern="/\*"><token type="CommentMultiline"/><push/></rule>
      <rule pattern="\*/"><token type="CommentMultiline"/><pop depth="1"/></rule>
      <rule pattern="[*/]"><token type="CommentMultiline"/></rule>
    </state>
    <state name="string-double">
      <rule pattern="[^&quot;#]+"><token type="LiteralStringDouble"/></rule>
      <rule pattern="#\{"><token type="LiteralStringInterpol"/><push state="interpolation"/></rule>
      <rule pattern="&quot;"><token type="LiteralStringDouble"/><pop depth="1"/></rule>
    </state>
    <state name="string-single">
      <rule pattern="[^&#x27;#]+"><token type="LiteralStringSingle"/></rule>
      <rule pattern="#\{"><token type="LiteralStringInterpol"/><push state="interpolation"/></rule>
      <rule pattern="&#x27;"><token type="LiteralStringSingle"/><pop depth="1"/></rule>
    </state>
    <state name="string-backtick">
      <rule pattern="[^`#]+"><token type="LiteralStringBacktick"/></rule>
      <rule pattern="#\{"><token type="LiteralStringInterpol"/><push state="interpolation"/></rule>
      <rule pattern="`"><token type="LiteralStringBacktick"/><pop depth="1"/></rule>
    </state>
    <state name="interpolation">
      <rule pattern="\}"><token type="LiteralStringInterpol"/><pop depth="1"/></rule>
      <rule><include state="root"/></rule>
    </state>
  </rules>
</lexer>

