| Extracted from Pike v7.8 release 866 at 2018-07-18.

[Top]
Parser
Parser.LR
Parser.LR.Rule

# Class Parser.LR.Rule

Description

  This object is used to represent a BNF-rule in the LR parser.

Variable nonterminal

  `int Parser.LR.Rule.nonterminal`

Description

  Non-terminal this rule reduces to.

Variable symbols

  `array(string|int) Parser.LR.Rule.symbols`

Description

  The actual rule

Variable action

  `function|string Parser.LR.Rule.action`

Description

  Action to do when reducing this rule. function - call this function. string - call this function by name in the object given to the parser. The function is called with arguments corresponding to the values of the elements of the rule. The return value of the function will be the value of this non-terminal. The default rule is to return the first argument.

Variable has_tokens

  `int Parser.LR.Rule.has_tokens`

Description

  This rule contains tokens

Variable num_nonnullables

  `int Parser.LR.Rule.num_nonnullables`

Description

  This rule has this many non-nullable symbols at the moment.

Variable number

  `int Parser.LR.Rule.number`

Description

  Sequence number of this rule (used for conflict resolving) Also used to identify the rule.

Variable pri

  `Priority Parser.LR.Rule.pri`

Description

  Priority and associativity of this rule.