<?xml version="1.0"?>
<SyntaxDefinition name="IL" extensions=".il" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008">
  <Color name="Numerical" foreground="MidnightBlue" fontWeight="bold" exampleText="o.#{#ToString#}#();"/>
  <Color name="Constants" foreground="#630808" exampleText="TRUE 4 20"/>
  <Color name="Labels" foreground="#bd7013" exampleText="Label1:"/>
  <Color name="Comment" foreground="Green" exampleText="(*comment*)" />
  <Color name="Address" foreground="#08635b" exampleText="%I20.1"/>
  <Color name="Instructions" fontWeight="bold" foreground="Blue" exampleText="LD LDN AND"/>
  <Color name="Blocks" fontWeight="bold" foreground="#866eb5" exampleText="VAR VAR_GLOBAL"/>


  <Property name="DocCommentMarker" value="///" />

	<!-- This is the main ruleset. -->
	<RuleSet>	
		<Span color="Comment" multiline="false">
			<Begin>\(\*</Begin>
			<End>\)\*</End>
		</Span>
		
		<Rule color="Labels">
			\w+:		
		</Rule>

    <Keywords color="Blocks">
      <Word>VAR_GLOBAL</Word>
      <Word>VAR_INPUT</Word>
      <Word>END_VAR</Word>
      <Word>PROGRAM</Word>
      <Word>END_PROGRAM</Word>
      <Word>FUNCTION</Word>
      <Word>END_FUNCTION</Word>
    </Keywords>
    
		<Keywords color="Instructions">
			<Word>LD</Word>
			<Word>LDN</Word>
			
			<Word>NOP</Word>
			
			<Word>ST</Word>
			<Word>STN</Word>
			
			<Word>AND</Word>
			<Word>ANDN</Word>
			<Word>AND(</Word>
			
			<Word>OR</Word>
			<Word>ORN</Word>
			<Word>OR(</Word>
			
			<Word>XOR</Word>
			<Word>XORN</Word>
			<Word>XOR(</Word>
			
			<Word>NOT</Word>
			
			<Word>ADD</Word>
			<Word>ADD(</Word>
			
			<Word>SUB</Word>
			<Word>SUB(</Word>
			
			<Word>MUL</Word>
			<Word>MUL(</Word>
			
			<Word>DIV</Word>
			<Word>DIV(</Word>
			
			<Word>MOD</Word>
			<Word>MOD(</Word>
						
			<Word>GT</Word>
			<Word>GT(</Word>
			
			<Word>GE</Word>
			<Word>GE(</Word>
			
			<Word>EQ</Word>
			<Word>EQ(</Word>
			
			<Word>NE</Word>
			<Word>NE(</Word>
			
			<Word>LE</Word>
			<Word>LE(</Word>
			
			<Word>LT</Word>
			<Word>LT(</Word>
			
			<Word>JMP</Word>
			<Word>JMPC</Word>
			<Word>JMPN</Word>
			<Word>JMPCN</Word>
			
			<Word>CAL</Word>
			<Word>CALC</Word>
			<Word>CALN</Word>
			
			<Word>RET</Word>
			<Word>RETC</Word>
			<Word>RETN</Word>
			
			<Word>)</Word>
			<Word>S</Word>
			<Word>R</Word>
			<Word>S1</Word>
			<Word>R1</Word>
			<Word>CLK</Word>
			<Word>CU</Word>
			<Word>CD</Word>
			<Word>PV</Word>
			<Word>IN</Word>
			<Word>PT</Word>
			<Word>SET</Word>
			<Word>RST</Word>
		</Keywords>

    <Keywords color="Constants">
      <Word>TRUE</Word>
      <Word>true</Word>
      <Word>FALSE</Word>
      <Word>false</Word>
    </Keywords>
    
		<!-- Digits -->
		<Rule color="Numerical">
			\b0[xX][0-9a-fA-F]+  # hex number
			|
			(	\b\d+(\.[0-9]+)?   #number with optional floating point
			|	\.[0-9]+           #or just starting with floating point
			)
			([eE][+-]?[0-9]+)? # optional exponent
		</Rule>
    
    <!-- Relative addresses-->
    <Rule color="Address">
      (\%(?:I|IB|IW|ID|Q|QB|QW|QD|M|MB|MW|MD)[0-9]+)(\.[0-9]*)?
    </Rule>
	</RuleSet>
</SyntaxDefinition>
