Added foreach in grammar.

This commit is contained in:
Jack Conradson 2016-05-27 13:50:38 -07:00
parent fbd3f8df2b
commit 2d8030f09f
4 changed files with 388 additions and 324 deletions

View File

@ -33,6 +33,7 @@ statement
| WHILE LP expression RP ( trailer | empty ) # while
| DO block WHILE LP expression RP delimiter # do
| FOR LP initializer? SEMICOLON expression? SEMICOLON afterthought? RP ( trailer | empty ) # for
| FOR LP decltype ID COLON expression RP trailer # each
| declaration delimiter # decl
| CONTINUE delimiter # continue
| BREAK delimiter # break

View File

@ -46,6 +46,13 @@ class PainlessParserBaseVisitor<T> extends AbstractParseTreeVisitor<T> implement
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitFor(PainlessParser.ForContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitEach(PainlessParser.EachContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*

View File

@ -44,6 +44,13 @@ interface PainlessParserVisitor<T> extends ParseTreeVisitor<T> {
* @return the visitor result
*/
T visitFor(PainlessParser.ForContext ctx);
/**
* Visit a parse tree produced by the {@code each}
* labeled alternative in {@link PainlessParser#statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitEach(PainlessParser.EachContext ctx);
/**
* Visit a parse tree produced by the {@code decl}
* labeled alternative in {@link PainlessParser#statement}.