Package net.sf.smc
Class SmcSyntaxChecker
- java.lang.Object
-
- net.sf.smc.model.SmcVisitor
-
- net.sf.smc.SmcSyntaxChecker
-
public final class SmcSyntaxChecker extends SmcVisitor
Performs a global syntax check on the various elements of the abstract syntax tree. This includes:- Verifying that a start state has been specified and that the state exists.
- If this is C++ code generation that a header file is specified
-
If this is Java code generation that the .sm fle and the
context class have the same name.
(Note: Removed as of v. 6.1.0 due to addition of %fsmclass feature). - If this is TCL code generation that argument parameter types are eith value or reerence.
- That if a transition is defined multiple times within the same state that each transition definition has a unique guard.
- That transition end states are valid states (the state exists and is not the Default state).
- Author:
- Charles Rapp
- See Also:
SmcElement
-
-
Constructor Summary
Constructors Constructor Description SmcSyntaxChecker(String fsm, TargetLanguage targetLanguage)Creates a syntax checker for the named FSM and target programming language.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<SmcMessage>getMessages()Returns a list of warning and error messages.booleanisValid()Returnstrueif no errors were found andfalseif there are syntax errors.voidvisit(SmcFSM fsm)Verifies that the context class and source files exist.voidvisit(SmcGuard guard)Checks if the guard has a valid end state.voidvisit(SmcMap map)Checks the map's states.voidvisit(SmcParameter parameter)Checks if the parameter types are acceptable.voidvisit(SmcState state)Checks if the state's transitions contain valid end states.voidvisit(SmcTransition transition)Checks the transition guards.-
Methods inherited from class net.sf.smc.model.SmcVisitor
visit
-
-
-
-
Constructor Detail
-
SmcSyntaxChecker
public SmcSyntaxChecker(String fsm, TargetLanguage targetLanguage)
Creates a syntax checker for the named FSM and target programming language.- Parameters:
fsm- the finite state machine's name.targetLanguage- the target programming language.
-
-
Method Detail
-
isValid
public boolean isValid()
Returnstrueif no errors were found andfalseif there are syntax errors.- Returns:
trueif no errors were found andfalseif there are syntax errors.
-
getMessages
public List<SmcMessage> getMessages()
Returns a list of warning and error messages.- Returns:
- a list of warning and error messages.
-
visit
public void visit(SmcFSM fsm)
Verifies that the context class and source files exist.- Overrides:
visitin classSmcVisitor- Parameters:
fsm- verify this FSM instance.
-
visit
public void visit(SmcMap map)
Checks the map's states.- Overrides:
visitin classSmcVisitor- Parameters:
map- verify this FSM map.
-
visit
public void visit(SmcState state)
Checks if the state's transitions contain valid end states.- Overrides:
visitin classSmcVisitor- Parameters:
state- verify this FSM state.
-
visit
public void visit(SmcTransition transition)
Checks the transition guards.- Overrides:
visitin classSmcVisitor- Parameters:
transition- check this FSM transition.
-
visit
public void visit(SmcGuard guard)
Checks if the guard has a valid end state.- Overrides:
visitin classSmcVisitor- Parameters:
guard- verify this FSM guard.
-
visit
public void visit(SmcParameter parameter)
Checks if the parameter types are acceptable.- Overrides:
visitin classSmcVisitor- Parameters:
parameter- verify this FSM parameter.
-
-