Class: Antlr4ruby::Parser

Inherits:
Recognizer show all
Defined in:
lib/antlr4ruby/parser.rb

Direct Known Subclasses

ParserInterpreter

Constant Summary

Constants inherited from Recognizer

Recognizer::EOF

Instance Method Summary collapse

Methods inherited from Recognizer

#action, #add_error_listener, #get_atn, #get_error_header, #get_error_listener_dispatch, #get_error_listeners, #get_grammar_file_name, #get_interpreter, #get_rule_index_map, #get_rule_names, #get_serialized_atn, #get_state, #get_token_names, #get_token_type, #get_token_type_map, #get_vocabulary, #remove_error_listener, #remove_error_listeners, #sempred, #set_interpreter, #set_state

Constructor Details

#initialize(input) ⇒ Parser

Returns a new instance of Parser.



4
5
6
7
# File 'lib/antlr4ruby/parser.rb', line 4

def initialize(input)
  super()
  set_input_stream(input)
end

Instance Method Details

#add_contex_to_parse_treeObject



127
128
129
# File 'lib/antlr4ruby/parser.rb', line 127

def add_contex_to_parse_tree
  # todo
end

#add_parse_listener(listener) ⇒ Object



52
53
54
# File 'lib/antlr4ruby/parser.rb', line 52

def add_parse_listener(listener)
  # todo
end

#consumeObject



119
120
121
# File 'lib/antlr4ruby/parser.rb', line 119

def consume
  # todo
end

#create_terminal_node(parent, token) ⇒ Object



123
124
125
# File 'lib/antlr4ruby/parser.rb', line 123

def create_terminal_node(parent, token)
  # todo
end

#dump_dfaObject



205
206
207
# File 'lib/antlr4ruby/parser.rb', line 205

def dump_dfa
  # todo
end

#enter_recursion_rule(localctx, state, rule_index, precedence) ⇒ Object



141
142
143
# File 'lib/antlr4ruby/parser.rb', line 141

def enter_recursion_rule(localctx, state, rule_index, precedence)
  # todo
end

#enter_rule(localctx, state, rule_index) ⇒ Object



131
132
133
# File 'lib/antlr4ruby/parser.rb', line 131

def enter_rule(localctx, state, rule_index)
  # todo
end

#get_atn_with_bypass_altsObject



76
77
78
# File 'lib/antlr4ruby/parser.rb', line 76

def get_atn_with_bypass_alts
  # todo
end

#get_build_parse_treeObject



42
43
44
# File 'lib/antlr4ruby/parser.rb', line 42

def get_build_parse_tree
  @build_parse_trees
end

#get_contextObject



157
158
159
# File 'lib/antlr4ruby/parser.rb', line 157

def get_context
  @ctx
end

#get_current_tokenObject



108
109
110
# File 'lib/antlr4ruby/parser.rb', line 108

def get_current_token
  input.lt(1)
end

#get_dfa_stringsObject



201
202
203
# File 'lib/antlr4ruby/parser.rb', line 201

def get_dfa_strings
  # todo
end

#get_error_handlerObject

compile_parse_tree_pattern 不要



82
83
84
# File 'lib/antlr4ruby/parser.rb', line 82

def get_error_handler
  @err_handler
end

#get_expected_tokensObject



180
181
182
# File 'lib/antlr4ruby/parser.rb', line 180

def get_expected_tokens
  # todo
end

#get_expected_tokens_within_current_ruleObject



184
185
186
# File 'lib/antlr4ruby/parser.rb', line 184

def get_expected_tokens_within_current_rule
  # todo
end

#get_input_streamObject



94
95
96
# File 'lib/antlr4ruby/parser.rb', line 94

def get_input_stream
  get_token_stream
end

#get_invoking_context(rule_index) ⇒ Object



153
154
155
# File 'lib/antlr4ruby/parser.rb', line 153

def get_invoking_context(rule_index)
  # todo
end

#get_parse_infoObject



213
214
215
# File 'lib/antlr4ruby/parser.rb', line 213

def get_parse_info
  # todo
end

#get_parse_listenersObject

不要 set_trim_parse_tree get_trim_parse_tree



48
49
50
# File 'lib/antlr4ruby/parser.rb', line 48

def get_parse_listeners
  # todo
end

#get_precedenceObject

不要 enterOuterAlt



137
138
139
# File 'lib/antlr4ruby/parser.rb', line 137

def get_precedence
  # todo
end

#get_rule_contextObject



192
193
194
# File 'lib/antlr4ruby/parser.rb', line 192

