<?xml version="1.0" encoding="UTF-8"?>
<!--

 Author: Peter van Eerten <peter@basic-converter.org>
 Copyright (C) 2010 Peter van Eerten <peter@basic-converter.org>

 Language: BaCon (BAsic CONverter)
 Last Change: April 6, 2011

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Library General Public
 License as published by the Free Software Foundation; either
 version 2 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Library General Public License for more details.

 You should have received a copy of the GNU Library General Public
 License along with this library; if not, write to the
 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.

    =========================
    INSTALLATION INSTRUCTIONS
    =========================

(1) Create language directory for GtkSourceView:

    mkdir -p ~/.local/share/gtksourceview-2.0/language-specs/

(2) Copy this file to the new directory:

    cp bacon.lang ~/.local/share/gtksourceview-2.0/language-specs/


Now start gedit, Anjuta, Scribes etc and the BaCon sourcecode has
   syntax highlighting!
-->

<language id="bacon" _name="BaCon" version="2.0" _section="Sources">

<metadata>
    <property name="mimetypes">text/x-bac</property>
    <property name="globs">*.bac</property>
    <property name="line-comment-start">'</property>
</metadata>

<styles>
    <style id="comment"             _name="Comment"             map-to="def:comment"/>
    <style id="shebang"             _name="Shebang"             map-to="def:shebang"/>
    <style id="function"            _name="Function"            map-to="def:function"/>
    <style id="string"              _name="String"              map-to="def:string"/>
    <style id="keyword"             _name="Keyword"             map-to="def:keyword"/>
    <style id="special-constant"    _name="Special constant"	map-to="def:special-constant"/>
    <style id="boolean"		    _name="Boolean value"	map-to="def:boolean"/>
    <style id="type"		    _name="Data Type"		map-to="def:type"/>
    <style id="operator"	    _name="Operator"		map-to="def:operator"/>
    <style id="wrapperfunc"	    _name="Wrapper"		map-to="def:preprocessor"/>
</styles>

