batch.jsf (3026B)
1 # JOE syntax highlight file for Windows batch scripts 2 3 =Idle 4 =Comment 5 =Command +Type 6 =Statement +Keyword 7 =Brace 8 =Variable +DefinedIdent 9 =StringVariable +StringEscape 10 =Label 11 =Conditional +Statement 12 =Loop +Statement 13 =String +Constant 14 15 :reset Idle 16 * linebegin noeat 17 " \t\r\n" reset 18 19 :linebegin Idle 20 * stmtorcommand noeat buffer 21 ":" labelorcomment 22 "@" linebegin 23 "%" args call=.variable() recolor=-1 24 "\"" qargs recolor=-1 25 "'" sqargs recolor=-1 # These two encountered in 26 "`" bqargs recolor=-1 # certain varieties of for-loops 27 28 :stmtorcommand Command 29 * command noeat istrings 30 "call" stmt 31 "cd" stmt 32 "chdir" stmt 33 "cls" stmt 34 "copy" stmt 35 "del" stmt 36 "dir" stmt 37 "echo" echostmt 38 "echo." echostmt 39 "endlocal" stmt 40 "erase" stmt 41 "exit" stmt 42 "for" cond 43 "goto" loop 44 "if" cond 45 "move" stmt 46 "pause" stmt 47 "popd" stmt 48 "pushd" stmt 49 "rd" stmt 50 "rem" comment 51 "ren" stmt 52 "rename" stmt 53 "rmdir" stmt 54 "set" stmt 55 "setlocal" stmt 56 "setx" stmt 57 "shift" stmt 58 "sleep" stmt 59 "start" stmt 60 "type" stmt 61 "xcopy" stmt 62 done 63 "a-zA-Z." stmtorcommand 64 "\"\\_0-9" command 65 ")" rparen recolor=-1 66 67 :labelorcomment Idle 68 * label recolor=-2 69 ":" comment recolor=-2 70 71 :label Label 72 * label 73 "\r\n" reset 74 75 :comment Comment comment 76 * comment 77 "BFHNTX" comment noeat call=comment_todo.comment_todo() 78 "\r\n" reset 79 80 :loop Loop 81 * args noeat 82 83 :cond Conditional 84 * args noeat 85 86 :stmt Statement 87 * args noeat 88 89 :echostmt Statement 90 * echoargs noeat 91 92 :echoargs String string 93 * echoargs 94 "%" echoargs call=.strvariable() recolor=-1 95 "&" and recolor=-1 96 ">|" reset recolor=-1 97 "\r\n" reset 98 99 :command Command 100 * command 101 "\"" qcommand 102 " \t" args 103 "\r\n" reset 104 105 :qcommand Command 106 * qcommand 107 "\"" command 108 "\r\n" reset 109 110 :args Idle 111 * args 112 "%" args call=.variable() recolor=-1 113 "(" lparen recolor=-1 114 ")" rparen recolor=-1 115 "\r\n" reset 116 "\"" qargs recolor=-1 117 "&" and recolor=-1 118 119 # Double-quoted args 120 :qargs String string 121 * qargs 122 "\"" args 123 "%" qargs call=.strvariable() recolor=-1 124 "\r\n" reset 125 126 # Single-quoted args 127 :sqargs String string 128 * sqargs 129 "'" args 130 "%" sqargs call=.strvariable() recolor=-1 131 "\r\n" reset 132 133 # Back-quoted (`) args, found in some for-loops 134 :bqargs String string 135 * bqargs 136 "`" args 137 "%" bqargs call=.strvariable() recolor=-1 138 "\r\n" reset 139 140 :and Idle 141 "&" and 142 * reset noeat 143 144 :lparen Brace 145 * linebegin noeat 146 147 :rparen Brace 148 * args noeat 149 150 .subr variable 151 152 :variable Variable 153 * args noeat return 154 "%~" shortvar 155 "\*" noeat return 156 "0-9" variable return 157 "A-Za-z_" varbody 158 159 :shortvar Variable 160 * args noeat return 161 "A-Za-z0-9_" shortvar 162 163 :varbody Variable 164 * varbody 165 "%" args return 166 167 .end 168 169 .subr strvariable 170 171 :variable StringVariable string 172 * args noeat return 173 "%~" shortvar 174 "\*" noeat return 175 "0-9" variable return 176 "A-Za-z_" varbody 177 178 :shortvar StringVariable string 179 * args noeat return 180 "A-Za-z0-9_" shortvar 181 182 :varbody StringVariable string 183 * varbody 184 "%" args return 185 186 .end