dotfiles

My dotfiles.
Log | Files | Refs | LICENSE

go.jsf (8565B)


      1 # Google Go (golang) syntax
      2 # (c) 2012 Matthias S. Benkmann
      3 # License: http://creativecommons.org/licenses/by/3.0/deed.en_US
      4 
      5 
      6 =Idle
      7 =Bad
      8 =Comment
      9 =Constant
     10 =Boolean	+Constant
     11 =String		+Constant
     12 =Character	+String
     13 =BackQuoted	+String
     14 =StringEscape	+Escape
     15 =Number		+Constant
     16 =Ident
     17 =DefinedIdent	+Ident
     18 =Keyword
     19 =Operator	+Keyword
     20 =Statement	+Keyword
     21 =Conditional	+Statement
     22 =Loop		+Statement
     23 =Label		+DefinedIdent
     24 =Structure	+Type +Keyword
     25 =Type
     26 =Builtin	+DefinedFunction
     27 
     28 =Control
     29 =Brackets	+Control
     30 =Brace		+Control
     31 =Semicolon	+Control
     32 =Comma		+Control
     33 =Period		+Control
     34 =PeriodDecimal	+Period +Number
     35 
     36 
     37 ##################### main #########################
     38 :main Idle
     39   *             keyword_or_identifier   noeat buffer
     40   " \t"         main
     41   "\n"          main
     42   "/"           maybe_comment recolor=-1
     43   "'"           single_quoted recolor=-1
     44   "\""          double_quoted recolor=-1
     45   "`"           back_quoted   recolor=-1
     46   "+&=!|*^<>:%-" operator    noeat
     47   "()"          parentheses   noeat
     48   "[]"          brackets      noeat
     49   "{}"          curlies       noeat
     50   ";"           semicolon     noeat
     51   ","           comma         noeat  
     52   "."           period
     53   "0"           number0       recolor=-1
     54   "1-9"         float         recolor=-1
     55   "#$@~"        error         noeat
     56 
     57 #################### error ##########################
     58 :error Bad
     59   *             error
     60   "\n"          main
     61   "/"           maybe_comment_err  recolor=-1
     62 
     63 :maybe_comment_err Operator
     64   *             error noeat recolor=-2
     65   "/"           line_comment  recolor=-2
     66   "*"           block_comment recolor=-2
     67 
     68 ################## comments #########################
     69 :maybe_comment Operator
     70   *             main noeat
     71   "/"           line_comment  recolor=-2
     72   "*"           block_comment recolor=-2
     73 
     74 :line_comment Comment comment
     75   *             line_comment
     76   "BFHNTX"      line_comment  noeat call=comment_todo.comment_todo()
     77   "\n"          main
     78 
     79 :block_comment Comment comment  
     80   *            block_comment
     81   "BFHNTX"     block_comment  noeat call=comment_todo.comment_todo()
     82   "*"          maybe_end_block_comment
     83   
     84 :maybe_end_block_comment Comment comment
     85   *            block_comment noeat
     86   "/"          main
     87 
     88 ################ strings ############################
     89 :single_quoted Character string
     90   *            single_quoted
     91   "'"          main
     92   "\\"         single_quoted call=.escape() recolor=-1
     93   "\n"         error
     94 
     95 :double_quoted String string
     96   *            double_quoted
     97   "\""         main
     98   "\\"         double_quoted call=.escape() recolor=-1
     99   "\n"         error
    100 
    101 :back_quoted BackQuoted string
    102   *            back_quoted
    103   "`"          main
    104 
    105 ################### operators #######################
    106 :operator Operator
    107   *            main
    108 
    109 :parentheses Control
    110   *            main
    111 
    112 :brackets Brackets
    113   *            main
    114 
    115 :curlies  Brace
    116   *            main
    117 
    118 :semicolon Semicolon
    119   *            main
    120 
    121 :comma Comma
    122   *            main
    123 
    124 ##################### period #######################
    125 
    126 :period Period
    127   *            period_other    noeat recolor=-2
    128   "0-9"        period_decimal  noeat recolor=-2
    129 
    130 :period_other Period  
    131   *            main noeat
    132 
    133 :period_decimal PeriodDecimal
    134   *            float_no_period noeat
    135 
    136 
    137 ################### numbers ####################
    138 :float_no_period Number
    139   *            end_of_number   noeat
    140   "0-9"        float_no_period
    141   "eE"         integer
    142 
    143 :integer Number
    144   *            error     noeat
    145   "+-"         unsigned
    146   "0-9"        unsigned_or_end
    147 
    148 :unsigned Number
    149   *            error     noeat
    150   "0-9"        unsigned_or_end
    151 
    152 :unsigned_or_end Number
    153   *            end_of_number noeat
    154   "0-9"        unsigned_or_end
    155 
    156 :end_of_number Number
    157   *            main  noeat
    158   "i"          main   # imaginary number suffix
    159 
    160 :number0 Number
    161   *            end_of_number  noeat
    162   "xX"         hex
    163   "."          period_decimal recolor=-1
    164     # 099i is a valid imaginary number, 099.0 is a valid float,
    165     # but 099 is an invalid octal. 
    166     #We don't check for this and simply lump both cases together.
    167   "0-9"        float
    168 
    169 :hex Number
    170   *            main  noeat
    171   "0-9a-fA-F"  hex
    172 
    173 :float Number
    174   *            end_of_number  noeat
    175   "0-9"        float
    176   "."          period_decimal recolor=-1
    177   "eE"         integer
    178   
    179 ################# keywords and identifiers ##########################
    180 :keyword_or_identifier Ident
    181   *            identifier
    182   "\p{Lu}\p{Lt}"        exported_identifier recolor=-1
    183   "\p{Ll}\p{Lo}\p{Pc}\p{Nl}"       keyword_or_identifier2
    184 
    185 :exported_identifier  DefinedIdent
    186   *                         exported_identifier
    187   "\x01-/:-@[-^`{-\x7f"      main noeat
    188 
    189 :identifier Ident
    190   *                         identifier
    191   "\x01-/:-@[-^`{-\x7f"     main noeat
    192 
    193 :keyword_or_identifier2 Ident
    194   *                 identifier
    195   "\c"	            keyword_or_identifier2
    196   "\x01-/:-@[-^`{-\x7f"      main noeat hold strings
    197       "_"           keyword
    198       "break"       stmt
    199       "default"     label
    200       "func"        keyword
    201       "interface"   struct
    202       "select"      cond
    203       "case"        label
    204       "defer"       stmt
    205       "go"          keyword
    206       "struct"      struct
    207       "else"        cond
    208       "goto"        stmt
    209       "package"     stmt
    210       "switch"      cond
    211       "const"       stmt
    212       "fallthrough" keyword
    213       "if"          cond
    214       "range"       loop
    215       "type"        struct
    216       "continue"    stmt
    217       "for"         loop
    218       "import"      stmt
    219       "return"      stmt
    220       "var"         stmt
    221       
    222       "true"        boolean
    223       "false"       boolean
    224       "nil"         constant
    225       "iota"        constant
    226       
    227       "byte"        type
    228       "rune"        type
    229       "int"         type
    230       "uint"        type
    231       "uintptr"     type
    232       "uint8"       type
    233       "uint16"      type
    234       "uint32"      type
    235       "uint64"      type
    236       "int8"        type
    237       "int16"       type
    238       "int32"       type
    239       "int64"       type
    240       "float32"     type
    241       "float64"     type
    242       "complex64"   type
    243       "complex128"  type
    244       "bool"        type
    245       "string"      type
    246       "error"       type
    247       "map"         type
    248       "chan"        type
    249       
    250       "delete"      builtin
    251       "make"        builtin
    252       "len"         builtin
    253       "cap"         builtin
    254       "new"         builtin
    255       "copy"        builtin
    256       "append"      builtin
    257       "close"       builtin
    258       "complex"     builtin
    259       "imag"        builtin
    260       "panic"       builtin
    261       "print"       builtin
    262       "println"     builtin
    263       "real"        builtin
    264       "recover"     builtin
    265   done
    266 
    267 :keyword Keyword
    268   *            main  noeat
    269 
    270 :constant Constant
    271   *            main  noeat
    272 
    273 :type Type
    274   *            main  noeat
    275   
    276 :builtin Builtin
    277   *            main  noeat
    278 
    279 :stmt Statement
    280   *            main  noeat
    281 
    282 :label Label
    283   *            main  noeat
    284 
    285 :struct Structure
    286   *            main  noeat
    287 
    288 :cond Conditional
    289   *            main  noeat
    290 
    291 :loop Loop
    292   *            main  noeat
    293 
    294 :boolean Boolean
    295   *            main  noeat
    296 
    297 ########################## .subr escape START ######################################
    298 .subr escape
    299 :esc StringEscape string
    300   *              esc_err    noeat
    301   "abfnrtv'\"" whatever return
    302     # For some reason joe doesn't interpret \\ properly if merged with the
    303     # previous case. So create a separate case for it.
    304   "\\"         whatever return
    305   "x"            hex2
    306   "u"            hex4
    307   "U"            hex8
    308   "0-3"          oct2
    309 
    310 :hex8 StringEscape string
    311   *              esc_err noeat
    312   "a-fA-F0-9"    hex7
    313 
    314 :hex7 StringEscape string
    315   *              esc_err    noeat
    316   "a-fA-F0-9"    hex6
    317 
    318 :hex6 StringEscape string
    319   *              esc_err noeat
    320   "a-fA-F0-9"    hex5
    321 
    322 :hex5 StringEscape string
    323   *              esc_err    noeat
    324   "a-fA-F0-9"    hex4
    325 
    326 :hex4 StringEscape string
    327   *              esc_err noeat
    328   "a-fA-F0-9"    hex3
    329 
    330 :hex3 StringEscape string
    331   *              esc_err    noeat
    332   "a-fA-F0-9"    hex2
    333 
    334 :hex2 StringEscape string
    335   *              esc_err noeat
    336   "a-fA-F0-9"    hex1
    337 
    338 :hex1 StringEscape string
    339   *              esc_err    noeat
    340   "a-fA-F0-9"    whatever return
    341 
    342 :oct2 StringEscape string
    343   *              esc_err noeat
    344   "0-7"          oct1
    345 
    346 :oct1 StringEscape string
    347   *              esc_err noeat
    348   "0-7"          whatever return
    349 
    350 :esc_err Bad
    351   *              esc_err return
    352   "\n"           esc_err_newline noeat recolor=-2
    353 
    354 :esc_err_newline Bad
    355   *              esc_err return noeat
    356   
    357 
    358 .end
    359 ########################## .subr escape END ######################################
    360 
    361