-
Notifications
You must be signed in to change notification settings - Fork 13
How to mark fields as arg, expr, field, value, option, and renamed
ParseTreeNodes have four new important keyword attributes:
arg
This is for clustering arguments to identify the kinds of underlaying data sets they refer to, and for correlating arguments with commands.
exprfieldoptionrenamedvaluevalues
These are for performing schema extraction from the queries.
In general, there are two kinds of parse rule constructs that are affected by these tags.
The first construct is x EQ y. This also applies to x NEQ y, x GT y, and so on. In these cases, x should be marked as option=True or field=True, if necessary. (All field and value rules will be updated to mark the corresponding ParseTreeNodes as fields and values accordingly in the common rules modules, so you only need to worry about this if, in your parser rules, you use value to parse what should be a field. In that case, be sure to update i.e., field=True; value=False. Also be sure to mark option nodes with option=True.) Also y should be marked with expr=True or value=True depending on whether y represents some function wrapping something or if it is just a value. Lastly, you should set the values of the node corresponding to x to contain the node corresponding to y if x is field or option e.g., values.append(<y's ParseTreeNode>).
The second construct is x as y. In this case, you should mark x as field or expr, depending on which it is, and y as field. If x is a field, you should also mark the corresponding node to have renamed = <y's ParseTreeNode>.