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