File: batch.jsf

package info (click to toggle)
ne 3.3.3-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,192 kB
  • sloc: ansic: 28,739; perl: 571; makefile: 265; sh: 9
file content (154 lines) | stat: -rw-r--r-- 2,421 bytes parent folder | download | duplicates (6)
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
# JOE syntax highlight file for Windows batch scripts

=Idle
=Comment	green
=Command	bold
=Statement	bold cyan
=Brace		magenta
=Variable	blue
=Label		bold blue

: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"		stmt
	"goto"		stmt
	"if"		stmt
	"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
	"\r\n"		reset

:stmt Statement
	*		args		noeat

:echostmt Statement
	*		echoargs	noeat

:echoargs Idle
	*		echoargs
	"%"		echoargs	call=.variable() recolor=-1
	"&"		and		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			
	"&"		and		recolor=-1

# Double-quoted args
:qargs Idle
	*		qargs
	"\""		args
	"%"		qargs		call=.variable() recolor=-1
	"\r\n"		reset

# Single-quoted args
:sqargs Idle
	*		sqargs
	"'"		args
	"%"		sqargs		call=.variable() recolor=-1
	"\r\n"		reset

# Back-quoted (`) args, found in some for-loops
:bqargs Idle
	*		bqargs
	"`"		args
	"%"		bqargs		call=.variable() recolor=-1
	"\r\n"		reset

:and Idle
	*		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