#################################################################################
#                                                                               #
#                       A d i e   S y n t a x   F i l e                         #
#                                                                               #
#################################################################################
# Copyright (C) 2004 by Jeroen van der Zijp.   All Rights Reserved.             #
#################################################################################
# This program is free software; you can redistribute it and/or modify          #
# it under the terms of the GNU General Public License as published by          #
# the Free Software Foundation; either version 2 of the License, or             #
# (at your option) any later version.                                           #
#                                                                               #
# This program 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 General Public License for more details.                                  #
#                                                                               #
# You should have received a copy of the GNU General Public License             #
# along with this program; if not, write to the Free Software                   #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    #
#################################################################################
# $Id: Adie.stx,v 1.27.2.3 2005/09/06 03:46:25 fox Exp $                            #
#################################################################################

#
# Notes:
#
# - Please send addition changes or additions to this file to:
#
#       jeroen@fox-toolkit.org
#
# - Use bracketed patterns with sub-patterns instead of complex
#   regular expressions; complex regular expressions can recurse
#   deeply, which can be very expensive.
#
# - Rule name is used as registry key; should be unique if
#   different colors are desired!
#
# - A backslash "\" escapes only if followed by '"'; otherwise its
#   just a backslash.
#


#################################################################################

# LaTeX text formatting language
language "LaTeX"
  filesmatch "*.tex"
  delimiters "~.,/\`'!@#$%^&*()_-=+{}|[]\":;<>?"

  rule "Math"
       openpattern "\$|\\\[|\\\(|\\begin(?=(\{(equation|align)\*?\}))"
       closepattern "\$|\\\]|\\\)|\\end(?=(\{(equation|align)\*?\}))"

       rule "Comment"
           openpattern   "%"
           closepattern  "$"
	   stoppattern   "$"
       end
       rule "CurlyBrace"
            pattern "\{|\}"
       end
       rule "MathCommand"
       	    openpattern  "\\(?!([^a-zA-Z]|end\{(equation|align)\*?\}))"
       	    closepattern "(?=[^a-zA-Z])|$"
	    stoppattern  "(?=\$)|\\((?=\])|(?=\))|(?=end\{(equation|align)\}))"
  	    rule "Comment"
      	        openpattern   "%"
      	        closepattern  "$"
		stoppattern   "$"
  	    end
       	    rule "MathGreek"
            	 pattern "\<([aA]lpha|[bB]eta|[gG]amma|[eE]psilon|[dD]elta|[eE]ta|[iI]ota|[kK]appa|[lL]ambda|[mM]u|[nN]u|[pP]i|[rR]ho|[sS]igma|[tT]au|[pP]hi|[pP]si|[xX]i|[uU]psilon|[zZ]eta|[tT]heta|[oO]mega)(\>|(?=_))"
       	    end
       end
  end

  rule "Command"
       openpattern  "\\{1}(?!\\)"
       closepattern "(?=[^a-zA-Z])|$"
       stoppattern  "\{|\}| |$"
       rule "TextFormating"
            pattern "\<(textbf|texttt|textsl|textit|emph)\>"
       end
       rule "Sectioning"
       	    pattern "\<(section|subsection|subsubsection|paragraph|chapter)\>"
       end
       rule "Referance"
       	    pattern "\<(cite|ref|label)\>"
       end
       rule "Includes"
       	    pattern "\<(usepackage|include|input|includegraphics)\>"
       end
       rule "Footnote"
       	    pattern "\<(footnote)\>"
       end

       rule "Comment"
           openpattern   "%"
           closepattern  "$"
	   stoppattern   "$"
       end

       rule "Breaks"
           pattern "\<(clearpage|newpage)\>"
       end
  end

  rule "CurlyBrace"
       pattern "\{|\}"
  end

  rule "Comment"
      openpattern   "%"
      closepattern  "$"
      stoppattern   "$"
  end

  rule "Breaks"
       pattern "\\{2}"
  end
end

