
      <rule>
        <include state="whitespace"/>
      </rule>
      <rule pattern="((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;{]*)(\{)">
        <bygroups>
          <usingself state="root"/>
          <token type="NameFunction"/>
          <usingself state="root"/>
          <usingself state="root"/>
          <token type="Punctuation"/>
        </bygroups>
        <push state="function"/>
      </rule>
      <rule pattern="((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;]*)(;)">
        <bygroups>
          <usingself state="root"/>
          <token type="NameFunction"/>
          <usingself state="root"/>
          <usingself state="root"/>
          <token type="Punctuation"/>
        </bygroups>
      </rule>
      <rule>
        <push state="statement"/>
      </rule>
    </state>
    <state name="statements">
      <rule pattern="@&#34;">
        <token type="LiteralString"/>
        <push state="string"/>
      </rule>
      <rule pattern="@(YES|NO)">
        <token type="LiteralNumber"/>
      </rule>
      <rule pattern="@&#39;(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\&#39;\n])&#39;">
        <token type="LiteralStringChar"/>
      </rule>
      <rule pattern="@(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?">
        <token type="LiteralNumberFloat"/>
      </rule>
      <rule pattern="@(\d+\.\d*|\.\d+|\d+[fF])[fF]?">
        <token type="LiteralNumberFloat"/>
      </rule>
      <rule pattern="@0x[0-9a-fA-F]+[Ll]?">
        <token type="LiteralNumberHex"/>
      </rule>
      <rule pattern="@0[0-7]+[Ll]?">
        <token type="LiteralNumberOct"/>
      </rule>
      <rule pattern="@\d+[Ll]?">
        <token type="LiteralNumberInteger"/>
      </rule>
      <rule pattern="@\(">
        <token type="Literal"/>
        <push state="literal_number"/>
      </rule>
      <rule pattern="@\[">
        <token type="Literal"/>
        <push state="literal_array"/>
      </rule>
      <rule pattern="@\{">
        <token type="Literal"/>
        <push state="literal_dictionary"/>
      </rule>
      <rule pattern="(unsafe_unretained|__bridge_transfer|@autoreleasepool|__autoreleasing|@synchronized|@synthesize|@protected|@selector|@required|@optional|readwrite|@property|nonatomic|@finally|__bridge|@dynamic|__strong|readonly|@private|__block|@public|@encode|release|assign|retain|atomic|@throw|@catch|__weak|setter|getter|typeof|strong|inout|class|@try|@end|weak|copy|out|in)\b">
        <token type="Keyword"/>
      </rule>
      <rule pattern="(instancetype|IBOutlet|IBAction|unichar|Class|BOOL|IMP|SEL|id)\b">
        <token type="KeywordType"/>
      </rule>
      <rule pattern="@(true|false|YES|NO)\n">
        <token type="NameBuiltin"/>
      </rule>
      <rule pattern="(YES|NO|nil|self|super)\b">
        <token type="NameBuiltin"/>
      </rule>
      <rule pattern="(Boolean|UInt8|SInt8|UInt16|SInt16|UInt32|SInt32)\b">
        <token type="KeywordType"/>
      </rule>
      <rule pattern="(TRUE|FALSE)\b">
        <token type="NameBuiltin"/>
      </rule>
      <rule pattern="(@interface|@implementation)(\s+)">
        <bygroups>
          <token type="Keyword"/>
          <token type="Text"/>
        </bygroups>
        <push state="#pop" state="oc_classname"/>
      </rule>
      <rule pattern="(@class|@protocol)(\s+)">
        <bygroups>
          <token type="Keyword"/>
          <token type="Text"/>
        </bygroups>
        <push state="#pop" state="oc_forward_classname"/>
      </rule>
      <rule pattern="@">
        <token type="Punctuation"/>
      </rule>
      <rule pattern="(L?)(&#34;)">
        <bygroups>
          <token type="LiteralStringAffix"/>
          <token type="LiteralString"/>
        </bygroups>
        <push state="string"/>
      </rule>
      <rule pattern="(L?)(&#39;)(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\&#39;\n])(&#39;)">
        <bygroups>
          <token type="LiteralStringAffix"/>
          <token type="LiteralStringChar"/>
          <token type="LiteralStringChar"/>
          <token type="LiteralStringChar"/>
        </bygroups>
      </rule>
      <rule pattern="(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*">
        <token type="LiteralNumberFloat"/>
      </rule>
      <rule pattern="(\d+\.\d*|\.\d+|\d+[fF])[fF]?">
        <token type="LiteralNumberFloat"/>
      </rule>
      <rule pattern="0x[0-9a-fA-F]+[LlUu]*">
        <token type="LiteralNumberHex"/>
      </rule>
      <rule pattern="0[0-7]+[LlUu]*">
        <token type="LiteralNumberOct"/>
      </rule>
      <rule pattern="\d+[LlUu]*">
        <token type="LiteralNumberInteger"/>
      </rule>
      <rule pattern="\*/">
        <token type="Error"/>
      </rule>
      <rule pattern="[~!%^&amp;*+=|?:&lt;&gt;/-]">
        <token type="Operator"/>
      </rule>
      <rule pattern="[()\[\],.]">
        <token type="Punctuation"/>
      </rule>
      <rule pattern="(restricted|volatile|continue|register|default|typedef|struct|extern|switch|sizeof|static|return|union|while|const|break|goto|enum|else|case|auto|for|asm|if|do)\b">
        <token type="Keyword"/>
      </rule>
      <rule pattern="(bool|int|long|float|short|double|char|unsigned|signed|void)\b">
        <token type="KeywordType"/>
      </rule>
      <rule pattern="(typename|__inline|restrict|_inline|thread|inline|naked)\b">
        <token type="KeywordReserved"/>
      </rule>
      <rule pattern="(__m(128i|128d|128|64))\b">
        <token type="KeywordReserved"/>
      </rule>
      <rule pattern="__(forceinline|identifier|unaligned|declspec|fastcall|finally|stdcall|wchar_t|assume|except|int32|cdecl|int16|leave|based|raise|int64|noop|int8|w64|try|asm)\b">
        <token type="KeywordReserved"/>
      </rule>
      <rule pattern="(true|false|NULL)\b">
        <token type="NameBuiltin"/>
      </rule>
      <rule pattern="([a-zA-Z_]\w*)(\s*)(:)(?!:)">
        <bygroups>
          <token type="NameLabel"/>
          <token type="Text"/>
          <token type="Punctuation"/>
        </bygroups>
      </rule>
      <rule pattern="[a-zA-Z_]\w*">
        <token type="Name"/>
      </rule>
    </state>
    <state name="method">
      <rule>
        <include state="whitespace"/>
      </rule>
      <rule pattern=",">
        <token type="Punctuation"/>
      </rule>
      <rule pattern="\.\.\.">
        <token type="Punctuation"/>
      </rule>
      <rule pattern="(\(.*?\))(\s*)([a-zA-Z$_][\w$]*)">
        <bygroups>
          <usingself state="root"/>
          <token type="Text"/>
          <token type="NameVariable"/>
        </bygroups>
      </rule>
      <rule pattern="[a-zA-Z$_][\w$]*:">
        <token type="NameFunction"/>
      </rule>
      <rule pattern=";">
        <token type="Punctuation"/>
        <pop depth="1"/>
      </rule>
      <rule pattern="\{">
        <token type="Punctuation"/>
        <push state="function"/>
      </rule>
      <rule>
        <pop depth="1"/>
      </rule>
    </state>
    <state name="literal_array">
      <rule pattern="\[">
        <token type="Punctuation"/>
        <push state="literal_array_inner"/>
      </rule>
      <rule pattern="\]">
        <token type="Literal"/>
        <pop depth="1"/>
      </rule>
      <rule>
        <include state="statement"/>
      </rule>
    </state>
    <state name="oc_classname">
      <rule pattern="([a-zA-Z$_][\w$]*)(\s*:\s*)([a-zA-Z$_][\w$]*)?(\s*)(\{)">
        <bygroups>
          <token type="NameClass"/>
          <token type="Text"/>
          <token type="NameClass"/>
          <token type="Text"/>
          <token type="Punctuation"/>
        </bygroups>
        <push state="#pop" state="oc_ivars"/>
      </rule>
      <rule pattern="([a-zA-Z$_][\w$]*)(\s*:\s*)([a-zA-Z$_][\w$]*)?">
        <bygroups>
          <token type="NameClass"/>
          <token type="Text"/>
          <token type="NameClass"/>
        </bygroups>
        <pop depth="1"/>
      </rule>
      <rule pattern="([a-zA-Z$_][\w$]*)(\s*)(\([a-zA-Z$_][\w$]*\))(\s*)(\{)">
        <bygroups>
          <token type="NameClass"/>
          <token type="Text"/>
          <token type="NameLabel"/>
          <token type="Text"/>
          <token type="Punctuation"/>
        </bygroups>
        <push state="#pop" state="oc_ivars"/>
      </rule>
      <rule pattern="([a-zA-Z$_][\w$]*)(\s*)(\([a-zA-Z$_][\w$]*\))">
        <bygroups>
          <token type="NameClass"/>
          <token type="Text"/>
          <token type="NameLabel"/>
        </bygroups>
        <pop depth="1"/>
      </rule>
      <rule pattern="([a-zA-Z$_][\w$]*)(\s*)(\{)">
        <bygroups>
          <token type="NameClass"/>
          <token type="Text"/>
          <token type="Punctuation"/>
        </bygroups>
        <push state="#pop" state="oc_ivars"/>
      </rule>
      <rule pattern="([a-zA-Z$_][\w$]*)">
        <token type="NameClass"/>
        <pop depth="1"/>
      </rule>
    </state>
    <state name="function">
      <rule>
        <include state="whitespace"/>
      </rule>
      <rule>
        <include state="statements"/>
      </rule>
      <rule pattern=";">
        <token type="Punctuation"/>
      </rule>
      <rule pattern="\{">
        <token type="Punctuation"/>
        <push/>
      </rule>
      <rule pattern="\}">
        <token type="Punctuation"/>
        <pop depth="1"/>
      </rule>
    </state>
    <state name="whitespace">
      <rule pattern="^#if\s+0">
        <token type="CommentPreproc"/>
        <push state="if0"/>
      </rule>
      <rule pattern="^#">
        <token type="CommentPreproc"/>
        <push state="macro"/>
      </rule>
      <rule pattern="^(\s*(?:/[*].*?[*]/\s*)?)(#if\s+0)">
        <bygroups>
          <usingself state="root"/>
          <token type="CommentPreproc"/>
        </bygroups>
        <push state="if0"/>
      </rule>
      <rule pattern="^(\s*(?:/[*].*?[*]/\s*)?)(#)">
        <bygroups>
          <usingself state="root"/>
          <token type="CommentPreproc"/>
        </bygroups>
        <push state="macro"/>
      </rule>
      <rule pattern="\n">
        <token type="Text"/>
      </rule>
      <rule pattern="\s+">
        <token type="Text"/>
      </rule>
      <rule pattern="\\\n">
        <token type="Text"/>
      </rule>
      <rule pattern="//(\n|[\w\W]*?[^\\]\n)">
        <token type="CommentSingle"/>
      </rule>
      <rule pattern="/(\\\n)?[*][\w\W]*?[*](\\\n)?/">
        <token type="CommentMultiline"/>
      </rule>
      <rule pattern="/(\\\n)?[*][\w\W]*">
        <token type="CommentMultiline"/>
      </rule>
    </state>
    <state name="literal_number_inner">
      <rule pattern="\(">
        <token type="Punctuation"/>
        <push/>
      </rule>
      <rule pattern="\)">
        <token type="Punctuation"/>
        <pop depth="1"/>
      </rule>
      <rule>
        <include state="statement"/>
      </rule>
    </state>
    <state name="statement">
      <rule>
        <include state="whitespace"/>
      </rule>
      <rule>
        <include state="statements"/>
      </rule>
      <rule pattern="[{}]">
        <token type="Punctuation"/>
      </rule>
      <rule pattern=";">
        <token type="Punctuation"/>
        <pop depth="1"/>
      </rule>
    </state>
    <state name="oc_forward_classname">
      <rule pattern="([a-zA-Z$_][\w$]*)(\s*,\s*)">
        <bygroups>
          <token type="NameClass"/>
          <token type="Text"/>
        </bygroups>
        <push state="oc_forward_classname"/>
      </rule>
      <rule pattern="([a-zA-Z$_][\w$]*)(\s*;?)">
        <bygroups>
          <token type="NameClass"/>
          <token type="Text"/>
        </bygroups>
        <pop depth="1"/>
      </rule>
    </state>
    <state name="literal_array_inner">
      <rule pattern="\[">
        <token type="Punctuation"/>
        <push/>
      </rule>
      <rule pattern="\]">
        <token type="Punctuation"/>
        <pop depth="1"/>
      </rule>
      <rule>
        <include state="statement"/>
      </rule>
    </state>
    <state name="literal_dictionary">
      <rule pattern="\}">
        <token type="Literal"/>
        <pop depth="1"/>
      </rule>
      <rule>
        <include state="statement"/>
      </rule>
    </state>
    <state name="oc_ivars">
      <rule>
        <include state="whitespace"/>
      </rule>
      <rule>
        <include state="statements"/>
      </rule>
      <rule pattern=";">
        <token type="Punctuation"/>
      </rule>
      <rule pattern="\{">
        <token type="Punctuation"/>
        <push/>
      </rule>
      <rule pattern="\}">
        <token type="Punctuation"/>
        <pop depth="1"/>
      </rule>
    </state>
    <state name="string">
      <rule pattern="&#34;">
        <token type="LiteralString"/>
        <pop depth="1"/>
      </rule>
      <rule pattern="\\([\\abfnrtv&#34;\&#39;]|x[a-fA-F0-9]{2,4}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})">
        <token type="LiteralStringEscape"/>
      </rule>
      <rule pattern="[^\\&#34;\n]+">
        <token type="LiteralString"/>
      </rule>
      <rule pattern="\\\n">
        <token type="LiteralString"/>
      </rule>
      <rule pattern="\\">
        <token type="LiteralString"/>
      </rule>
    </state>
  </rules>
</lexer>