<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE syntax SYSTEM "syntax.dtd">
<syntax>
    <!-- 
    The <head> tag encloses some global information about the mode.
    This tag is required.
    -->    

    <head>

        <!-- 
        The <name> specifies the modes name. It is currently not used in the application,
        as the mode name is loaded from Info.plist, however it is a good idea to specify
        this tag to don't get confused if the definitions is outside a bundle during
        development.
        This tag is optional.
        -->    


        <name>Io Syntax</name> <!-- The definitions title -->
        
        
        <!-- 
        The <charsintokens> and the <charsdelimitingtokens> instruct the syntax highlighter
        where to tokenize the text for fast finding of plain strings.
        The <charsintokens> tag specifies the characters that can occur in strings,
        the <charsdelimitingtokens> tag specifies the tags that cannot occur in strings.
        One of these tags has to be specified.
        Tip: Use CDATA here.
        -->    
        
        <charsintokens>
        <![CDATA[_0987654321abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@]]>
        </charsintokens> <!-- Valid Characters for Variables -->
        <!-- <charsdelimitingtokens></charsdelimitingtokens> -->
    </head>

    <!-- 
    The <states> tag encloses all syntax states.
    States are areas of the test that begin and end with an regex like comments or strings,
    with exception of the default state, that exists anywhere where no other state exists.
    This tag is required.
    -->    

    <states>
    
            <!-- 
        The <default> tag specifies what is colored within the default state (see above).
        It features the following attributes, all optional if not noted otherwise:
            id
                Has to be a unique string. Has to be specified.
            color
                a html comptible color in three or six letter hexadecimal format.
                Used for text on bright document background colors.
            inverted-color
                a html comptible color in three or six letter hexadecimal format.
                Used for text if a dark document background color is set.
            font-weight
                normal  Normal font-weight (default)
                bold    Bold text in popup
            font-style
                normal  Normal font-weight (default)
                italic  Bold text in popup
                
        -->    
    
        <default id="Base" color="#000" background-color="#fff" font-weight="normal" font-style="normal">
        
            <!-- 
            The <keywords> tag specifies keyword groups within the current state.
            It features the following attributes, all optional if not noted otherwise:
                id
                    Has to be a unique string. Has to be specified.
                color
                    a html comptible color in three or six letter hexadecimal format.
                    Used for text on bright document background colors.
                inverted-color
                    a html comptible color in three or six letter hexadecimal format.
                    Used for text if a dark document background color is set.
                font-weight
                    normal  Normal font-weight (default)
                    bold    Bold text in popup
                font-style
                    normal  Normal font-weight (default)
                    italic  Bold text in popup
                casesensitive
                    yes     This group is case sensitive (default)
                    no      Ignore case for the group
                useforautocomplete
                    yes     Add this group's strings to the autocomplete dictionary (default)
                    no      Don't add to autocomplete dictionary
            -->    
        	

            <keywords id="Keywords" color="#d90" useforautocomplete="no">
                <string>self</string>
                <string>sender</string>
                <string>and</string>
                <string>block</string>
                <string>break</string>
                <string>catch</string>
                <string>clone</string>
                <string>else</string>
                <string>for</string>
                <string>foreach</string>
                <string>forward</string>
                <string>if</string>
                <string>method</string>
                <string>or</string>
                <string>proto</string>
                <string>resume</string>
                <string>sender</string>
                <string>super</string>
                <string>target</string>
                <string>then</string>
                <string>try</string>
                <string>wait</string>
                <string>while</string>
            </keywords>

            <keywords id="Numbers" color="#009919" useforautocomplete="no">
				<regex>(?&lt;=[^[A-Za-z0-9]]|^)((([0-9]+\.[0-9]*)|(\.[0-9]+)([eE][+\-]?[0-9]+)?[fFlL]?)|((([1-9][0-9]*)|0[0-7]*|(0[xX][0-9a-fA-F]))(([uU][lL]?)|([lL][uU]?))?))(?=[^[A-Za-z0-9]]|$)</regex>
            </keywords>

            <keywords id="Operators" color="#407" useforautocomplete="no">
				<regex>([\+\-\*\\\=\{\}\[\]\|\!\:\&lt;\&gt;])</regex>
            </keywords>

            <keywords id="Brackets" color="#f00" useforautocomplete="no">
				<regex>([\(\)])</regex>
            </keywords>
        </default>      
        
                <!-- 
            The <state> tag specifies a state other than the default state.
            It features the same attributes as <default>.
            It has to contain a <begin> and a <end> tag which in turn have to 
            contain a <regex> tag. They can contain <keywords> tags like specified above.
        -->    
        
        <state id="HashComment" color="#b00" background-color="none" font-weight="bold" font-style="italic">
            <begin><regex>#</regex></begin>
            <end><regex>[\n\r]</regex></end>
        </state>

        <state id="Comment" color="#b00" background-color="none" font-weight="normal" font-style="italic">
            <begin><regex>/\*</regex></begin>
            <end><regex>\*/</regex></end>
        </state>
        
        <state id="SingleComment" color="#b00" background-color="none" font-weight="normal" font-style="italic">
            <begin><regex>//</regex></begin>
            <end><regex>[\n\r]</regex></end>
        </state>
        
        <state id="String" color="#060" background-color="none" font-weight="normal" font-style="normal">
            <begin><regex>"|"""</regex></begin>
            <end><regex>(((?&lt;!\\)(\\\\)*)|^)"</regex></end>
        </state>
    </states>

</syntax>