# A Syntax coloring pattern for syntax coloring patterns ;-)
language "Adie Syntax"
  filesmatch "*.stx"
  rule "Comment"
    openpattern   "#"
    closepattern  "$"
  end
  rule "Keyword"
    pattern     "\<(language|filesmatch|contentsmatch|delimiters|contextlines|contextchars|rule|foreground|end)\>"
  end
  rule "Expression"
    openpattern    "pattern|openpattern|closepattern|stoppattern"
    closepattern   "$"
    rule "Pattern"
      openpattern   "\""
      closepattern  "\""
      stoppattern   "$"
      rule "Escape"
        pattern     "\\\""
      end
    end
  end
  rule "String"
    openpattern   "\""
    closepattern  "\""
    stoppattern   "$"
    rule "Escape"
      pattern     "\\\""
    end
  end
end


# C++ programming language
language "C++"

  # File patterns for this language mode
  filesmatch "*.C,*.cpp,*.cc,*.cxx,*.c++,*.H,*.hpp,*.hh,*.hxx,*.h++,*.h"
  contentsmatch "[Cc]\+\+"

  # Word delimiters
  delimiters "~.,/\`'!@#$%^&*()-=+{}|[]\":;<>?"

  # C++ style comment
  rule "CPPDocComment"
    openpattern   "/// "
    closepattern  "$"
  end


  # C++ style comment
  rule "CPPComment"
    openpattern   "//"
    closepattern  "$"
    rule "FIXME"
      pattern     "FIXME"
    end
  end

  # C style comment
  rule "CDocComment"
    openpattern   "/\*\*[ \n]"
    closepattern  "\*/"
  end

  # C style comment
  rule "CComment"
    openpattern   "/\*"
    closepattern  "\*/"
    rule "FIXME"
      pattern     "FIXME"
    end
  end

  # PP blocked
  rule "PPBlocked"
    openpattern   "^#if 0"
    closepattern  "^#endif"
    rule "PPSubblock"
      openpattern   "^#if"
      closepattern  "^#endif$"
      rule "PPSubblock"
        openpattern   "^#if"
        closepattern  "^#endif$"
        rule "PPSubblock"
          openpattern   "^#if"
          closepattern  "^#endif$"
        end
      end
    end
    rule "PPSubblock"
      openpattern   "/\*"
      closepattern  "\*/"
    end
  end

  # String
  rule "String"
    openpattern   "\""
    closepattern  "\""
    stoppattern   "$"
    rule "OctalEscape"
      pattern     "\\\d+"
    end
    rule "HexEscape"
      pattern     "\\x\h+"
    end
    rule "ControlEscape"
      pattern     "\\."
    end
    rule "Format"
      pattern "%[\*ahlLq#0 +-]?\d*(\.(\*|\d*))?l?([dDiouxXeEfFgGaAcsp]|\[.*?\])"
    end
  end


  # Char constant
  rule "Char"
    openpattern  "'"
    closepattern "'"
    rule "OctalEscape"
      pattern "\\\d+"
    end
    rule "HexEscape"
      pattern     "\\x\h+"
    end
    rule "ControlEscape"
      pattern "\\."
    end
  end

  # Preprocessor
  rule "Preprocessor"
    openpattern  "^\s*#"
    closepattern "$"
    rule "PreprocessorContinuation"
      pattern "\\\n"
    end
  end

  # Special macros
  rule "FOXMacro"
    pattern     "\<(FXAPI|FXDEFMAP|FXMALLOC|FXFREE|FXCALLOC|FXRESIZE|FXMEMDUP|FXTRACE|FXMAPFUNCS|FXMAPFUNC|FXIMPLEMENT|FXIMPLEMENT_ABSTRACT|FXDECLARE|FXDECLARE_ABSTRACT|FXMAPTYPES|FXMAPTYPE|FXMETACLASS|FXRGBA|FXRGB|FXREDVAL|FXGREENVAL|FXBLUEVAL|FXALPHAVAL|FXASSERT|FXSELID|FXSELTYPE|FXSEL|FXMINMAX|FXMIN3|FXMIN4|FXMIN|FXMAX3|FXMAX4|FXMAX|FXSWAP|FXCLAMP|FXABS|FXLERP|ARRAYNUMBER|STRUCTOFFSET|CONTAINER)\>"
  end

  rule "FOXType"
    pattern     "\<(FXchar|FXuchar|FXbool|FXushort|FXshort|FXuint|FXwchar|FXnchar|FXint|FXfloat|FXdouble|FXulong|FXlong|FXival|FXuval|FXColor|FXObject|FXString|FXWString)\>"
  end

  rule "Keyword"
    pattern     "\<(friend|typename|explicit|typeid|for|while|if|else|try|catch|new|delete|do|namespace|class|struct|enum|union|public|private|protected|template|switch|case|default|this|return|throw|using|break|continue|goto|static|volatile|const|virtual|mutable|operator|auto|register|overload|inline|extern|and|or|xor|not|compl|and_eq|xor_eq|const_cast|dynamic_cast|true|false|not_eq|sizeof|bitor|bitand|reinterpret_cast|static_cast)\>"
  end

  rule "Number"
    pattern     "\<((0[xX][0-9a-fA-F]+)|((\d+\.?\d*)|(\.\d+))([eE](\+|-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\>"
  end

  rule "Type"
    pattern     "\<(unsigned|signed|int|char|short|long|float|double|bool|complex|void|wchar_t)\>"
  end

  rule "Operator"
    pattern     "(\{|\}|\+\+|\+=|\+|--|-=|->\*|->|-|==|=|&&|&=|&|\|\||\|=|\||\^=|\^|<<=|<<|<=|<|>>=|>>|>=|>|!=|!|~=|~|\*=|\*|/=|/|%=|%)"
  end

