Package gcodeCompiler
Class gcodeGrammarHandler
java.lang.Object
gcodeCompiler.gcodeGrammarHandler
public class gcodeGrammarHandler
extends java.lang.Object
This class is responsible for the management of the G-Code language.
-
Field Summary
Fields Modifier and Type Field Description java.util.SortedMap<java.lang.Integer,BlockDescriptor>blocksThe blocks.static intERR_ON_SYNTAXThe Constant ERR_ON_SYNTAX.(package private) java.util.List<GCodeError>errorListThe error list.private intlast_nThe last n.static intLAST_SYNTAX_ERRORThe Constant LAST_SYNTAX_ERROR.(package private) org.antlr.runtime.Tokenlast_tokenThe last token.(package private) org.antlr.runtime.TokenStreamlexerStreamThe lexer stream.static intSEM_BLOCK_ORDERThe Constant SEM_BLOCK_ORDER.static intSEM_DUPLICATE_ERRThe Constant SEM_DUPLICATE_ERR.static intSEM_END_ROT_ERRThe Constant SEM_END_ROT_ERR.static intSEM_JOB_SPEED_ERRThe Constant SEM_JOB_SPEED_ERR.static intSEM_MOVE_SPEED_ERRThe Constant SEM_MOVE_SPEED_ERR.static intSEM_NO_ABS_BEFORE_RELThe Constant SEM_NO_ABS_BEFORE_REL.static intSEM_NO_COORDINATE_TYPEThe Constant SEM_NO_COORDINATE_TYPE.static intSEM_NO_END_PROGThe Constant SEM_NO_END_PROG.static intSEM_NO_SPEED_COORD_TYPEThe Constant SEM_NO_SPEED_COORD_TYPE.static intSEM_NO_SPINDLE_ROTATIONThe Constant SEM_NO_SPINDLE_ROTATION.static intSEM_NOT_90_DEGREEThe Constant SEM_NOT_90_DEGREE.static intSEM_TOOL_ERRThe Constant SEM_TOOL_ERR.static intTOKEN_ERRORThe Constant TOKEN_ERROR.static intUNDEFINEDThe Constant UNDEFINED. -
Constructor Summary
Constructors Constructor Description gcodeGrammarHandler(org.antlr.runtime.TokenStream ls)Constructor of the gcodeGrammarHandler class. -
Method Summary
Modifier and Type Method Description private BlockDescriptorBlockInit(org.antlr.runtime.Token n, java.util.List<InfoGeometriche> info_g_list, java.util.List<InfoTecnologiche> info_t_list, java.util.List<InfoTecnologicheM> info_t_M_list)Block initialization method.voidcreateNewBlock(org.antlr.runtime.Token n, java.util.List<InfoGeometriche> info_g_list, java.util.List<InfoTecnologiche> info_t_list, java.util.List<InfoTecnologicheM> info_t_M_list)Method for creating a new G-Code block.java.util.List<GCodeError>getErrorList()Method that returns the G-Code error list.org.antlr.runtime.TokengetLast_token()Method that returns the last token in the list.(package private) voidhandleError(java.lang.String[] tokenNames, org.antlr.runtime.RecognitionException e, java.lang.String h, java.lang.String m)Method that handles lexical and syntactic errors.voidprintBlocks()Print function for the block list.voidsemanticErrorHandler(int code, org.antlr.runtime.Token tk, BlockDescriptor bd)Method that handles all semantic errors for G-Code.
-
Field Details
-
TOKEN_ERROR
public static final int TOKEN_ERRORThe Constant TOKEN_ERROR.- See Also:
- Constant Field Values
-
ERR_ON_SYNTAX
public static final int ERR_ON_SYNTAXThe Constant ERR_ON_SYNTAX.- See Also:
- Constant Field Values
-
SEM_BLOCK_ORDER
public static final int SEM_BLOCK_ORDERThe Constant SEM_BLOCK_ORDER.- See Also:
- Constant Field Values
-
SEM_NO_END_PROG
public static final int SEM_NO_END_PROGThe Constant SEM_NO_END_PROG.- See Also:
- Constant Field Values
-
SEM_TOOL_ERR
public static final int SEM_TOOL_ERRThe Constant SEM_TOOL_ERR.- See Also:
- Constant Field Values
-
SEM_NO_COORDINATE_TYPE
public static final int SEM_NO_COORDINATE_TYPEThe Constant SEM_NO_COORDINATE_TYPE.- See Also:
- Constant Field Values
-
SEM_NO_SPINDLE_ROTATION
public static final int SEM_NO_SPINDLE_ROTATIONThe Constant SEM_NO_SPINDLE_ROTATION.- See Also:
- Constant Field Values
-
SEM_DUPLICATE_ERR
public static final int SEM_DUPLICATE_ERRThe Constant SEM_DUPLICATE_ERR.- See Also:
- Constant Field Values
-
SEM_END_ROT_ERR
public static final int SEM_END_ROT_ERRThe Constant SEM_END_ROT_ERR.- See Also:
- Constant Field Values
-
SEM_MOVE_SPEED_ERR
public static final int SEM_MOVE_SPEED_ERRThe Constant SEM_MOVE_SPEED_ERR.- See Also:
- Constant Field Values
-
SEM_JOB_SPEED_ERR
public static final int SEM_JOB_SPEED_ERRThe Constant SEM_JOB_SPEED_ERR.- See Also:
- Constant Field Values
-
SEM_NO_SPEED_COORD_TYPE
public static final int SEM_NO_SPEED_COORD_TYPEThe Constant SEM_NO_SPEED_COORD_TYPE.- See Also:
- Constant Field Values
-
SEM_NO_ABS_BEFORE_REL
public static final int SEM_NO_ABS_BEFORE_RELThe Constant SEM_NO_ABS_BEFORE_REL.- See Also:
- Constant Field Values
-
SEM_NOT_90_DEGREE
public static final int SEM_NOT_90_DEGREEThe Constant SEM_NOT_90_DEGREE.- See Also:
- Constant Field Values
-
UNDEFINED
public static final int UNDEFINEDThe Constant UNDEFINED.- See Also:
- Constant Field Values
-
LAST_SYNTAX_ERROR
public static final int LAST_SYNTAX_ERRORThe Constant LAST_SYNTAX_ERROR.- See Also:
- Constant Field Values
-
blocks
The blocks. -
last_n
private int last_nThe last n. -
errorList
java.util.List<GCodeError> errorListThe error list. -
lexerStream
org.antlr.runtime.TokenStream lexerStreamThe lexer stream. -
last_token
org.antlr.runtime.Token last_tokenThe last token.
-
-
Constructor Details
-
gcodeGrammarHandler
public gcodeGrammarHandler(org.antlr.runtime.TokenStream ls)Constructor of the gcodeGrammarHandler class.- Parameters:
ls- the ls
-
-
Method Details
-
createNewBlock
public void createNewBlock(org.antlr.runtime.Token n, java.util.List<InfoGeometriche> info_g_list, java.util.List<InfoTecnologiche> info_t_list, java.util.List<InfoTecnologicheM> info_t_M_list)Method for creating a new G-Code block.- Parameters:
n- the ninfo_g_list- the info g listinfo_t_list- the info t listinfo_t_M_list- the info t M list
-
BlockInit
private BlockDescriptor BlockInit(org.antlr.runtime.Token n, java.util.List<InfoGeometriche> info_g_list, java.util.List<InfoTecnologiche> info_t_list, java.util.List<InfoTecnologicheM> info_t_M_list)Block initialization method.- Parameters:
n- the ninfo_g_list- the info g listinfo_t_list- the info t listinfo_t_M_list- the info t M list- Returns:
- the built block
-
printBlocks
public void printBlocks()Print function for the block list. -
getErrorList
Method that returns the G-Code error list.- Returns:
- the G-Code error list
-
handleError
void handleError(java.lang.String[] tokenNames, org.antlr.runtime.RecognitionException e, java.lang.String h, java.lang.String m)Method that handles lexical and syntactic errors.- Parameters:
tokenNames- the token namese- the eh- the hm- the m
-
semanticErrorHandler
Method that handles all semantic errors for G-Code.- Parameters:
code- the codetk- the tkbd- the bd
-
getLast_token
public org.antlr.runtime.Token getLast_token()Method that returns the last token in the list.- Returns:
- the last token
-