Lines 27-74
Link Here
|
27 |
static int inproc = 0; |
27 |
static int inproc = 0; |
28 |
|
28 |
|
29 |
static Token lbraceToken = {LBRACE, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; |
29 |
static Token lbraceToken = {.type = LBRACE, .ckind = CNSTWORD}; |
30 |
static Token rbraceToken = {RBRACE, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; |
30 |
static Token rbraceToken = {.type = RBRACE, .ckind = CNSTWORD}; |
31 |
static Token xcontToken = {XCONT, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; |
31 |
static Token xcontToken = {.type = XCONT, .ckind = CNSTWORD}; |
32 |
static Token ostartToken = {OSTART, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; |
32 |
static Token ostartToken = {.type = OSTART, .ckind = CNSTWORD}; |
33 |
static Token startToken = {START, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; |
33 |
static Token startToken = {.type = START, .ckind = CNSTWORD}; |
34 |
static Token contToken = {CONT, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; |
34 |
static Token contToken = {.type = CONT, .ckind = CNSTWORD}; |
35 |
static Token econtToken = {ECONT, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; |
35 |
static Token econtToken = {.type = ECONT, .ckind = CNSTWORD}; |
36 |
static Token emToken = {EM, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; |
36 |
static Token emToken = {.type = EM, .ckind = CNSTWORD}; |
37 |
static Token nospToken = {NOSP, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; |
37 |
static Token nospToken = {.type = NOSP, .ckind = CNSTWORD}; |
38 |
static Token *olsToken = &emToken; |
38 |
static Token *olsToken = &emToken; |
39 |
static Token spToken = {SP, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; |
39 |
static Token spToken = {.type = SP, .ckind = CNSTWORD}; |
40 |
static Token lbrackToken = {LBRACK, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; |
40 |
static Token lbrackToken = {.type = LBRACK, .ckind = CNSTWORD}; |
41 |
static Token rbrackToken = {RBRACK, CNSTWORD, 0, (char *) 0, 0, (Token *) 0, (Token *) 0}; |
41 |
static Token rbrackToken = {.type = RBRACK, .ckind = CNSTWORD}; |
42 |
static Token msgcatToken = {CONST, CNSTWORD, 0, "::msgcat::mc", 12, (Token *) 0, (Token *) 0}; |
42 |
static Token msgcatToken = {.type = CONST, .ckind = CNSTWORD, .text = "::msgcat::mc", .length = 12}; |
43 |
|
43 |
|
44 |
static Token dqStart = {DQSTART, CNSTWORD, 0, (char *) 0, 0, noToken, noToken}; |
44 |
static Token dqStart = {.type = DQSTART, .ckind = CNSTWORD}; |
45 |
static Token dqEnd = {DQEND, CNSTWORD, 0, (char *) 0, 0, noToken, noToken}; |
45 |
static Token dqEnd = {.type = DQEND, .ckind = CNSTWORD}; |
46 |
static Token thenToken = {CONST, CNSTWORD, 0, "then", 4, noToken, noToken}; |
46 |
static Token thenToken = {.type = CONST, .ckind = CNSTWORD, .text = "then", .length = 4}; |
47 |
static Token procToken = {CONST, CNSTWORD, 0, "proc", 4, noToken, noToken}; |
47 |
static Token procToken = {.type = CONST, .ckind = CNSTWORD, .text = "proc", .length = 4}; |
48 |
static Token elseToken = {CONST, CNSTWORD, 0, "else", 4, noToken, noToken}; |
48 |
static Token elseToken = {.type = CONST, .ckind = CNSTWORD, .text = "else", .length = 4}; |
49 |
static Token elseifToken = {CONST, CNSTWORD, 0, "elseif", 6, noToken, noToken}; |
49 |
static Token elseifToken = {.type = CONST, .ckind = CNSTWORD, .text = "elseif", .length = 6}; |
50 |
static Token methodToken = {CONST, CNSTWORD, 0, "method", 6, noToken, noToken}; |
50 |
static Token methodToken = {.type = CONST, .ckind = CNSTWORD, .text = "method", .length = 6}; |
51 |
static Token semiToken = {SEMI, CNSTWORD, 0, ";", 1, noToken, noToken}; |
51 |
static Token semiToken = {.type = SEMI, .ckind = CNSTWORD, .text = ";", .length = 1}; |
52 |
static Token argsToken = {SEMI, CNSTWORD, 0, "args", 4, noToken, noToken}; |
52 |
static Token argsToken = {.type = SEMI, .ckind = CNSTWORD, .text = "args", .length = 4}; |
53 |
static Token argvToken = {SEMI, CNSTWORD, 0, "argv", 4, noToken, noToken}; |
53 |
static Token argvToken = {.type = SEMI, .ckind = CNSTWORD, .text = "argv", .length = 4}; |
54 |
static Token argv0Token = {SEMI, CNSTWORD, 0, "argv0", 5, noToken, noToken}; |
54 |
static Token argv0Token = {.type = SEMI, .ckind = CNSTWORD, .text = "argv0", .length = 5}; |
55 |
static Token platfToken = {SEMI, CNSTWORD, 0, "tcl_platform", 12, noToken, noToken}; |
55 |
static Token platfToken = {.type = SEMI, .ckind = CNSTWORD, .text = "tcl_platform", .length = 12}; |
56 |
|
56 |
|
57 |
List *blocks = noList; |
57 |
List *blocks = noList; |
58 |
|
58 |
|
59 |
static CheckIt **noChecks = (CheckIt **) 0; |
|
|
60 |
|
61 |
extern void setIndent(void); |
62 |
extern void outdent(void); |
63 |
extern int isVarToken(Token *); |
64 |
extern int isSwitch(Token *); |
65 |
extern int isSingleCall(Token *, char *); |
66 |
extern int tokEqual(Token *, char *); |
67 |
|
68 |
/* |
59 |
/* |
69 |
* If there are no more tokens, print a useful message to the user and |
60 |
* If there are no more tokens, print a useful message to the user and |
70 |
* exit. |
61 |
* exit. |
71 |
*/ |
62 |
*/ |
72 |
void failIfNullToken(Token *token, char *part, char *command, int ln) |
63 |
static void failIfNullToken(const Token *token, const char *part, |
|
|
64 |
const char *command, int ln) |
73 |
{ |
65 |
{ |
74 |
char msg[1024]; |
66 |
char msg[1024]; |
Lines 78-86
Link Here
|
78 |
if (ln == 0) |
70 |
if (ln == 0) |
79 |
{ |
71 |
{ |
80 |
sprintf(msg, "Missing \"%s\" part in call of %s", part, command); |
72 |
snprintf(msg, sizeof msg, "Missing \"%s\" part in call of %s", part, command); |
81 |
} |
73 |
} |
82 |
else |
74 |
else |
83 |
{ |
75 |
{ |
84 |
sprintf(msg, "Missing \"%s\" part in call of %s, starting line %d", |
76 |
snprintf(msg, sizeof msg, "Missing \"%s\" part in call of %s, starting line %d", |
85 |
part, command, ln); |
77 |
part, command, ln); |
86 |
} |
78 |
} |
Lines 93-97
Link Here
|
93 |
* the user. |
85 |
* the user. |
94 |
*/ |
86 |
*/ |
95 |
void warnIfArgsAfter(Token *token, char *part, char *command) |
87 |
static void warnIfArgsAfter(const Token *token, const char *part, |
|
|
88 |
const char *command) |
96 |
{ |
89 |
{ |
97 |
char msg[1024]; |
90 |
char msg[1024]; |
Lines 107-116
Link Here
|
107 |
if (*part != '\0') |
100 |
if (*part != '\0') |
108 |
{ |
101 |
{ |
109 |
sprintf(msg, "Extra arguments after \"%s\" part in call of %s", |
102 |
snprintf(msg, sizeof msg, "Extra arguments after \"%s\" part in call of %s", |
110 |
part, command); |
103 |
part, command); |
111 |
} |
104 |
} |
112 |
else |
105 |
else |
113 |
{ |
106 |
{ |
114 |
sprintf(msg, "Extra arguments in call of `%s'", command); |
107 |
snprintf(msg, sizeof msg, "Extra arguments in call of `%s'", command); |
115 |
} |
108 |
} |
116 |
warn(token, msg); |
109 |
warn(token, msg); |
Lines 118-122
Link Here
|
118 |
token->next->text[0] != '\0') |
111 |
token->next->text[0] != '\0') |
119 |
{ |
112 |
{ |
120 |
sprintf(msg, "Extra token is `%s'", token->next->text); |
113 |
snprintf(msg, sizeof msg, "Extra token is `%s'", token->next->text); |
121 |
warn(token->next, msg); |
114 |
warn(token->next, msg); |
122 |
} |
115 |
} |
Lines 125-129
Link Here
|
125 |
} |
118 |
} |
126 |
|
119 |
|
127 |
void warnExpr(Token *cmd, char *txt) |
120 |
static void warnExpr(const Token *cmd, const char *txt) |
128 |
{ |
121 |
{ |
129 |
if (doTest(HEXPR) && cmd != noToken && cmd->type != LIST) |
122 |
if (doTest(HEXPR) && cmd != noToken && cmd->type != LIST) |
Lines 133-151
Link Here
|
133 |
} |
126 |
} |
134 |
|
127 |
|
135 |
void warnFor(Token *token, char *cmd, char *txt) |
128 |
void warnFor(const Token *token, const char *cmd, const char *txt) |
136 |
{ |
129 |
{ |
137 |
char msg[1024]; |
130 |
char msg[1024]; |
138 |
|
131 |
|
139 |
sprintf(msg, txt, cmd); |
132 |
snprintf(msg, sizeof msg, txt, cmd); |
140 |
warn(token, msg); |
133 |
warn(token, msg); |
141 |
} |
134 |
} |
142 |
|
135 |
|
143 |
static void warnIFor(Token *token, int val, char *txt) |
|
|
144 |
{ |
145 |
char msg[1024]; |
146 |
|
147 |
sprintf(msg, txt, val); |
148 |
warn(token, msg); |
149 |
} |
150 |
/* |
136 |
/* |
151 |
* reset various variables so that multiple file processing doesn't get |
137 |
* reset various variables so that multiple file processing doesn't get |
Lines 171-175
Link Here
|
171 |
} |
157 |
} |
172 |
|
158 |
|
173 |
static int isNumber(char *cp) |
159 |
static int isNumber(const char *cp) |
174 |
{ |
160 |
{ |
175 |
if (*cp == '-' || *cp == '+') |
161 |
if (*cp == '-' || *cp == '+') |
Lines 188-194
Link Here
|
188 |
} |
174 |
} |
189 |
|
175 |
|
190 |
static int tokIsLevel(Token *tp) |
176 |
static int tokIsLevel(const Token *tp) |
191 |
{ |
177 |
{ |
192 |
char *cp; |
178 |
const char *cp; |
193 |
if (tp == noToken || !(tp->type == CONST || tp->type == LIST) || tp->text == (char *) 0) |
179 |
if (tp == noToken || !(tp->type == CONST || tp->type == LIST) || tp->text == (char *) 0) |
194 |
{ |
180 |
{ |
Lines 208-212
Link Here
|
208 |
} |
194 |
} |
209 |
|
195 |
|
210 |
static int oneLine(Token *seq, int semis) |
196 |
static int oneLine(const Token *seq, int semis) |
211 |
{ |
197 |
{ |
212 |
while (seq != noToken) |
198 |
while (seq != noToken) |
Lines 222-226
Link Here
|
222 |
} |
208 |
} |
223 |
|
209 |
|
224 |
static int checkSpecial(char *val) |
210 |
static int checkSpecial(const char *val) |
225 |
{ |
211 |
{ |
226 |
char ch; |
212 |
char ch; |
Lines 239-253
Link Here
|
239 |
} |
225 |
} |
240 |
|
226 |
|
241 |
static void checkUnquoted(Token *str) |
227 |
static void checkUnquoted(const Token *str) |
242 |
{ |
228 |
{ |
243 |
char msg[128]; |
229 |
char msg[128]; |
244 |
if (noquotes && str->type == CONST && str->ckind == CNSTWORD && !isNumber(str->text)) |
230 |
if (noquotes && str->type == CONST && str->ckind == CNSTWORD && !isNumber(str->text)) |
245 |
{ |
231 |
{ |
246 |
sprintf(msg, "Unquoted constant - \"%s\"", str->text); |
232 |
snprintf(msg, sizeof msg, "Unquoted constant - \"%s\"", str->text); |
247 |
warn(str, msg); |
233 |
warn(str, msg); |
248 |
} |
234 |
} |
249 |
} |
235 |
} |
250 |
|
236 |
|
251 |
static void checkType(Token *cmd, int flags) |
237 |
static void checkType(const Token *cmd, int flags) |
252 |
{ |
238 |
{ |
253 |
if (cmd->type == CONST) |
239 |
if (cmd->type == CONST) |
Lines 267-271
Link Here
|
267 |
} |
253 |
} |
268 |
|
254 |
|
269 |
static int single(Token * tp) |
255 |
static int single(const Token * tp) |
270 |
{ |
256 |
{ |
271 |
if (tp != noToken && tp->next == noToken) |
257 |
if (tp != noToken && tp->next == noToken) |
Lines 286-290
Link Here
|
286 |
} |
272 |
} |
287 |
|
273 |
|
288 |
static int sconstant(Token *tp) |
274 |
static int sconstant(const Token *tp) |
289 |
{ |
275 |
{ |
290 |
return (tp != noToken && tp->next == noToken |
276 |
return (tp != noToken && tp->next == noToken |
Lines 292-296
Link Here
|
292 |
} |
278 |
} |
293 |
|
279 |
|
294 |
static int constantString(Token * tp, int any) |
280 |
static int constantString(const Token * tp, int any) |
295 |
{ |
281 |
{ |
296 |
Token *sq; |
282 |
Token *sq; |
Lines 313-322
Link Here
|
313 |
} |
299 |
} |
314 |
|
300 |
|
315 |
void loopstart(int inf, int cond) |
301 |
static void loopstart(int inf, int cond) |
316 |
{ |
302 |
{ |
317 |
pushBlock(noToken, inf, -1, cond); |
303 |
pushBlock(noToken, inf, -1, cond); |
318 |
} |
304 |
} |
319 |
|
305 |
|
320 |
void loopend(void) |
306 |
static void loopend(void) |
321 |
{ |
307 |
{ |
322 |
Blox *bp = lpeek(blocks); |
308 |
Blox *bp = lpeek(blocks); |
Lines 330-334
Link Here
|
330 |
} |
316 |
} |
331 |
|
317 |
|
332 |
static void msgsave(Token *tp, int any) |
318 |
static void msgsave(const Token *tp, int any) |
333 |
{ |
319 |
{ |
334 |
char filename[128]; |
320 |
char filename[128]; |
Lines 363-370
Link Here
|
363 |
} |
349 |
} |
364 |
|
350 |
|
365 |
void sptclop(Token *hd) |
351 |
static void doUser(Token *hd, Token *cmd, const ConfigData *cpt, int nostart); |
|
|
352 |
|
353 |
static void sptclop(Token *hd) |
366 |
{ |
354 |
{ |
367 |
List *cpt = config; |
355 |
List *cpt = config; |
368 |
extern void doUser(Token *hd, Token *cmd, ConfigData *cpt, int nostart); |
|
|
369 |
ConfigData *cdp; |
356 |
ConfigData *cdp; |
370 |
|
357 |
|
Lines 529-533
Link Here
|
529 |
} PressFlags; |
516 |
} PressFlags; |
530 |
|
517 |
|
531 |
static void press(Token *v , PressFlags flags, CheckIt **checkp) |
518 |
static void press(Token *v , PressFlags flags) |
532 |
{ |
519 |
{ |
533 |
Input *idx; |
520 |
Input *idx; |
Lines 602-606
Link Here
|
602 |
{ |
589 |
{ |
603 |
case SEMI : |
590 |
case SEMI : |
604 |
if (flags && SEMIS) |
591 |
if (flags & SEMIS) |
605 |
{ |
592 |
{ |
606 |
output(&semiToken, 1); |
593 |
output(&semiToken, 1); |
Lines 641-645
Link Here
|
641 |
} |
628 |
} |
642 |
|
629 |
|
643 |
void etcetera(Token *cmd, int v) |
630 |
static void etcetera(Token *cmd, int v) |
644 |
{ |
631 |
{ |
645 |
while (cmd != noToken) |
632 |
while (cmd != noToken) |
Lines 650-654
Link Here
|
650 |
} |
637 |
} |
651 |
|
638 |
|
652 |
void catbin(Token *tp) |
639 |
static void catbin(Token *tp) |
653 |
{ |
640 |
{ |
654 |
int sem, oln; |
641 |
int sem, oln; |
Lines 693-697
Link Here
|
693 |
VarData *vp = (VarData *) 0; |
680 |
VarData *vp = (VarData *) 0; |
694 |
char msg[1024]; |
681 |
char msg[1024]; |
695 |
Token *ap = noToken, *ac; |
682 |
Token *ap = noToken; |
|
|
683 |
const Token *ac; |
696 |
int array = 0; |
684 |
int array = 0; |
697 |
|
685 |
|
Lines 829-833
Link Here
|
829 |
} |
817 |
} |
830 |
|
818 |
|
831 |
Token *doswitch(Token *cmd, Token *leadin) |
819 |
static Token *doswitch(Token *cmd, Token *leadin) |
832 |
{ |
820 |
{ |
833 |
Token *tp, *bod; |
821 |
Token *tp, *bod; |
Lines 952-956
Link Here
|
952 |
} |
940 |
} |
953 |
|
941 |
|
954 |
Token *doif(Token *cmd, Token *leadin) |
942 |
static Token *doif(Token *cmd, Token *leadin) |
955 |
{ |
943 |
{ |
956 |
Token *tp, *then; |
944 |
Token *tp, *then; |
Lines 964-968
Link Here
|
964 |
cfl |= SPACEOUT; |
952 |
cfl |= SPACEOUT; |
965 |
} |
953 |
} |
966 |
press(cmd, cfl, noChecks); |
954 |
press(cmd, cfl); |
967 |
if (putThen) { output(&thenToken, 0); } |
955 |
if (putThen) { output(&thenToken, 0); } |
968 |
then = cmd->next; |
956 |
then = cmd->next; |
Lines 980-984
Link Here
|
980 |
failIfNullToken(tp, "condition", "elseif", ln); |
968 |
failIfNullToken(tp, "condition", "elseif", ln); |
981 |
warnExpr(tp, "elseif condition not braced."); |
969 |
warnExpr(tp, "elseif condition not braced."); |
982 |
press(tp, efl | PAREN, noChecks); |
970 |
press(tp, efl | PAREN); |
983 |
tp = tp->next; |
971 |
tp = tp->next; |
984 |
failIfNullToken(tp, "body", "elseif", ln); |
972 |
failIfNullToken(tp, "body", "elseif", ln); |
Lines 1020-1026
Link Here
|
1020 |
|
1008 |
|
1021 |
|
1009 |
|
1022 |
int isNSName(Token *cmd) |
1010 |
static int isNSName(const Token *cmd) |
1023 |
{ |
1011 |
{ |
1024 |
char *cp; |
1012 |
const char *cp; |
1025 |
int cols = 0; |
1013 |
int cols = 0; |
1026 |
|
1014 |
|
Lines 1054-1058
Link Here
|
1054 |
} |
1042 |
} |
1055 |
|
1043 |
|
1056 |
static Token *doProc(Token *tag, Token *cmd, Token *leadin, int checkNS) |
1044 |
static Token *doProc(Token *tag, Token *cmd, Token *leadin) |
1057 |
{ |
1045 |
{ |
1058 |
int ln = leadin->lineNo, inns; |
1046 |
int ln = leadin->lineNo, inns; |
Lines 1177-1189
Link Here
|
1177 |
static Token *doproc(Token *cmd, Token *leadin) |
1165 |
static Token *doproc(Token *cmd, Token *leadin) |
1178 |
{ |
1166 |
{ |
1179 |
return doProc(&procToken, cmd, leadin, 1); |
1167 |
return doProc(&procToken, cmd, leadin); |
1180 |
} |
1168 |
} |
1181 |
|
1169 |
|
1182 |
static Token *domethod(Token *cmd, Token *leadin) |
1170 |
static Token *domethod(Token *cmd, Token *leadin) |
1183 |
{ |
1171 |
{ |
1184 |
return doProc(&methodToken, cmd, leadin, 0); |
1172 |
return doProc(&methodToken, cmd, leadin); |
1185 |
} |
1173 |
} |
1186 |
|
1174 |
|
1187 |
static Token *dodestructor(Token *cmd, Token *leadin) |
1175 |
static Token *dodestructor(Token *cmd, Token *leadin __attribute__((__unused__))) |
1188 |
{ |
1176 |
{ |
1189 |
if (!nest[0]) |
1177 |
if (!nest[0]) |
Lines 1200-1204
Link Here
|
1200 |
} |
1188 |
} |
1201 |
|
1189 |
|
1202 |
Token *doconstructor(Token *cmd, Token *leadin) |
1190 |
static Token *doconstructor(Token *cmd, Token *leadin __attribute__((__unused__))) |
1203 |
{ |
1191 |
{ |
1204 |
if (!nest[0]) |
1192 |
if (!nest[0]) |
Lines 1209-1213
Link Here
|
1209 |
{ |
1197 |
{ |
1210 |
failIfNullToken(cmd, "args", "constructor", 0); |
1198 |
failIfNullToken(cmd, "args", "constructor", 0); |
1211 |
press(cmd, NOBRACE | ADDBRACES, noChecks); |
1199 |
press(cmd, NOBRACE | ADDBRACES); |
1212 |
cmd = cmd->next; |
1200 |
cmd = cmd->next; |
1213 |
failIfNullToken(cmd, "body", "constructor", 0); |
1201 |
failIfNullToken(cmd, "body", "constructor", 0); |
Lines 1218-1222
Link Here
|
1218 |
} |
1206 |
} |
1219 |
|
1207 |
|
1220 |
Token *doreturn(Token *cmd, Token *leadin) |
1208 |
static Token *doreturn(Token *cmd, Token *leadin) |
1221 |
{ |
1209 |
{ |
1222 |
Blox *pr = (Blox *) lpeek(blocks); |
1210 |
Blox *pr = (Blox *) lpeek(blocks); |
Lines 1267-1271
Link Here
|
1267 |
} |
1255 |
} |
1268 |
|
1256 |
|
1269 |
Token *doregexp(Token *cmd, Token *leadin) |
1257 |
static Token *doregexp(Token *cmd, Token *leadin) |
1270 |
{ |
1258 |
{ |
1271 |
int eopt = 0; |
1259 |
int eopt = 0; |
Lines 1312-1316
Link Here
|
1312 |
} |
1300 |
} |
1313 |
|
1301 |
|
1314 |
Token *doregsub(Token *cmd, Token *leadin) |
1302 |
static Token *doregsub(Token *cmd, Token *leadin) |
1315 |
{ |
1303 |
{ |
1316 |
int eopt = 0; |
1304 |
int eopt = 0; |
Lines 1361-1365
Link Here
|
1361 |
} |
1349 |
} |
1362 |
|
1350 |
|
1363 |
Token *dobind(Token *cmd, Token *leadin) |
1351 |
static Token *dobind(Token *cmd, Token *leadin __attribute__((__unused__))) |
1364 |
{ |
1352 |
{ |
1365 |
Token *np; |
1353 |
Token *np; |
Lines 1387-1391
Link Here
|
1387 |
} |
1375 |
} |
1388 |
|
1376 |
|
1389 |
Token *doitcl_class(Token *cmd, Token *leadin) |
1377 |
static Token *doitcl_class(Token *cmd, Token *leadin __attribute__((__unused__))) |
1390 |
{ |
1378 |
{ |
1391 |
failIfNullToken(cmd, "className", "itcl_class", 0); |
1379 |
failIfNullToken(cmd, "className", "itcl_class", 0); |
Lines 1400-1404
Link Here
|
1400 |
} |
1388 |
} |
1401 |
|
1389 |
|
1402 |
Token *docvar(Token *cmd, Token *prt) |
1390 |
static Token *docvar(Token *cmd, Token *prt) |
1403 |
{ |
1391 |
{ |
1404 |
if (!nest[0]) |
1392 |
if (!nest[0]) |
Lines 1412-1416
Link Here
|
1412 |
if ((cmd = cmd->next) != noToken) |
1400 |
if ((cmd = cmd->next) != noToken) |
1413 |
{ |
1401 |
{ |
1414 |
press(cmd, NOBRACE | ADDBRACES, noChecks); |
1402 |
press(cmd, NOBRACE | ADDBRACES); |
1415 |
warnIfArgsAfter(cmd, "init", prt->text); |
1403 |
warnIfArgsAfter(cmd, "init", prt->text); |
1416 |
} |
1404 |
} |
Lines 1419-1423
Link Here
|
1419 |
} |
1407 |
} |
1420 |
|
1408 |
|
1421 |
Token *dopublic(Token *cmd, Token *leadin) |
1409 |
static Token *dopublic(Token *cmd, Token *leadin __attribute__((__unused__))) |
1422 |
{ |
1410 |
{ |
1423 |
if (!nest[0]) |
1411 |
if (!nest[0]) |
Lines 1431-1435
Link Here
|
1431 |
if ((cmd = cmd->next) != noToken) |
1419 |
if ((cmd = cmd->next) != noToken) |
1432 |
{ |
1420 |
{ |
1433 |
press(cmd, NOBRACE | ADDBRACES, noChecks); |
1421 |
press(cmd, NOBRACE | ADDBRACES); |
1434 |
if ((cmd = cmd->next) != noToken) |
1422 |
if ((cmd = cmd->next) != noToken) |
1435 |
{ |
1423 |
{ |
Lines 1442-1450
Link Here
|
1442 |
} |
1430 |
} |
1443 |
|
1431 |
|
1444 |
Token *doprotected(Token *cmd, Token *leadin) { return docvar(cmd, leadin); } |
1432 |
static Token *doprotected(Token *cmd, Token *leadin) { return docvar(cmd, leadin); } |
1445 |
|
1433 |
|
1446 |
Token *docommon(Token *cmd, Token *leadin) { return docvar(cmd, leadin); } |
1434 |
static Token *docommon(Token *cmd, Token *leadin) { return docvar(cmd, leadin); } |
1447 |
|
1435 |
|
1448 |
static void checkVar(Token *cmd, char *nm) |
1436 |
static void checkVar(Token *cmd, const char *nm) |
1449 |
{ |
1437 |
{ |
1450 |
List *bp = blocks; |
1438 |
List *bp = blocks; |
Lines 1525-1529
Link Here
|
1525 |
} |
1513 |
} |
1526 |
|
1514 |
|
1527 |
Token *doforeach(Token *cmd, Token *leadin) |
1515 |
static Token *doforeach(Token *cmd, Token *leadin __attribute__((__unused__))) |
1528 |
{ |
1516 |
{ |
1529 |
failIfNullToken(cmd, "varName", "foreach", 0); |
1517 |
failIfNullToken(cmd, "varName", "foreach", 0); |
Lines 1535-1539
Link Here
|
1535 |
cmd = cmd->next; |
1523 |
cmd = cmd->next; |
1536 |
failIfNullToken(cmd, "list", "foreach", 0); |
1524 |
failIfNullToken(cmd, "list", "foreach", 0); |
1537 |
press(cmd, NOBRACE, noChecks); |
1525 |
press(cmd, NOBRACE); |
1538 |
cmd = cmd->next; |
1526 |
cmd = cmd->next; |
1539 |
} |
1527 |
} |
Lines 1547-1551
Link Here
|
1547 |
} |
1535 |
} |
1548 |
|
1536 |
|
1549 |
Token *doloop(Token *cmd, Token *leadin) |
1537 |
static Token *doloop(Token *cmd, Token *leadin __attribute__((__unused__))) |
1550 |
{ |
1538 |
{ |
1551 |
Token *tp; |
1539 |
Token *tp; |
Lines 1557-1569
Link Here
|
1557 |
{ |
1545 |
{ |
1558 |
failIfNullToken(cmd, "var", "loop", 0); |
1546 |
failIfNullToken(cmd, "var", "loop", 0); |
1559 |
press(cmd, NOBRACE | ADDBRACES, noChecks); /* var */ |
1547 |
press(cmd, NOBRACE | ADDBRACES); /* var */ |
1560 |
tp = cmd->next; |
1548 |
tp = cmd->next; |
1561 |
failIfNullToken(tp, "first", "loop", 0); |
1549 |
failIfNullToken(tp, "first", "loop", 0); |
1562 |
warnExpr(cmd, "Unbracketed loop \"first\""); |
1550 |
warnExpr(cmd, "Unbracketed loop \"first\""); |
1563 |
press(tp, ADDBRACES, noChecks); /* first */ |
1551 |
press(tp, ADDBRACES); /* first */ |
1564 |
tp = tp->next; |
1552 |
tp = tp->next; |
1565 |
failIfNullToken(tp, "limit", "loop", 0); |
1553 |
failIfNullToken(tp, "limit", "loop", 0); |
1566 |
warnExpr(cmd, "Unbracketed loop \"limit\""); |
1554 |
warnExpr(cmd, "Unbracketed loop \"limit\""); |
1567 |
press(tp, ADDBRACES, noChecks); /* limit */ |
1555 |
press(tp, ADDBRACES); /* limit */ |
1568 |
|
1556 |
|
1569 |
tp = tp->next; |
1557 |
tp = tp->next; |
Lines 1573-1577
Link Here
|
1573 |
{ |
1561 |
{ |
1574 |
warnExpr(cmd, "Unbracketed loop \"incr\""); |
1562 |
warnExpr(cmd, "Unbracketed loop \"incr\""); |
1575 |
press(tp, NOBRACE | ADDBRACES, noChecks); /* incr */ |
1563 |
press(tp, NOBRACE | ADDBRACES); /* incr */ |
1576 |
tp = tp->next; |
1564 |
tp = tp->next; |
1577 |
} |
1565 |
} |
Lines 1585-1589
Link Here
|
1585 |
} |
1573 |
} |
1586 |
|
1574 |
|
1587 |
Token *doexpr(Token *cmd, Token *leadin) |
1575 |
static Token *doexpr(Token *cmd, Token *leadin __attribute__((__unused__))) |
1588 |
{ |
1576 |
{ |
1589 |
if (!doExpr) |
1577 |
if (!doExpr) |
Lines 1600-1604
Link Here
|
1600 |
{ |
1588 |
{ |
1601 |
warnExpr(cmd, "expr body not braced."); |
1589 |
warnExpr(cmd, "expr body not braced."); |
1602 |
press(cmd, ADDBRACES | PAREN, noChecks); /* */ |
1590 |
press(cmd, ADDBRACES | PAREN); /* */ |
1603 |
} |
1591 |
} |
1604 |
else |
1592 |
else |
Lines 1611-1615
Link Here
|
1611 |
} |
1599 |
} |
1612 |
|
1600 |
|
1613 |
Token *dounset(Token *cmd, Token *leadin) |
1601 |
static Token *dounset(Token *cmd, Token *leadin) |
1614 |
{ |
1602 |
{ |
1615 |
int pCount = 1; |
1603 |
int pCount = 1; |
Lines 1642-1646
Link Here
|
1642 |
} |
1630 |
} |
1643 |
|
1631 |
|
1644 |
Token *doupvar(Token *cmd, Token *leadin) |
1632 |
static Token *doupvar(Token *cmd, Token *leadin) |
1645 |
{ |
1633 |
{ |
1646 |
int paramCount = 0; |
1634 |
int paramCount = 0; |
Lines 1673-1677
Link Here
|
1673 |
} |
1661 |
} |
1674 |
|
1662 |
|
1675 |
Token *dovariable(Token *cmd, Token *leadin) |
1663 |
static Token *dovariable(Token *cmd, Token *leadin) |
1676 |
{ |
1664 |
{ |
1677 |
int paramCount = 1; |
1665 |
int paramCount = 1; |
Lines 1777-1781
Link Here
|
1777 |
} |
1765 |
} |
1778 |
|
1766 |
|
1779 |
void doBasic(ConfigData *cpt, Token *hd, Token *cmd) |
1767 |
static void doBasic(const ConfigData *cpt, Token *hd, Token *cmd) |
1780 |
{ |
1768 |
{ |
1781 |
List *sp, *llp, *lp; |
1769 |
List *sp, *llp, *lp; |
Lines 1851-1855
Link Here
|
1851 |
else |
1839 |
else |
1852 |
{ |
1840 |
{ |
1853 |
press(cmd, NOBRACE | ADDBRACES | SEMIS, noChecks); /* */ |
1841 |
press(cmd, NOBRACE | ADDBRACES | SEMIS); /* */ |
1854 |
} |
1842 |
} |
1855 |
break; |
1843 |
break; |
Lines 1863-1867
Link Here
|
1863 |
{ |
1851 |
{ |
1864 |
warnExpr(cmd, "Unbracketed expression"); |
1852 |
warnExpr(cmd, "Unbracketed expression"); |
1865 |
press(cmd, ptpar, noChecks); /* */ |
1853 |
press(cmd, ptpar); /* */ |
1866 |
} |
1854 |
} |
1867 |
break; |
1855 |
break; |
Lines 1884-1888
Link Here
|
1884 |
ptpar |= SPACEOUT; |
1872 |
ptpar |= SPACEOUT; |
1885 |
} |
1873 |
} |
1886 |
press(cmd, ptpar, noChecks); |
1874 |
press(cmd, ptpar); |
1887 |
loopstart(infloop, 1); |
1875 |
loopstart(infloop, 1); |
1888 |
} |
1876 |
} |
Lines 2141-2145
Link Here
|
2141 |
} |
2129 |
} |
2142 |
|
2130 |
|
2143 |
void doUser(Token *hd, Token *cmd, ConfigData *cpt, int nostart) |
2131 |
static void doUser(Token *hd, Token *cmd, |
|
|
2132 |
const ConfigData *cpt, int nostart) |
2144 |
{ |
2133 |
{ |
2145 |
if (isUnreachable()) |
2134 |
if (isUnreachable()) |