end

# C programming language
language "C"

  # File patterns for this language mode
  filesmatch "*.c,*.h"

  # Word delimiters
  delimiters "~.,/\`'!@#$%^&*()-=+{}|[]\":;<>?"

  # C style comment
  rule "CDocComment"
    openpattern   "/\*\*[ \n]"
    closepattern  "\*/"
  end

  # C style comment
  rule "CComment"
    openpattern   "/\*"
    closepattern  "\*/"
    rule "FIXME"
      pattern     "FIXME"
    end
  end

  # C++ style comment
  rule "CPPComment"
    openpattern   "//"
    closepattern  "$"
  end

  # String
  rule "String"
    openpattern   "\""
    closepattern  "\""
    stoppattern   "$"
    rule "OctalEscape"
      pattern     "\\\d+"
    end
    rule "HexEscape"
      pattern     "\\x\h+"
    end
    rule "ControlEscape"
      pattern     "\\."
    end
    rule "Format"
      pattern "%[\*ahlLq#0 +-]?\d*(\.(\*|\d*))?l?([dDiouxXeEfFgGaAcsp]|\[.*?\])"
    end
  end


  # Char constant
  rule "Char"
    openpattern  "'"
    closepattern "'"
    rule "OctalEscape"
      pattern "\\\d+"
    end
    rule "HexEscape"
      pattern     "\\x\h+"
    end
    rule "ControlEscape"
      pattern "\\."
    end
  end

  # Preprocessor
  rule "Preprocessor"
    openpattern  "^\s*#"
    closepattern "$"
    rule "PreprocessorContinuation"
      pattern "\\\n"
    end
  end

  rule "Keyword"
    pattern     "\<(for|while|if|else|do|struct|enum|union|switch|case|default|return|break|continue|goto|static|volatile|const|auto|register|inline|extern)\>"
  end

  rule "Number"
    pattern     "\<((0[xX][0-9a-fA-F]+)|((\d+\.?\d*)|(\.\d+))([eE](\+|-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\>"
  end

  rule "Type"
    pattern     "\<(unsigned|signed|int|char|short|long|float|double|bool|complex|void|wchar_t)\>"
  end

  rule "Operator"
    pattern     "(\+\+|\+=|\+|--|-=|->\*|->|-|==|=|&&|&=|&|\|\||\|=|\||\^=|\^|<<=|<<|<=|<|>>=|>>|>=|>|!=|!|~=|~|\*=|\*|/=|/|%=|%)"
  end