def get_rule_context
  @ctx
end

#get_rule_index(rule_name) ⇒ Object



188
189
190
# File 'lib/antlr4ruby/parser.rb', line 188

def get_rule_index(rule_name)
  # todo
end

#get_rule_invocation_stack(rule_context) ⇒ Object



196
197
198
199
# File 'lib/antlr4ruby/parser.rb', line 196

def get_rule_invocation_stack(rule_context)
  # rule_context = rule_context || ctx
  # todo
end

#get_source_nameObject



209
210
211
# File 'lib/antlr4ruby/parser.rb', line 209

def get_source_name
  input.get_source_name
end

#get_syntax_error_countObject



64
65
66
# File 'lib/antlr4ruby/parser.rb', line 64

def get_syntax_error_count
  @syntax_errors
end

#get_token_factoryObject



68
69
70
# File 'lib/antlr4ruby/parser.rb', line 68

def get_token_factory
  input.get_token_source.get_token_factory
end

#get_token_streamObject



90
91
92
# File 'lib/antlr4ruby/parser.rb', line 90

def get_token_stream
  @input
end

#is_expected_token(symbol) ⇒ Object

不要 in_context



172
173
174
# File 'lib/antlr4ruby/parser.rb', line 172

def is_expected_token(symbol)
  # todo
end

#is_matched_eof?Boolean

Returns:

  • (Boolean)


176
177
178
# File 'lib/antlr4ruby/parser.rb', line 176

def is_matched_eof?
  @matched_eof
end

#match(token_type) ⇒ Object



30
31
32
# File 'lib/antlr4ruby/parser.rb', line 30

def match(token_type)
  # todo
end

#match_wildcardObject



34
35
36
# File 'lib/antlr4ruby/parser.rb', line 34

def match_wildcard
  # todo
end

#notify_error_listeners(msg, token, e) ⇒ Object



112
113
114
115
116
117
# File 'lib/antlr4ruby/parser.rb', line 112

def notify_error_listeners(msg, token, e)
  unless  token
    token = get_current_token
  end
  # todo
end

#precpred(localctx, precedence) ⇒ Object



165
166
167
168
# File 'lib/antlr4ruby/parser.rb', line 165

def precpred(localctx, precedence)
  # todo
  # precedence >= @precedence_stack.peek()
end

#push_new_recursion_context(localctx, state, rule_index) ⇒ Object



145
146
147
# File 'lib/antlr4ruby/parser.rb', line 145

def push_new_recursion_context(localctx, state, rule_index)
  # todo
end

#remove_parse_listener(listener) ⇒ Object



56
57
58
# File 'lib/antlr4ruby/parser.rb', line 56

def remove_parse_listener(listener)
  # todo
end

#remove_parse_listenersObject



60
61
62
# File 'lib/antlr4ruby/parser.rb', line 60

def remove_parse_listeners
  listeners.clear
end

#resetObject



26
27
28
# File 'lib/antlr4ruby/parser.rb', line 26

def reset
  # todo
end

#set_build_parse_tree(build_parse_trees) ⇒ Object



38
39
40
# File 'lib/antlr4ruby/parser.rb', line 38

def set_build_parse_tree(build_parse_trees)
  @build_parse_trees = build_parse_trees
end

#set_context(ctx) ⇒ Object



161
162
163
# File 'lib/antlr4ruby/parser.rb', line 161

def set_context(ctx)
  @ctx = ctx
end

#set_error_handler(handler) ⇒ Object



86
87
88
# File 'lib/antlr4ruby/parser.rb', line 86

def set_error_handler(handler)
  @err_handler = handler
end

#set_input_stream(input) ⇒ Object



104
105
106
# File 'lib/antlr4ruby/parser.rb', line 104

def set_input_stream(input)
  set_token_stream(input)
end

#set_profile(profile) ⇒ Object



217
218
219
# File 'lib/antlr4ruby/parser.rb', line 217

def set_profile(profile)
  # todo
end

#set_token_factory(factory) ⇒ Object



72
73
74
# File 'lib/antlr4ruby/parser.rb', line 72

def set_token_factory(factory)
  input.get_token_source.set_token_factory(factory)
end

#set_token_stream(input) ⇒ Object



98
99
100
101
102
# File 'lib/antlr4ruby/parser.rb', line 98

def set_token_stream(input)
  @input = nil
  reset
  @input = input
end

#unroll_recursion_contexts(parent) ⇒ Object



149
150
151
# File 'lib/antlr4ruby/parser.rb', line 149

def unroll_recursion_contexts(parent)
  # todo
end