# JOE syntax highlight file for C and C++ # Improved version by Matti 'ccr' Hämäläinen, based on original from Joe v3.1 # # 2005-01-24 # - Format string handling fixed and improved # - Non-standardly broken preprocessor tokens are highlighted as 'Bad' # - Syntax parsing buffer increased to avoid problems with long comments # - Added some missing C++ keywords # - Added highlighting of GLib base types # Set a fairly long buffer to avoid problems -500 # Define colors # # bold inverse blink dim underline # white cyan magenta blue yellow green red black # bg_white bg_cyan bg_magenta bg_blue bg_yellow bg_green bg_red bg_black =Idle =Bad bold red =Preproc red =Define bold red =Comment green =IncLocal cyan =IncSystem bold cyan =Constant cyan =Escape bold cyan =Conversion bold green =Type bold =Keyword bold =CppKeyword bold =Brace magenta =Control # First character of line, check for preprocessor control lines :reset Idle * first noeat "#" pre recolor=-1 # Seek the first non-whitespace character, also check for # "bad" preprocessor lines -- recent C standards require # that preprocessor define starts from first character of line, # though most compilers accept "malformed" lines too. :first Idle * idle noeat " \t" first "#" prebad # Seems like a preprocessor line... :pre Preproc * preproc noeat " \t" pre "a-z" preident recolor=-1 buffer :preident Preproc * preproc noeat strings "define" predef "include" preinc done "a-z" preident :preinc Preproc * preinc " \t" preinc_ws "\n" reset :preinc_ws Preproc * prebad recolor=-1 " \t" preinc_ws "\"" preinc_local recolor=-1 "<" preinc_system recolor=-1 :preinc_local IncLocal * preinc_local "\"\n" reset :preinc_system IncSystem * preinc_system ">\n" reset :prebad Bad * prebad "\n" reset :predef Preproc * predef " \t" predef_ws "\n" reset :predef_ws Preproc * prebad recolor=-1 " \t" predef_ws "a-zA-Z0-9_" predef_ident recolor=-1 :predef_ident Define * idle noeat "a-zA-Z0-9_" predef_ident :preproc Preproc * preproc "\n" reset "\\" preproc_cont "/" preproc_slash :preproc_slash Preproc * preproc noeat "*" comment recolor=-2 "/" line_comment recolor=-2 :preproc_cont Preproc * preproc_cont "\n" preproc # All following states are for when we're not in a preprocessor line :idle Idle * idle "\n" reset "/" slash "0" first_digit recolor=-1 "1-9" decimal recolor=-1 "." maybe_float "\"" string recolor=-1 "'" char recolor=-1 "a-zA-Z_" ident buffer "{}" brace recolor=-1 ",:;=()><[]*&|!~+\-%^" control recolor=-1 :brace Brace * idle noeat :control Control * idle noeat :slash Idle * idle noeat recolor=-2 # Not sure about this "*" comment recolor=-2 "/" line_comment recolor=-2 :comment Comment * comment "*" maybe_end_comment :maybe_end_comment Comment * comment "/" idle "*" maybe_end_comment :line_comment Comment * line_comment "\n" reset :first_digit Constant * idle noeat "xX" hex "." float "eE" epart "0-7" octal "89" bad_number recolor=-1 :bad_number Bad * idle noeat "0-9" bad_number :octal Constant * idle noeat "0-7" octal "89" bad_number recolor=-1 :hex Constant * idle noeat "0-9A-Fa-f" hex :decimal Constant * idle noeat "0-9" decimal "eE" epart "." float :maybe_float Constant * idle recolor=-2 noeat "0-9" float recolor=-2 :float Constant * idle noeat "eE" epart "0-9" float :epart Constant * idle noeat "0-9+\-" enum :enum Constant * idle noeat "0-9" enum :string Constant * string "\"" idle "\\" string_escape recolor=-1 :string_escape Escape * string "x" string_hex1 "0-7" string_octal2 "\n" string recolor=-2 :string_hex1 Escape * string noeat "0-9a-fA-F" string_hex2 :string_hex2 Escape * string noeat "0-9a-fA-F" string :string_octal2 Escape * string noeat "0-7" string_octal3 :string_octal3 Escape * string noeat "0-7" string :char Constant * char "\n" reset "'" idle "\\" char_escape recolor=-1 :char_escape Escape * char "x" char_hex1 "0-7" char_octal2 "\n" char recolor=-2 :char_hex1 Escape * char noeat "0-9a-fA-F" char_hex2 :char_hex2 Escape * char noeat "0-9a-fA-F" char :char_octal2 Escape * char noeat "0-7" char_octal3 :char_octal3 Escape * char noeat "0-7" char :ident Idle * idle noeat strings # C and C++ base types "int" type "float" type "long" type "short" type "char" type "double" type "signed" type "unsigned" type "void" type "static" type "register" type "extern" type "inline" type "auto" type "const" type "volatile" type # GLIB types "gint" type "gint8" type "gint16" type "gint32" type "gint64" type "guint" type "guint8" type "guint16" type "guint32" type "guint64" type "gchar" type "guchar" type "gshort" type "gushort" type "glong" type "gulong" type "gboolean" type "gfloat" type "gdouble" type "gpointer" type "gconstpointer" type # C and C++ reserved words "if" kw "else" kw "while" kw "for" kw "break" kw "continue" kw "do" kw "case" kw "default" kw "switch" kw "goto" kw "struct" kw "enum" kw "return" kw "sizeof" kw "typedef" kw "union" kw "asm" kw # C++ keywords "virtual" cppkw "class" cppkw "public" cppkw "private" cppkw "protected" cppkw "friend" cppkw "new" cppkw "delete" cppkw "bool" cppkw "namespace" cppkw "operator" cppkw "template" cppkw "catch" cppkw "throw" cppkw "try" cppkw "typeof" cppkw done "a-zA-Z0-9_" ident :type Type * idle noeat :kw Keyword * idle noeat :cppkw CppKeyword * idle noeat