Debugging a look-ahead

Top  Previous  Next

Examples > Java > Debugging a look-ahead

 

You can see what happens in detail when a look-ahead is tested, if you step into the look-ahead with the debugger. First you can put a breakpoint on the word "System" in the sixth line of the example text.

 

Java_breakpoint

 

 

The project then can be run up to this point. After another three single steps the "IF" is marked in the production "BlockStatement".

 

 

Java_IF

 

 

 

Now can step into the look-ahead. After a click on the corresponding button the debugger changes to the production "LocalVariableDeclaration" and a '1' is shown in the little field right next to the button.

 

Java_StepInLA

 

This means that the debugger is in the first level of a look-ahead now. This is indicated by a '1' with a gray background in front of the name of the production at the top of the stack in the window for the stack too.

 

Java_Stack

 

The debugger can be executed just the same as used for the main parser now within the look-ahead. Behind the word "println", however, the parser cannot continue: no following token is recognized. The look-ahead has failed and is left. The debugger again is in the production "BlockStatement" now but in the ELSE-branch of the IF-structure.

 

Java_ELSE

 

 

The field for the indication of the level of the look-ahead is empty, i.e. the debugger shows the progress in the main parser again.

 

Java_MainParser

 

 

 



This page belongs to the TextTransformer Documentation

Home  Content  German