<definitions>

    <context id="line-comment" style-ref="comment" end-at-line-end="true">
	<start>'</start>
	    <include>
		<context ref="def:in-line-comment"/>
	    </include>
    </context>

    <context id="old-style-comment" style-ref="comment" end-at-line-end="true">
	<start>REM</start>
	    <include>
		<context ref="def:in-line-comment"/>
	    </include>
    </context>

    <context id="string" style-ref="string">
      <start>"</start>
      <end>"</end>
      <include>
        <!-- highlight escaped chars -->
        <context style-ref="def:special-char">
            <match>\\[$`"\\]</match>
        </context>
        <!-- skip backslash where it's not an escaping char -->
        <context>
            <match>\\</match>
        </context>
        <context ref="def:line-continue"/>
      </include>
    </context>

    <context id="function" style-ref="function">
	<keyword>ABS</keyword>
	<keyword>ADDRESS</keyword>
	<keyword>AND</keyword>
	<keyword>ASC</keyword>
	<keyword>ATN</keyword>
	<keyword>COLUMNS</keyword>
	<keyword>COS</keyword>
	<keyword>DAY</keyword>
	<keyword>DEC</keyword>
	<keyword>ENDFILE</keyword>
	<keyword>EQUAL</keyword>
	<keyword>ERROR</keyword>
	<keyword>EVEN</keyword>
	<keyword>EXP</keyword>
	<keyword>FILEEXISTS</keyword>
	<keyword>FILELEN</keyword>
	<keyword>FILETYPE</keyword>
	<keyword>FLOOR</keyword>
	<keyword>GETKEY</keyword>
	<keyword>GETX</keyword>
	<keyword>GETY</keyword>
	<keyword>HOUR</keyword>
	<keyword>INSTR</keyword>
	<keyword>INSTRREV</keyword>
	<keyword>INT</keyword>
	<keyword>ISFALSE</keyword>
	<keyword>ISTRUE</keyword>
	<keyword>LEN</keyword>
	<keyword>LOG</keyword>
	<keyword>MEMORY</keyword>
	<keyword>MEMTELL</keyword>
	<keyword>MINUTE</keyword>
	<keyword>MOD</keyword>
	<keyword>MONTH</keyword>
	<keyword>NOT</keyword>
	<keyword>NOW</keyword>
	<keyword>ODD</keyword>
	<keyword>OR</keyword>
	<keyword>PEEK</keyword>
	<keyword>POW</keyword>
	<keyword>RANDOM</keyword>
	<keyword>REGEX</keyword>
	<keyword>RETVAL</keyword>
	<keyword>RND</keyword>
	<keyword>ROUND</keyword>
	<keyword>ROWS</keyword>
	<keyword>SEARCH</keyword>
	<keyword>SECOND</keyword>
	<keyword>SGN</keyword>
	<keyword>SIN</keyword>
	<keyword>SIZEOF</keyword>
	<keyword>SQR</keyword>
	<keyword>TAN</keyword>
	<keyword>TELL</keyword>
	<keyword>TIMEVALUE</keyword>
	<keyword>VAL</keyword>
	<keyword>WAIT</keyword>
	<keyword>WEEK</keyword>
	<keyword>YEAR</keyword>
    </context>

    <context id="keywords" style-ref="keyword">
	<keyword>ALARM</keyword>
	<keyword>ALIAS</keyword>
	<keyword>APPENDING</keyword>
	<keyword>AS</keyword>
	<keyword>ASSOC</keyword>
	<keyword>BASE</keyword>
	<keyword>BG</keyword>
	<keyword>BLACK</keyword>
	<keyword>BLUE</keyword>
	<keyword>BREAK</keyword>
	<keyword>BY</keyword>
	<keyword>CALL</keyword>
	<keyword>CASE</keyword>
	<keyword>CATCH</keyword>
	<keyword>CHANGEDIR</keyword>
	<keyword>CHUNK</keyword>
	<keyword>CLEAR</keyword>
	<keyword>CLOSE</keyword>
	<keyword>COLLAPSE</keyword>
	<keyword>COLOR</keyword>
	<keyword>CONST</keyword>
	<keyword>COMPARE</keyword>
	<keyword>CONTINUE</keyword>
	<keyword>COPY</keyword>
	<keyword>CURRENT</keyword>
	<keyword>CURSOR</keyword>
	<keyword>CYAN</keyword>
	<keyword>DATA</keyword>
	<keyword>DECLARE</keyword>
	<keyword>DECR</keyword>
	<keyword>DEFAULT</keyword>
	<keyword>DEF</keyword>
	<keyword>DELETE</keyword>
	<keyword>DIRECTORY</keyword>
	<keyword>DO</keyword>
	<keyword>DOWN</keyword>
	<keyword>ELIF</keyword>
	<keyword>ELSE</keyword>
	<keyword>ENDFUNCTION</keyword>
	<keyword>ENDIF</keyword>
	<keyword>END</keyword>
	<keyword>ENDSELECT</keyword>
	<keyword>ENDSUB</keyword>
	<keyword>ENDUSEC</keyword>
	<keyword>ENDWITH</keyword>
	<keyword>EQ</keyword>
	<keyword>FG</keyword>
	<keyword>FILE</keyword>
	<keyword>FN</keyword>
	<keyword>FOR</keyword>
	<keyword>FORMAT</keyword>
	<keyword>FREE</keyword>
	<keyword>FROM</keyword>
	<keyword>FUNCTION</keyword>
	<keyword>GETBYTE</keyword>
	<keyword>GETFILE</keyword>
	<keyword>GETLINE</keyword>
	<keyword>GLOBAL</keyword>
	<keyword>GOTO</keyword>
	<keyword>GOTOXY</keyword>
	<keyword>GREEN</keyword>
	<keyword>IF</keyword>
	<keyword>IMPORT</keyword>
	<keyword>INCLUDE</keyword>
	<keyword>INCR</keyword>
	<keyword>INPUT</keyword>
	<keyword>INTENSE</keyword>
	<keyword>INTERNATIONAL</keyword>
	<keyword>IS</keyword>
	<keyword>ISNOT</keyword>
	<keyword>LABEL</keyword>
	<keyword>LET</keyword>
	<keyword>LOCAL</keyword>
	<keyword>LOOKUP</keyword>
	<keyword>MAGENTA</keyword>
	<keyword>MAKEDIR</keyword>
	<keyword>MEMREWIND</keyword>
	<keyword>MEMSTREAM</keyword>
	<keyword>MEMTYPE</keyword>
	<keyword>NE</keyword>
	<keyword>NETWORK</keyword>
	<keyword>NEXT</keyword>
	<keyword>NORMAL</keyword>
	<keyword>OFF</keyword>
	<keyword>OFFSET</keyword>
	<keyword>ON</keyword>
	<keyword>OPEN</keyword>
	<keyword>OPTION</keyword>
	<keyword>POKE</keyword>
	<keyword>PRINT</keyword>
	<keyword>PROTO</keyword>
	<keyword>PULL</keyword>
	<keyword>PUSH</keyword>
	<keyword>PUTBYTE</keyword>
	<keyword>PUTLINE</keyword>
	<keyword>READING</keyword>
	<keyword>READ</keyword>
	<keyword>READLN</keyword>
	<keyword>READWRITE</keyword>
	<keyword>RECEIVE</keyword>
	<keyword>RECORD</keyword>
	<keyword>RED</keyword>
	<keyword>RELATE</keyword>
	<keyword>RENAME</keyword>
	<keyword>REPEAT</keyword>
	<keyword>RESET</keyword>
	<keyword>RESIZE</keyword>
	<keyword>RESTORE</keyword>
	<keyword>RESUME</keyword>
	<keyword>RETURN</keyword>
	<keyword>REWIND</keyword>
	<keyword>SEED</keyword>
	<keyword>SEEK</keyword>
	<keyword>SELECT</keyword>
	<keyword>SEND</keyword>
	<keyword>SERVER</keyword>
	<keyword>SETENVIRON</keyword>
	<keyword>SIZE</keyword>
	<keyword>SLEEP</keyword>
	<keyword>SOCKET</keyword>
	<keyword>SORT</keyword>
	<keyword>SPLIT</keyword>
	<keyword>START</keyword>
	<keyword>STEP</keyword>
	<keyword>STOP</keyword>
	<keyword>SUB</keyword>
	<keyword>SYSTEM</keyword>
	<keyword>TEXTDOMAIN</keyword>
	<keyword>THEN</keyword>
	<keyword>TO</keyword>
	<keyword>TRACE</keyword>
	<keyword>TRAP</keyword>
	<keyword>TYPE</keyword>
	<keyword>UNTIL</keyword>
	<keyword>USEC</keyword>
	<keyword>VAR</keyword>
	<keyword>WEND</keyword>
	<keyword>WHENCE</keyword>
	<keyword>WHILE</keyword>
	<keyword>WHITE</keyword>
	<keyword>WITH</keyword>
	<keyword>WRITELN</keyword>
	<keyword>WRITING</keyword>
	<keyword>YELLOW</keyword>
    </context>

    <context id="strfunction" style-ref="function">
	<match extended="true">
	    \bARGUMENT\$|\bCHOP\$|\bCHR\$|\bCONCAT\$|\bCURDIR\$|\bERR\$|\bEXEC\$|\bFILL\$|\bGETENVIRON\$|\bHEX\$|\bHOST\$|\bINTL\$|\bLCASE\$|\bLEFT\$|\bMID\$|\bMONTH\$|\bNNTL\$|\bOS\$|\bREPLACE\$|\bREVERSE\$|\bRIGHT\$|\bSPC\$|\bSTR\$|\bTAB\$|\bUCASE\$|\bWEEKDAY\$
	</match>
    </context>

    <context id="types" style-ref="type">
	<keyword>NUMBER</keyword>
	<keyword>STRING</keyword>
	<keyword>FLOATING</keyword>
	<keyword>FILE\*</keyword>
	<keyword>int</keyword>
	<keyword>double</keyword>
	<keyword>float</keyword>
	<keyword>long</keyword>
	<keyword>char</keyword>
	<keyword>short</keyword>
	<keyword>void</keyword>
	<keyword>signed</keyword>
	<keyword>unsigned</keyword>
	<keyword>static</keyword>
    </context>

    <context id="special-constants" style-ref="special-constant">
	<match extended="true">
	    \bMAXRANDOM|\bNL\$|\bPI|\bVERSION\$
	</match>
    </context>

    <context id="boolean" style-ref="boolean">
	<keyword>FALSE</keyword>
	<keyword>TRUE</keyword>
    </context>

    <context id="operators" style-ref="operator" extend-parent="false">
      <match>[-%\+/\*\=|&amp;&lt;&gt;()]</match>
    </context>

    <context id="wrapper" style-ref="wrapperfunc">
	<keyword>INIT</keyword>
	<keyword>HUGOPTIONS</keyword>
	<keyword>PROPERTY</keyword>
	<keyword>QUIT</keyword>
	<keyword>DRAW</keyword>
	<keyword>HIDE</keyword>
	<keyword>SHOW</keyword>
	<keyword>WINDOW</keyword>
	<keyword>DISPLAY</keyword>
	<keyword>TEXT</keyword>
	<keyword>GET</keyword>
	<keyword>SET</keyword>
	<keyword>NOTEBOOK</keyword>
	<keyword>BUTTON</keyword>
	<keyword>STOCK</keyword>
	<keyword>TOGGLE</keyword>
	<keyword>CHECK</keyword>
	<keyword>RADIO</keyword>
	<keyword>ENTRY</keyword>
	<keyword>PASSWORD</keyword>
	<keyword>MARK</keyword>
	<keyword>COMBO</keyword>
	<keyword>HSEPARATOR</keyword>
	<keyword>VSEPARATOR</keyword>
	<keyword>FRAME</keyword>
	<keyword>EDIT</keyword>
	<keyword>LIST</keyword>
	<keyword>MSGDIALOG</keyword>
	<keyword>FILEDIALOG</keyword>
	<keyword>SPIN</keyword>
	<keyword>IMAGE</keyword>
	<keyword>CANVAS</keyword>
	<keyword>CLIPBOARD</keyword>
	<keyword>PROGRESSBAR</keyword>
	<keyword>CALLBACK</keyword>
	<keyword>CALLBACKX</keyword>
	<keyword>MOUSE</keyword>
	<keyword>CIRCLE</keyword>
	<keyword>PIXEL</keyword>
	<keyword>LINE</keyword>
	<keyword>SQUARE</keyword>
	<keyword>OUT</keyword>
	<keyword>PICTURE</keyword>
	<keyword>ATTACH</keyword>
	<keyword>TIMEOUT</keyword>
	<keyword>FONT</keyword>
	<keyword>DISABLE</keyword>
	<keyword>ENABLE</keyword>
	<keyword>FOCUS</keyword>
	<keyword>UNFOCUS</keyword>
	<keyword>SCREENSIZE</keyword>
	<keyword>KEY</keyword>
	<keyword>SYNC</keyword>
	<keyword>INIT</keyword>
	<keyword>ISPRIME</keyword>
	<keyword>PRECISION</keyword>
	<keyword>FCOMPARE</keyword>
    </context>

    <context id="wrapperstr" style-ref="wrapperfunc">
	<match extended="true">
	    \bGRAB\$|ADD\$|SUBSTRACT\$|MULTIPLY\$|DIVIDE\$|MODULO\$|POWER\$|SQUARE\$|ROOT\$|FADD\$|FSUBSTRACT\$|FMULTIPLY\$|FDIVIDE\$|FPOWER\$|FIBONACCI\$|FACTORIAL\$|NEXTPRIME\$|FSQUARE\$
	</match>
    </context>

    <context id="bacon">
	<include>
	    <context ref="def:shebang" style-ref="shebang"/>
	    <context ref="line-comment"/>
	    <context ref="old-style-comment"/>
	    <context ref="string"/>
	    <context ref="strfunction"/>
	    <context ref="function"/>
	    <context ref="keywords"/>
	    <context ref="special-constants"/>
	    <context ref="types"/>
	    <context ref="boolean"/>
	    <context ref="operators"/>
	    <context ref="wrapper"/>
	    <context ref="wrapperstr"/>
	</include>
    </context>

</definitions>

</language>
