Antlr4 - gated semantic predicates -


since antlr4 no longer supports gated semantic predicates, came workaround. however, if has run this, know if there caveats doing , following best practices.

i'm following standard 'c' if statement in form of: if (evaluation) { ...code block }

here code in code block:

if ($result == false) { // if statement evealuates false     // consume tokens until end of block marker     while (getcurrenttoken().gettext().compareto("}") != 0){         consume();     }      // set parser state if had executed tokens     _localctx.start = getcurrenttoken();     _ctx.start = getcurrenttoken();     setstate(220);      _errhandler.sync(this);     consume(); // consume end of block marker      return _localctx; // exit rule } 

i figure terrance parr must have had reason take out support gated semantic predicate , seems simple workaround. i'm wondering if i'm missing something.

i tested , works, 'else'. have not tried compound evaluation statements (ie conditions separated '&&' or '||'. have high confidence work though.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -