Class: BisonParser::Actions

Inherits:
Object
  • Object
show all
Defined in:
lib/bison_parser/actions.rb,
ext/bison_parser/bison_parser.c

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#parserObject

Returns the value of attribute parser.



3
4
5
# File 'lib/bison_parser/actions.rb', line 3

def parser
  @parser
end

#resultObject

Returns the value of attribute result.



3
4
5
# File 'lib/bison_parser/actions.rb', line 3

def result
  @result
end

Instance Method Details

#_0_components(sequence) ⇒ Object



53
54
55
# File 'lib/bison_parser/actions.rb', line 53

def _0_components(sequence)
  [sequence]
end

#_0_grammar_file(tokens, rules, code) ⇒ Object



5
6
7
# File 'lib/bison_parser/actions.rb', line 5

def _0_grammar_file(tokens, rules, code)
  self.result = Bison::GrammarFile.new(tokens, rules, code)
end

#_0_grammar_rule(name, components) ⇒ Object



49
50
51
# File 'lib/bison_parser/actions.rb', line 49

def _0_grammar_rule(name, components)
  Bison::Rule.new(name, components).tap{ |r| r.location = @name }
end

#_0_grammar_rulesObject



41
42
43
# File 'lib/bison_parser/actions.rb', line 41

def _0_grammar_rules()
  []
end

#_0_optional_codeObject



9
10
11
# File 'lib/bison_parser/actions.rb', line 9

def _0_optional_code()
  nil
end

#_0_sequenceObject



61
62
63
# File 'lib/bison_parser/actions.rb', line 61

def _0_sequence()
  Bison::Sequence.new
end

#_0_token(name) ⇒ Object



25
26
27
# File 'lib/bison_parser/actions.rb', line 25

def _0_token(name)
  Bison::Token.new(name)
end

#_0_token_listObject



17
18
19
# File 'lib/bison_parser/actions.rb', line 17

def _0_token_list()
  []
end

#_1_components(sequences, sequence) ⇒ Object



57
58
59
# File 'lib/bison_parser/actions.rb', line 57

def _1_components(sequences, sequence)
  sequences << sequence
end

#_1_grammar_rules(list, rule) ⇒ Object



45
46
47
# File 'lib/bison_parser/actions.rb', line 45

def _1_grammar_rules(list, rule)
  list << rule
end

#_1_optional_code(actions) ⇒ Object



13
14
15
# File 'lib/bison_parser/actions.rb', line 13

def _1_optional_code(actions)
  actions
end

#_1_sequence(sequence, code) ⇒ Object



65
66
67
# File 'lib/bison_parser/actions.rb', line 65

def _1_sequence(sequence, code)
  sequence << Bison::Action.new(code).tap{ |a| a.location = @code }
end

#_1_token(name) ⇒ Object



29
30
31
# File 'lib/bison_parser/actions.rb', line 29

def _1_token(name)
  Bison::Token.new(name, :left)
end

#_1_token_list(list, token) ⇒ Object



21
22
23
# File 'lib/bison_parser/actions.rb', line 21

def _1_token_list(list, token)
  list << token
end

#_2_sequence(sequence, follower) ⇒ Object



69
70
71
# File 'lib/bison_parser/actions.rb', line 69

def _2_sequence(sequence, follower)
  sequence << Bison::Nonterminal.new(follower).tap{ |x| x.location = @follower }
end

#_2_token(name) ⇒ Object



33
34
35
# File 'lib/bison_parser/actions.rb', line 33

def _2_token(name)
  Bison::Token.new(name, :right)
end

#_3_sequence(sequence, follower, tag) ⇒ Object



73
74
75
# File 'lib/bison_parser/actions.rb', line 73

def _3_sequence(sequence, follower, tag)
  sequence << Bison::Nonterminal.new(follower, tag).tap{ |x| x.location = @follower }
end

#_3_token(token, num) ⇒ Object



37
38
39
# File 'lib/bison_parser/actions.rb', line 37

def _3_token(token, num)
  token.tap{ |t| t.number = num }
end

#_4_sequence(sequence, follower) ⇒ Object



77
78
79
# File 'lib/bison_parser/actions.rb', line 77

def _4_sequence(sequence, follower)
  sequence << Bison::String.new(follower).tap{ |x| x.location = @follower }
end