end

language "Shell"
  contentsmatch "#!\s*/bin/(ba)?sh"
  rule "Comment"
    pattern    "#.*?$"
  end
  rule "Keyword"
    pattern     "\<(for|in|do|done|if|then|else|elif|fi|switch|case|esac|while|function|select|until|time)\>"
  end
  rule "Operator"
    pattern     "(=|;;|;|!|\{|\}|\[\[|\]\])"
  end
end

language "Pascal"
  filesmatch "*.pas,*.p"
  rule "Number"
    pattern     "\<((0[xX][0-9a-fA-F]+)|((\d+\.?\d*)|(\.\d+))([eE](\+|-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\>"
  end
  rule "String"
    pattern    "\'[^']*?\'"
  end
  rule "Type"
    pattern    "\<(?iInteger|Shortint|SmallInt|Longint|Int64|Byte|Word|Cardinal|QWord|Boolean|ByteBool|LongBool|Char)\>"
  end
  rule "Comment"
    pattern    "\(\*.*?\*\)|\{.*?\}"
  end
  rule "Operator"
    pattern     "(:=|:|@|\\+=|\\+|-=|-|=|\\^|<=|<|>=|>|\\*=|\\*|/=|/|\\.)"
  end
  rule "Keyword"
    pattern     "\<(?iabsolute|and|array|asm|begin|break|case|const|constructor|continue|destructor|div|do|downto|else|end|file|for|function|goto|if|implementation|in|inherited|inline|interface|label|mod|nil|not|object|of|on|operator|or|packed|procedure|program|record|repeat|self|set|shl|shr|string|then|to|type|unit|until|uses|var|while|with|xor)\>"
  end
end


language "Configure"
  filesmatch "configure.in,configure.ac"
  rule "Comment"
    pattern    "\<dnl\>.*?$"
  end
  rule "Comment"
    pattern    "#.*?$"
  end
  rule "String"
    openpattern  "'"
    closepattern "'"
    rule "ControlEscape"
      pattern     "\\."
    end
  end
  rule "String"
    openpattern  "\""
    closepattern "\""
    rule "ControlEscape"
      pattern     "\\."
    end
  end
  rule "Macro"
    pattern    "\<A[CM]\w*\>"
  end
  rule "ShellResult"
    openpattern  "`"
    closepattern "`"
    rule "ControlEscape"
      pattern     "\\."
    end
  end
end


language "Python"
  filesmatch "*.py"
  rule "Number"
    pattern     "\<((0[xX][0-9a-fA-F]+)|((\d+\.?\d*)|(\.\d+))([eE](\+|-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\>"
  end
  rule "String"
    pattern    "(\".*\")|('.*')"
  end
  rule "Comment"
    pattern    "#.*$"
  end
  rule "Operator"
    pattern     "\+\+|\+=|\+|--|-=|-|==|=|&&|&=|&|=|^=|^|<<=|<<|<=|<|>>=|>>|>=|>|!=|!=|!|~=|~|\*=|\*|/=|/|%=|%"
  end
  rule "Keyword"
    pattern     "\<(def|import|for|in|while|if|elif|else|try|class|return|break|continue|raise|and|or|not|print|pass|access|global|from|except|exec|is|finally|lambda)\>"
  end
end

language "Ruby"
  filesmatch "*.rb"
  rule "Number"
    pattern     "\<((0[xX][0-9a-fA-F]+)|((\d+\.?\d*)|(\.\d+))([eE](\+|-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\>"
  end
  rule "SingleString"
    openpattern   "'"
    closepattern  "'"
    rule "CharEscape"
      pattern     "\\."
    end
  end
  rule "DoubleString"
    openpattern   "\""
    closepattern  "\""
    rule "CharEscape"
      pattern     "\\."
    end
  end
  rule "Comment"
    pattern    "#.*?$"
  end
  rule "Operator"
    pattern     "\+=|\+|-=|-|===|==|=|&&|&=|&|\|\||\|=|\||^=|^|<<=|<<|<=|<|>>=|>>|>=|>|!=|!|~=|~|\*=|\*|/=|/|%=|%|"
  end
  rule "Keyword"
    pattern     "\<(alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>"
  end
