Unit CastleScriptParser
Description
Parser for CastleScript, along with high-level utilities like ParseConstantFloatExpression.
This can parse whole program in CastleScript language, is also prepared to parse only a single expression (usefull for cases when I need to input only a mathematical expression, like for glplotter function expression).
Uses
Overview
Functions and Procedures
function ParseFloatExpression(const S: string; const Variables: array of TCasScriptValue): TCasScriptExpression; |
function ParseIntExpression(const S: string; const Variables: array of TCasScriptValue): TCasScriptExpression; |
function ParseStringExpression(const S: string; const Variables: array of TCasScriptValue): TCasScriptExpression; |
function ParseBoolExpression(const S: string; const Variables: array of TCasScriptValue): TCasScriptExpression; |
function ParseExpression(const S: string; const Variables: array of TCasScriptValue): TCasScriptExpression; |
function ParseConstantFloatExpression(const S: string): Float; |
function ParseConstantIntExpression(const S: string): Int64; |
function ParseProgram(const S: string; const Variables: array of TCasScriptValue): TCasScriptProgram; overload; |
function ParseProgram(const S: string; const Variables: TCasScriptValueList): TCasScriptProgram; overload; |
Types
ECasScriptSyntaxError = CastleScriptLexer.ECasScriptSyntaxError; |
Description
Functions and Procedures
function ParseFloatExpression(const S: string; const Variables: array of TCasScriptValue): TCasScriptExpression; |
Parse a CastleScript expression that should be calculated to a float value. The easiest way to evaluate such expression is to call TCasScriptExpression.AsFloat method. This creates and returns an instance of TCasScriptExpression, that represents parsed tree of expression in S, casted to float. This parses a subset of CastleScript language, that allows you to define only one expression without any assignments. Also the end result is always casted to the float() type (just like it would be wrapped inside float() function call — in fact this is exactly what happens.) The end result is that this is perfect for describing things like function expressions, ideal e.g. for [https://castle-engine.io/glplotter_and_gen_function.php].
Parameters
Exceptions raised
|
function ParseIntExpression(const S: string; const Variables: array of TCasScriptValue): TCasScriptExpression; |
Parse a CastleScript expression that should be calculated to a float value. The easiest way to evaluate such expression is to call TCasScriptExpression.AsInt method. See ParseFloatExpression for more details, this procedure is equivalent but it operates on floats. |
function ParseStringExpression(const S: string; const Variables: array of TCasScriptValue): TCasScriptExpression; |
Parse a CastleScript expression that should be calculated to a string value. The easiest way to evaluate such expression is to call TCasScriptExpression.AsString method. See ParseFloatExpression for more details, this procedure is equivalent but it operates on strings. |
function ParseBoolExpression(const S: string; const Variables: array of TCasScriptValue): TCasScriptExpression; |
Parse a CastleScript expression that should be calculated to a boolean value. The easiest way to evaluate such expression is to call TCasScriptExpression.AsBool method. See ParseFloatExpression for more details, this procedure is equivalent but it operates on booleans. |
function ParseExpression(const S: string; const Variables: array of TCasScriptValue): TCasScriptExpression; |
Creates and returns instance of TCasScriptExpression, that represents parsed tree of expression in S. Parameters
Exceptions raised
|
function ParseConstantFloatExpression(const S: string): Float; |
Parse constant float expression. This can be used as a drop-in replacement for StrToFloatDot. Takes a string with any constant mathematical expression, according to CastleScript syntax, parses it and calculates. Exceptions raised
|
function ParseConstantIntExpression(const S: string): Int64; |
Parse constant Int64 expression. This can be used as a drop-in replacement for StrToInt. Takes a string with any constant mathematical expression, according to CastleScript syntax, parses it and calculates. Exceptions raised
|
function ParseProgram(const S: string; const Variables: array of TCasScriptValue): TCasScriptProgram; overload; |
Parse CastleScript program. Variable list works like for ParseFloatExpression, see there for description.
Exceptions raised
|
function ParseProgram(const S: string; const Variables: TCasScriptValueList): TCasScriptProgram; overload; |
This item has no description. |
Types
ECasScriptSyntaxError = CastleScriptLexer.ECasScriptSyntaxError; |
Error when parsing CastleScript expression. |
Generated by PasDoc 0.16.0-snapshot.