SMC_NCTokenizer (FB)

 

FUNCTION_BLOCK SMC_NCTokenizer

Reads a CNC program from an SMC_ITextStream and converts it into a SMC_TokenQueue of SMC_Token, which ultimately will be processed by SMC_ReadNCTokens. Delimiters for tokens of type string, comment and variable can be reconfigured using the method SMC_NCTo­kenizer.SetDelimiters.

InOut:

Scope

Name

Type

Initial

Comment

Input

bExecute

BOOL

Rising edge: Starts operation. While TRUE, the function block is active.

stream

SMC_ITextStream

Stream to read the CNC program from; e.g. might be a file stream

paTokensBuffer

POINTER TO ARRAY [0..0] OF SMC_Token

Buffer for SMC_TokenQueue

udiTokensBufferSize

UDINT

Length of buffer for SMC_TokenQueue

bEnableSyntaxChecks

BOOL

Report an error in case of syntax error, if TRUE Skips the erroneous token, if FALSE

bResetDelimiterConfig

BOOL

TRUE

If TRUE the delimiters set via SetDelimiters will be overwritten with defaults with rising edge at Execute. If you already configured an alternative delimiters configuration before, you might want to set this to FALSE int order to keep it.

Output

bDone

BOOL

TRUE: The input stream has been processed completely.

bBusy

BOOL

FALSE: The FB hasn't finished processing the input stream yet.

bError

BOOL

TRUE: An error occured. ErrorID provides additional information.

ErrorID

SMC_ERROR

In case of normal operation SMC_Error.SMC_NO_ERROR, otherwise the ID of the occured error.

tokens

SMC_TokenQueue

Tokens queue generated from the input stream