Edit file File name : go.jsf Content :# Google Go (golang) syntax # (c) 2012 Matthias S. Benkmann # License: http://creativecommons.org/licenses/by/3.0/deed.en_US =Idle =Bad =Comment =Constant =Boolean +Constant =String +Constant =Character +String =BackQuoted +String =StringEscape +Escape =Number +Constant =Ident =DefinedIdent +Ident =Keyword =Operator +Keyword =Statement +Keyword =Conditional +Statement =Loop +Statement =Label +DefinedIdent =Structure +Type +Keyword =Type =Builtin +DefinedFunction =Control =Brackets +Control =Brace +Control =Semicolon +Control =Comma +Control =Period +Control =PeriodDecimal +Period +Number ##################### main ######################### :main Idle * keyword_or_identifier noeat buffer " \t" main "\n" main "/" maybe_comment recolor=-1 "'" single_quoted recolor=-1 "\"" double_quoted recolor=-1 "`" back_quoted recolor=-1 "+&=!|*^<>:%-" operator noeat "()" parentheses noeat "[]" brackets noeat "{}" curlies noeat ";" semicolon noeat "," comma noeat "." period "0" number0 recolor=-1 "1-9" float recolor=-1 "#$@~" error noeat #################### error ########################## :error Bad * error "\n" main "/" maybe_comment_err recolor=-1 :maybe_comment_err Operator * error noeat recolor=-2 "/" line_comment recolor=-2 "*" block_comment recolor=-2 ################## comments ######################### :maybe_comment Operator * main noeat "/" line_comment recolor=-2 "*" block_comment recolor=-2 :line_comment Comment comment * line_comment "BFHNTX" line_comment noeat call=comment_todo.comment_todo() "\n" main :block_comment Comment comment * block_comment "BFHNTX" block_comment noeat call=comment_todo.comment_todo() "*" maybe_end_block_comment :maybe_end_block_comment Comment comment * block_comment noeat "/" main ################ strings ############################ :single_quoted Character string * single_quoted "'" main "\\" single_quoted call=.escape() recolor=-1 "\n" error :double_quoted String string * double_quoted "\"" main "\\" double_quoted call=.escape() recolor=-1 "\n" error :back_quoted BackQuoted string * back_quoted "`" main ################### operators ####################### :operator Operator * main :parentheses Control * main :brackets Brackets * main :curlies Brace * main :semicolon Semicolon * main :comma Comma * main ##################### period ####################### :period Period * period_other noeat recolor=-2 "0-9" period_decimal noeat recolor=-2 :period_other Period * main noeat :period_decimal PeriodDecimal * float_no_period noeat ################### numbers #################### :float_no_period Number * end_of_number noeat "0-9" float_no_period "eE" integer :integer Number * error noeat "+-" unsigned "0-9" unsigned_or_end :unsigned Number * error noeat "0-9" unsigned_or_end :unsigned_or_end Number * end_of_number noeat "0-9" unsigned_or_end :end_of_number Number * main noeat "i" main # imaginary number suffix :number0 Number * end_of_number noeat "xX" hex "." period_decimal recolor=-1 # 099i is a valid imaginary number, 099.0 is a valid float, # but 099 is an invalid octal. #We don't check for this and simply lump both cases together. "0-9" float :hex Number * main noeat "0-9a-fA-F" hex :float Number * end_of_number noeat "0-9" float "." period_decimal recolor=-1 "eE" integer ################# keywords and identifiers ########################## :keyword_or_identifier Ident * identifier "\p{Lu}\p{Lt}" exported_identifier recolor=-1 "\p{Ll}\p{Lo}\p{Pc}\p{Nl}" keyword_or_identifier2 :exported_identifier DefinedIdent * exported_identifier "\x01-/:-@[-^`{-\x7f" main noeat :identifier Ident * identifier "\x01-/:-@[-^`{-\x7f" main noeat :keyword_or_identifier2 Ident * identifier "\c" keyword_or_identifier2 "\x01-/:-@[-^`{-\x7f" main noeat hold strings "_" keyword "break" stmt "default" label "func" keyword "interface" struct "select" cond "case" label "defer" stmt "go" keyword "struct" struct "else" cond "goto" stmt "package" stmt "switch" cond "const" stmt "fallthrough" keyword "if" cond "range" loop "type" struct "continue" stmt "for" loop "import" stmt "return" stmt "var" stmt "true" boolean "false" boolean "nil" constant "iota" constant "byte" type "rune" type "int" type "uint" type "uintptr" type "uint8" type "uint16" type "uint32" type "uint64" type "int8" type "int16" type "int32" type "int64" type "float32" type "float64" type "complex64" type "complex128" type "bool" type "string" type "error" type "map" type "chan" type "delete" builtin "make" builtin "len" builtin "cap" builtin "new" builtin "copy" builtin "append" builtin "close" builtin "complex" builtin "imag" builtin "panic" builtin "print" builtin "println" builtin "real" builtin "recover" builtin done :keyword Keyword * main noeat :constant Constant * main noeat :type Type * main noeat :builtin Builtin * main noeat :stmt Statement * main noeat :label Label * main noeat :struct Structure * main noeat :cond Conditional * main noeat :loop Loop * main noeat :boolean Boolean * main noeat ########################## .subr escape START ###################################### .subr escape :esc StringEscape string * esc_err noeat "abfnrtv'\"" whatever return # For some reason joe doesn't interpret \\ properly if merged with the # previous case. So create a separate case for it. "\\" whatever return "x" hex2 "u" hex4 "U" hex8 "0-3" oct2 :hex8 StringEscape string * esc_err noeat "a-fA-F0-9" hex7 :hex7 StringEscape string * esc_err noeat "a-fA-F0-9" hex6 :hex6 StringEscape string * esc_err noeat "a-fA-F0-9" hex5 :hex5 StringEscape string * esc_err noeat "a-fA-F0-9" hex4 :hex4 StringEscape string * esc_err noeat "a-fA-F0-9" hex3 :hex3 StringEscape string * esc_err noeat "a-fA-F0-9" hex2 :hex2 StringEscape string * esc_err noeat "a-fA-F0-9" hex1 :hex1 StringEscape string * esc_err noeat "a-fA-F0-9" whatever return :oct2 StringEscape string * esc_err noeat "0-7" oct1 :oct1 StringEscape string * esc_err noeat "0-7" whatever return :esc_err Bad * esc_err return "\n" esc_err_newline noeat recolor=-2 :esc_err_newline Bad * esc_err return noeat .end ########################## .subr escape END ###################################### Save