Browse Source

fix brace style of conditionals

pull/10/head
nisstyre56 11 years ago
parent
commit
12b3eb58b2
  1. 21
      parse.js

21
parse.js

@ -77,26 +77,33 @@ function parseMany(parse, exprType, valid, tokens, charnum, linenum) {
//make sure there are at least 2 tokens to parse //make sure there are at least 2 tokens to parse
if (tokens.length > 1 && fst(tokens) && valid(fst(tokens))) { if (tokens.length > 1 && fst(tokens) && valid(fst(tokens))) {
while (valid(snd(tokens))) { while (valid(snd(tokens))) {
if (!(valid(fst(tokens)))) if (!(valid(fst(tokens)))) {
break; break;
}
results.push(parse(tokens)); results.push(parse(tokens));
if (!exprType(fst(results).exprType)) if (!exprType(fst(results).exprType)) {
break; break;
if (fst(tokens)) }
if (fst(tokens)) {
current = fst(tokens)[0]; current = fst(tokens)[0];
else }
else {
throw error.JSyntaxError(charnum, linenum, "Unexpected end of source"); throw error.JSyntaxError(charnum, linenum, "Unexpected end of source");
if (tokens.length <= 1) }
if (tokens.length <= 1) {
break; break;
}
} }
} }
//do the same validity check as before and in the loop //do the same validity check as before and in the loop
if (!fst(tokens)) if (!fst(tokens)) {
throw error.JSyntaxError(linenum, throw error.JSyntaxError(linenum,
charnum, charnum,
"unexpected end of source"); "unexpected end of source");
if (valid(fst(tokens))) }
if (valid(fst(tokens))) {
results.push(parse(tokens)); results.push(parse(tokens));
}
return results; return results;
} }

Loading…
Cancel
Save