Merge pull request #532 from sharwell/codegen-fixes

Codegen fixes
This commit is contained in:
Terence Parr 2014-04-01 20:53:43 -07:00
commit 8e8a2dc303
1 changed files with 3 additions and 3 deletions

View File

@ -534,7 +534,7 @@ StarBlock(choice, alts, sync, iteration) ::= <<
setState(<choice.stateNumber>);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,<choice.decision>,_ctx);
while ( _alt!=<choice.exitAlt> && _alt!=-1 ) {
while ( _alt!=<choice.exitAlt> && _alt!=ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1<if(!choice.ast.greedy)>+1<endif> ) {
<iteration>
<alts> <! should only be one !>
@ -548,7 +548,7 @@ while ( _alt!=<choice.exitAlt> && _alt!=-1 ) {
PlusBlock(choice, alts, error) ::= <<
setState(<choice.blockStartStateNumber>); <! alt block decision !>
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,<choice.decision>,_ctx);
_alt = 1<if(!choice.ast.greedy)>+1<endif>;
do {
switch (_alt) {
<alts:{alt|
@ -561,7 +561,7 @@ case <i><if(!choice.ast.greedy)>+1<endif>:
setState(<choice.loopBackStateNumber>); <! loopback/exit decision !>
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,<choice.decision>,_ctx);
} while ( _alt!=<choice.exitAlt> && _alt!=-1 );
} while ( _alt!=<choice.exitAlt> && _alt!=ATN.INVALID_ALT_NUMBER );
>>
Sync(s) ::= "sync(<s.expecting.name>);"