...
This class is responsible to translate parsed rule into objects in memory that represent the parsed syntax. Methods with name starting with make_
or add_
match custom actions as defined in TM1RuleGrammar.peg
(described later). These methods are called during parsing of the TM1 rule and are fed with data from the parser defined in TM1RuleGrammar.py
.
Let’s explain how the parser stores the parsed rule in memory on following example.
Note: The below code is a simplified rule content to demonstrate parsing and resulting representation in memory, it doesn’t represent a functional rule.
Code Block |
---|
SKIPCHECK;
FEEDSTRINGS;
#Expand-Area-Definition(ACT_YEARS, id_ACT_YEARS):'T Year':@mdx
#Region ACT_YEARS
[ 'T Month':'T Month':'M00', 'T Year':'T Year':'2023' ] =
N:0;
#EndRegion ACT_YEARS |
This rule will be parsed by the TM1RuleParser
method get_parse_tree
and the parsing result will be returned in an instance of TM1Splice.Parser.Grammar.TM1RuleGrammar.TreeNode
class. The class contains elements
property, which is a list of parsed tokens. You may see a simplified representation of the parsed rule on below picture.
...
ArgumentParser (class in ArgumentParser.py)
...