end

language "Xml/Html"
  filesmatch "*.xml,*.htm,*.html,*.ui"
  rule "Comment"
    openpattern   "<!--"
    closepattern  "-->"
  end

  rule "Entity"
    openpattern   "\&"
    closepattern  ";"
  end

  rule "Instruction"
    openpattern   "<\?"
    closepattern  "\?>"
    rule "String"
      openpattern   "\""
      closepattern  "\""
      rule "Entity"
        openpattern   "\&"
        closepattern  ";"
        stoppattern   "(?=\")"
      end
    end
    rule "String"
      openpattern   "\'"
      closepattern  "\'"
      rule "Entity"
        openpattern   "\&"
        closepattern  ";"
        stoppattern   "(?=\")"
      end
    end
  end

  rule "Node"
    openpattern   "<"
    closepattern  ">"
    rule "String"
      openpattern   "\""
      closepattern  "\""
      rule "Entity"
        openpattern   "\&"
        closepattern  ";"
        stoppattern   "(?=\")"
      end
    end
    rule "String"
      openpattern   "\'"
      closepattern  "\'"
      rule "Entity"
        openpattern   "\&"
        closepattern  ";"
        stoppattern   "(?=\")"
      end
    end
  end
end

# IDL interface definition language
language "IDL"

  # File patterns for this language mode
  filesmatch "*.idl"

  # Word delimiters
  delimiters "~.,/\`'!@#$%^&*()-=+{}|[]\":;<>?"

  # // style comment
  rule "CPPComment"
    openpattern   "//"
    closepattern  "$"
    rule "FIXME"
      pattern     "FIXME"
    end
  end

  # /* */ style comment
  rule "CComment"
    openpattern   "/\*"
    closepattern  "\*/"
    rule "FIXME"
      pattern     "FIXME"
    end
  end

  # String
  rule "String"
    openpattern   "\""
    closepattern  "\""
    stoppattern   "$"
    rule "OctalEscape"
      pattern     "\\\d+"
    end
    rule "HexEscape"
      pattern     "\\x\h+"
    end
    rule "ControlEscape"
      pattern     "\\."
    end
    rule "Format"
      pattern "%[\*hlLq#0 +-]?\d*(\.(\*|\d*))?l?[diouxXeEfFgGaAcsp]"
    end
  end


  # Char constant
  rule "Char"
    openpattern  "'"
    closepattern "'"
    rule "OctalEscape"
      pattern "\\\d+"
    end
    rule "HexEscape"
      pattern     "\\x\h+"
    end
    rule "ControlEscape"
      pattern "\\."
    end
  end

  # Preprocessor
  rule "Preprocessor"
    openpattern  "^\s*#"
    closepattern "$"
    rule "PreprocessorContinuation"
      pattern "\\\n"
    end
  end

  rule "Keyword"
    pattern     "\<(attribute|component|comsumes|context|custom|exception|emits|eventtype|factory|finder|fixed|getraises|home|import|interface|local|module|multiple|native|oneway|primarykey|private|provides|public|publishes|raises|readonly|setraises|supports|truncatable|typedef|typeid|typeprefix|uses|ValueBase|valuetype)\>"
  end

  rule "Direction"
    pattern     "\<(in|inout|out)\>"
  end

  rule "Number"
    pattern     "\<((0[xX][0-9a-fA-F]+)|((\d+\.?\d*)|(\.\d+))([eE](\+|-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\>"
  end

  rule "Type"
    pattern     "\<(unsigned|signed|int|char|octet|any|wchar|short|long|hyper|float|double|boolean|complex|void|struct|union|enum|switch|case|default|sequence|string|wstring|Object)\>"
  end

  rule "Operator"
    pattern     "(\{|\}|\+\+|\+=|\+|--|-=|->\*|->|-|==|=|&&|&=|&|\|\||\|=|\||\^=|\^|<<=|<<|<=|<|>>=|>>|>=|>|!=|!|~=|~|\*=|\*|/=|/|%=|%)"
  end
