Class GenericNestedStructureHouseKeeper
- java.lang.Object
-
- com.scriptbasic.syntax.AbstractNestedStructureHouseKeeper
-
- com.scriptbasic.syntax.GenericNestedStructureHouseKeeper
-
- All Implemented Interfaces:
NestedStructureHouseKeeper
public final class GenericNestedStructureHouseKeeper extends AbstractNestedStructureHouseKeeper
This version just does not nothing special to recover from error.- Author:
- Peter Verhas date June 11, 2012
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.scriptbasic.syntax.AbstractNestedStructureHouseKeeper
AbstractNestedStructureHouseKeeper.Structure
-
-
Constructor Summary
Constructors Constructor Description GenericNestedStructureHouseKeeper(LexicalAnalyzer analyzer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends NestedStructure>
Tpop(java.lang.Class<T> expectedClass)Pops one element from the stack.-
Methods inherited from class com.scriptbasic.syntax.AbstractNestedStructureHouseKeeper
isStackIsHealthy, push, push
-
-
-
-
Constructor Detail
-
GenericNestedStructureHouseKeeper
public GenericNestedStructureHouseKeeper(LexicalAnalyzer analyzer)
-
-
Method Detail
-
pop
public <T extends NestedStructure> T pop(java.lang.Class<T> expectedClass) throws AnalysisException
Description copied from interface:NestedStructureHouseKeeperPops one element from the stack.Note that nested element have to be pushed on the stack nested. If we get an element off the stack that was not expected it means syntax error and therefore in this case exception is thrown.
When exception was thrown the functioning of the object is not defined by this interface. Some implementation may seek the appropriate element in the stack and throw off all top element until a proper type of element is found assuming that the user forgot to close some internal programming structured in the scripted language. Other implementations may follow more complex strategy to recover from such an error. In either case the sole reason of further syntax analysis is to discover as many syntax error as possible following the first one.
- Specified by:
popin interfaceNestedStructureHouseKeeper- Overrides:
popin classAbstractNestedStructureHouseKeeper- Type Parameters:
T- expected type of the element- Parameters:
expectedClass- the expected class of the element- Returns:
- the top element
- Throws:
AnalysisException- when the top element of the stack is not the type that we expect
-
-