Skip to main content

GenerateTokens

getInput

getInput(expression, index, ops) => InputToken

Extracts the input name from an expression starting at a certain location.

Parameters

  •  expression: string – The expression to extract the input name from.

  •  index: number – The index at which the input starts.

  •  ops: OperatorFormat – The representation format for the operations used in this expression.

Returns

  •   InputToken – An InputToken with the input name in it.

getToken

getToken(expression, index, ops) => OpToken | InputToken

Gets a token from a given expression starting at a certain index.

Parameters

  •  expression: string – The expression to extract the token from.

  •  index: number – The index where the token starts.

  •  ops: OperatorFormat – The representation format for the operations used in this expression.

Returns

  •   OpToken | InputToken – The token extracted from the expression or null if the index points to the starting location of a separator (like " ").

GenerateTokens

GenerateTokens(expression, ops) => (OpToken | InputToken)[]

Converts the given expression to an array of tokens.

Parameters

  •  expression: string – The expression to convert.

  •  ops: OperatorFormat – The representation format for the operations used in this expression.

Returns

  •   (OpToken | InputToken)[] – A list of tokens that represent the given expression.