end

# C# programming language
language "C#"

  # File patterns for this language mode
  filesmatch "*.cs"

  # Word delimiters
  delimiters "~.,/\`'!@#$%^&*()-=+{}|[]\":;<>?"

  # Line comment
  rule "LineComment"
    openpattern   "//"
    closepattern  "$"
  end

  # Multiline comment
  rule "MultiLineComment"
    openpattern   "/\*"
    closepattern  "\*/"
  end

  # String
  rule "String"
    openpattern   "\""
    closepattern  "\""
    stoppattern   "$"
    rule "OctalEscape"
      pattern     "\\\d+"
    end
    rule "HexEscape"
      pattern     "\\x\h+"
    end
    rule "ControlEscape"
      pattern     "\\."
    end
  end


  # Char constant
  rule "Char"
    openpattern  "'"
    closepattern "'"
    rule "OctalEscape"
      pattern "\\\d+"
    end
    rule "HexEscape"
      pattern     "\\x\h+"
    end
    rule "ControlEscape"
      pattern "\\."
    end
  end

  # Preprocessor
  rule "Preprocessor"
    openpattern  "^\s*#"
    closepattern "$"
    rule "PreprocessorContinuation"
      pattern "\\\n"
    end
  end

  rule "Keyword"
    pattern     "\<(abstract|base|break|case|catch|checked|class|const|continue|default|delegate|do|else|enum|event|explicit|extern|false|finally|fixed|for|foreach|goto|if|implicit|in|interface|internal|lock|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sealed|sizeof|stackalloc|static|struct|switch|this|throw|true|try|typeof|unchecked|unsafe|using|virtual|while|is|as)\>"
  end

  rule "Number"
    pattern     "\<((0[xX][0-9a-fA-F]+)|((\d+\.?\d*)|(\.\d+))([eE](\+|-)?\d+)?)(U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu|F|f|D|d|M|m)?\>"
  end

  rule "Type"
    pattern     "\<(bool|byte|double|float|int|sbyte|short|void|ushort|long|uint|ulong|char|string|decimal)\>"
  end

  rule "Operator"
    pattern     "(\{|\}|\+\+|\+=|\+|--|-=|->\*|->|-|==|=|&&|&=|&|\|\||\|=|\||\^=|\^|<<=|<<|<=|<|>>=|>>|>=|>|!=|!|~=|~|\*=|\*|/=|/|%=|%)"
  end

end


# HTLM/PHP Markup patterns
# Contributed by: Andy Preston <mail@andy-preston.co.uk>
language "Markup"
    filesmatch "*.html,*.xhtml,*.xml,*.sgml,*.php"
    rule "PHP"
       openpattern "<\?php"
       closepattern "\?>"
       rule "String"
           openpattern   "\""
           closepattern  "\""
           rule "ControlEscape"
              pattern     "\\."
           end
           rule "Variable"
             pattern "\$[A-Za-z_][0-9A-Za-z_]*"
           end
       end
       rule "SString"
           openpattern   "'"
           closepattern  "'"
           rule "SQuote"
              pattern     "''"
           end
       end
       rule "Number"
           pattern "\<((0[xX][0-9a-fA-F]+)|((\d+\.?\d*)|(\.\d+))([eE](\+|-)?\d+)?)\>"
       end
       rule "Variable"
          pattern "\$\$?[A-Za-z_][0-9A-Za-z_]*"
       end
       rule "Comment"
          pattern    "#.*?$"
       end
       rule "CPPComment"
          openpattern   "//"
          closepattern  "$"
       end
       rule "CComment"
          openpattern   "/\*"
          closepattern  "\*/"
       end
       rule "Keyword"
          pattern "\<(and|break|case|class|do|echo|else|elseif|endfor|endwhile|for|function|global|if|include|new|or|print|return|static|switch|while|xor)\>"
       end
       rule "Operator"
          # there's a bit of a kludge here, for the "?" operator, a "?" matches against the "?>" at the end of a block of PHP
          # so I've had to make it \?[^>] which means the character following the "?" is treated as part of the operator
          # If you write this: "$x = $y ? 1 : 2" it looks fine, but if you write "$x=$y?1:2" the "1" is shown as part of the operator
          pattern "(,|=|\+=|-=|\*=|/=|\.=|%=|&=|\|=|\^=|~=|<<=|>>=|:|\?[^>]|\|\||&&|\||\^|&|==|!=|===|!==|<|<=|>|>=|<<|>>|\+|-|\.|\*|/|%|!|~|\+\+|--|\(int\)|\(double\)|\(string\)|\(array\)|\(object\)|@|\[|\])
       end
    end
    rule "Comment"
       openpattern "<!--"
       closepattern "-->"
    end
    rule "Tag"
       openpattern "<"
       closepattern ">"
       rule "Attribute"
          pattern " [A-Za-z_][A-Za-z0-9_-]+"
       end
       rule "Value"
          pattern "=?\"[^\"]*\""
          rule "HexTriplet"
              pattern "#[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]"
          end
       end
    end
    rule "Special"
       openpattern "&"
       closepattern ";"
    end
