public Parser(Reader r, String sourceName, int line) throws IOException { super(r, sourceName, line); }
/** for debugging */
- public static void main(String[] s) throws Exception {
+ public static void main(String[] s) throws IOException {
JS block = JS.fromReader("stdin", 0, new InputStreamReader(System.in));
if (block == null) return;
System.out.println(block);
int i = 0;
if (peekToken() != RB)
while(true) { // iterate over the initialization values
- int size = b.size;
b.add(parserLine, LITERAL, JS.N(i++)); // push the index in the array to place it into
if (peekToken() == COMMA || peekToken() == RB)
b.add(parserLine, LITERAL, null); // for stuff like [1,,2,]
// attempt to continue the expression
continueExpr(b, minPrecedence);
}
-
+ /*
private Grammar parseGrammar(Grammar g) throws IOException {
int tok = getToken();
if (g != null)
if (g == null) return parseGrammar(g0);
return parseGrammar(new Grammar.Juxtaposition(g, g0));
}
-
+ */
/**
* Assuming that a complete assignable (lvalue) has just been
* parsed and the object and key are on the stack,
// force the default case
tok = -1;
switch(tok) {
-
+ /*
case GRAMMAR: {
b.add(parserLine, GET_PRESERVE);
Grammar g = parseGrammar(null);
b.add(parserLine, PUT);
break;
}
-
+ */
case ASSIGN_BITOR: case ASSIGN_BITXOR: case ASSIGN_BITAND: case ASSIGN_LSH: case ASSIGN_RSH: case ASSIGN_URSH:
case ASSIGN_MUL: case ASSIGN_DIV: case ASSIGN_MOD: case ASSIGN_ADD: case ASSIGN_SUB: case ADD_TRAP: case DEL_TRAP: {
if (tok != ADD_TRAP && tok != DEL_TRAP) b.add(parserLine, GET_PRESERVE);
startExpr(b, precedence[tok]);
- int size = b.size;
-
if (tok != ADD_TRAP && tok != DEL_TRAP) {
// tok-1 is always s/^ASSIGN_// (0 is BITOR, 1 is ASSIGN_BITOR, etc)
b.add(parserLine, tok - 1, tok-1==ADD ? JS.N(2) : null);
if (peekToken() != RP) {
// extended Ibex catch block: catch(e faultCode "foo.bar.baz")
consume(NAME);
- String propName = string;
b.add(parserLine, DUP);
b.add(parserLine, LITERAL, string);
b.add(parserLine, GET);