Class: Electr::BaseRule

Inherits:
Object
  • Object
show all
Defined in:
lib/electr/parser/rules/base_rule.rb

Direct Known Subclasses

ExpressionRule, RootRule

Instance Method Summary collapse

Constructor Details

#initialize(units, ast_node) ⇒ BaseRule

Initialize a new rule. The units and ast_node objects given in arguments will be modified by #apply!.

units - Array of LexicalUnits. ast_node - An AST object, for adding children, etc.



10
11
12
13
14
# File 'lib/electr/parser/rules/base_rule.rb', line 10

def initialize(units, ast_node)
  @units = units
  @ast_node = ast_node
  @series = []
end

Instance Method Details

#apply!Object

Public: Apply the rule to the list of lexical units, creating and/or modifying the ast node. #apply! modify the units and ast_node objects given to #initialize.

Raises:

  • (NotImplementedError)


19
20
21
# File 'lib/electr/parser/rules/base_rule.rb', line 19

def apply!
  raise NotImplementedError
end