end

language "Make"
  filesmatch "*Makefile*"
  rule "Comment"
    openpattern  "#"
    closepattern "$"
    rule "CommentContinuation"
      pattern "\\\n"
    end
  end
  rule "Assignment"
    openpattern "^( *| [ \t]*)[A-Za-z0-9_+$()][^ \t\n]*[ \t]*(\+=|:=|=)"
    closepattern "$"
    rule "AssignmentContinuation"
      pattern "\\\n"
    end
    rule "AssignmentComment"
      openpattern "#"
      closepattern "$"
    end
  end
  rule "DependencyLine"
    openpattern "^( *| [ \t]*)(.DEFAULT|.DELETE_ON_ERROR|.EXPORT_ALL_VARIABLES.IGNORE|.INTERMEDIATE|.PHONY|.POSIX|.PRECIOUS|.SECONDARY|.SILENT|.SUFFIXES)*(([A-Za-z0-9./$(){} _@^<*?%+-]*(\\\n)){,8}[A-Za-z0-9./$(){} _@^<*?%+-]*)::?"
    closepattern "$|;"
    rule "DependencyContinuation"
      pattern "\\\n"
    end
  end
  rule "String"
    openpattern   "\""
    closepattern  "\""
    stoppattern   "$"
    rule "OctalEscape"
      pattern     "\\\d+"
    end
    rule "HexEscape"
      pattern     "\\x\h+"
    end
    rule "ControlEscape"
      pattern     "\\."
    end
  end
  rule "String"
    openpattern   "'"
    closepattern  "'"
    stoppattern   "$"
    rule "OctalEscape"
      pattern     "\\\d+"
    end
    rule "HexEscape"
      pattern     "\\x\h+"
    end
    rule "ControlEscape"
      pattern     "\\."
    end
  end
end

language "Perl"
  filesmatch "*.pl"
  rule "Comment"
    openpattern  "#"
    closepattern "$"
  end
  rule "Statement"
    pattern "\<(if|until|while|elsif|else|unless|for(each)?|continue|last|goto|next|redo|do(?=\s*\{)|BEGIN|END)\>"
  end
  rule "Operator"
    pattern     "\<(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|sub|x)\>"
  end
  rule "String"
    openpattern   "\""
    closepattern  "\""
    stoppattern   "$"
    rule "OctalEscape"
      pattern     "\\\d+"
    end
    rule "HexEscape"
      pattern     "\\x\h+"
    end
    rule "ControlEscape"
      pattern     "\\."
    end
  end
  rule "String"
    openpattern   "'"
    closepattern  "'"
    stoppattern   "$"
    rule "OctalEscape"
      pattern     "\\\d+"
    end
    rule "HexEscape"
      pattern     "\\x\h+"
    end
    rule "ControlEscape"
      pattern     "\\."
    end
  end
end

