Class: Antlr4ruby::Lexer
Abstract
Overview
Constant Summary
collapse
- DEFAULT_MODE =
0
- MORE =
-2
- SKIP =
-3
- DEFAULT_TOKEN_CHANNEL =
Token::DEFAULT_CHANNEL
- HIDDEN =
Token::HIDDEN_CHANNEL
- MIN_CHAR_VALUE =
0x0000
- MAX_CHAR_VALUE =
0x10ffff
Constants inherited
from Recognizer
Recognizer::EOF
Instance Attribute Summary collapse
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_parse_info, #get_rule_index_map, #get_rule_names, #get_serialized_atn, #get_state, #get_token_names, #get_token_type, #get_token_type_map, #get_vocabulary, #precpred, #remove_error_listener, #remove_error_listeners, #sempred, #set_interpreter, #set_state
Constructor Details
#initialize(input) ⇒ Lexer
Returns a new instance of Lexer.
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/antlr4ruby/lexer.rb', line 21
def initialize(input)
super()
@token_start_char_index = -1
@mode = Lexer.DEFAULT_MODE
@mode_stack = IntegerStack.new
if input
@input = input
@token_factory_source_pair = Pair.new(self, input)
end
end
|
Instance Attribute Details
#channel ⇒ Object
Returns the value of attribute channel.
17
18
19
|
# File 'lib/antlr4ruby/lexer.rb', line 17
def channel
@channel
end
|
#hit_eof ⇒ Object
Returns the value of attribute hit_eof.
17
18
19
|
# File 'lib/antlr4ruby/lexer.rb', line 17
def hit_eof
@hit_eof
end
|
Returns the value of attribute input.
17
18
19
|
# File 'lib/antlr4ruby/lexer.rb', line 17
def input
@input
end
|
#mode ⇒ Object
Returns the value of attribute mode.
17
18
19
|
# File 'lib/antlr4ruby/lexer.rb', line 17
def mode
@mode
end
|
#mode_stack ⇒ Object
Returns the value of attribute mode_stack.
17
18
19
|
# File 'lib/antlr4ruby/lexer.rb', line 17
def mode_stack
@mode_stack
end
|
#text ⇒ Object
Returns the value of attribute text.
17
18
19
|
# File 'lib/antlr4ruby/lexer.rb', line 17
def text
@text
end
|
#token ⇒ Object
Returns the value of attribute token.
17
18
19
|
# File 'lib/antlr4ruby/lexer.rb', line 17
def token
@token
end
|
#token_start_char_index ⇒ Object
Returns the value of attribute token_start_char_index.
17
18
19
|
# File 'lib/antlr4ruby/lexer.rb', line 17
def token_start_char_index
@token_start_char_index
end
|
#token_start_line ⇒ Object
Returns the value of attribute token_start_line.
17
18
19
|
# File 'lib/antlr4ruby/lexer.rb', line 17
def token_start_line
@token_start_line
end
|
#type ⇒ Object
Returns the value of attribute type.
17
18
19
|
# File 'lib/antlr4ruby/lexer.rb', line 17
def type
@type
end
|
Instance Method Details
#emit(token) ⇒ Object
63
64
65
|
# File 'lib/antlr4ruby/lexer.rb', line 63
def emit(token)
end
|
#emit_eof ⇒ Object
67
68
69
|
# File 'lib/antlr4ruby/lexer.rb', line 67
def emit_eof
end
|
#get_all_tokens ⇒ Object
123
124
125
|
# File 'lib/antlr4ruby/lexer.rb', line 123
def get_all_tokens
end
|
#get_channel ⇒ Object
111
112
113
|
# File 'lib/antlr4ruby/lexer.rb', line 111
def get_channel
@channel
end
|
#get_channel_names ⇒ Object
115
116
117
|
# File 'lib/antlr4ruby/lexer.rb', line 115
def get_channel_names
[]
end
|
#get_char_error_display(c) ⇒ Object
139
140
141
|
# File 'lib/antlr4ruby/lexer.rb', line 139
def get_char_error_display(c)
end
|
#get_char_index ⇒ Object
79
80
81
|
# File 'lib/antlr4ruby/lexer.rb', line 79
def get_char_index
end
|
#get_char_position_in_line ⇒ Object
172
173
174
|
# File 'lib/antlr4ruby/lexer.rb', line 172
def get_char_position_in_line
end
|
#get_error_display(s) ⇒ Object
135
136
137
|
# File 'lib/antlr4ruby/lexer.rb', line 135
def get_error_display(s)
end
|
164
165
166
|
# File 'lib/antlr4ruby/lexer.rb', line 164
def get_input_stream
end
|
#get_line ⇒ Object
168
169
170
|
# File 'lib/antlr4ruby/lexer.rb', line 168
def get_line
end
|
#get_mode_names ⇒ Object
119
120
121
|
# File 'lib/antlr4ruby/lexer.rb', line 119
def get_mode_names
[]
end
|
#get_source_name ⇒ Object
160
161
162
|
# File 'lib/antlr4ruby/lexer.rb', line 160
def get_source_name
end
|
#get_text ⇒ Object
83
84
85
|
# File 'lib/antlr4ruby/lexer.rb', line 83
def get_text
end
|
#get_token ⇒ Object
91
92
93
|
# File 'lib/antlr4ruby/lexer.rb', line 91
def get_token
@token
end
|
#get_token_factory ⇒ Object
152
153
154
|
# File 'lib/antlr4ruby/lexer.rb', line 152
def get_token_factory
end
|
#get_type ⇒ Object
103
104
105
|
# File 'lib/antlr4ruby/lexer.rb', line 103
def get_type
@type
end
|
#more ⇒ Object
45
46
47
|
# File 'lib/antlr4ruby/lexer.rb', line 45
def more
@type = more
end
|
#next_token ⇒ Object
144
145
146
|
# File 'lib/antlr4ruby/lexer.rb', line 144
def next_token
end
|
#notify_listeners(e) ⇒ Object
131
132
133
|
# File 'lib/antlr4ruby/lexer.rb', line 131
def notify_listeners(e)
end
|
#pop_mode ⇒ Object
不能定义 mode 函数,会覆盖掉 attr_accessor def mode(m)
@mode = m
end
54
55
56
|
# File 'lib/antlr4ruby/lexer.rb', line 54
def pop_mode
end
|
#push_mode(m) ⇒ Object
58
59
60
61
|
# File 'lib/antlr4ruby/lexer.rb', line 58
def push_mode(m)
p "push_mode #{m}" if LexerATNSimulator.debug
end
|
#recover(e) ⇒ Object
127
128
129
|
# File 'lib/antlr4ruby/lexer.rb', line 127
def recover(e)
end
|
#reset ⇒ Object
37
38
39
|
# File 'lib/antlr4ruby/lexer.rb', line 37
def reset
end
|
#set_channel(channel) ⇒ Object
107
108
109
|
# File 'lib/antlr4ruby/lexer.rb', line 107
def set_channel(channel)
@channel = channel
end
|
#set_char_position_in_line(position) ⇒ Object
75
76
77
|
# File 'lib/antlr4ruby/lexer.rb', line 75
def set_char_position_in_line(position)
end
|
156
157
158
|
# File 'lib/antlr4ruby/lexer.rb', line 156
def set_input_stream(input)
end
|
#set_line(line) ⇒ Object
71
72
73
|
# File 'lib/antlr4ruby/lexer.rb', line 71
def set_line(line)
end
|
#set_text(text) ⇒ Object
87
88
89
|
# File 'lib/antlr4ruby/lexer.rb', line 87
def set_text(text)
@text = text
end
|
#set_token(token) ⇒ Object
95
96
97
|
# File 'lib/antlr4ruby/lexer.rb', line 95
def set_token(token)
@token = token
end
|
#set_token_factory(factory) ⇒ Object
148
149
150
|
# File 'lib/antlr4ruby/lexer.rb', line 148
def set_token_factory(factory)
end
|
#set_type(token_type) ⇒ Object
99
100
101
|
# File 'lib/antlr4ruby/lexer.rb', line 99
def set_type(token_type)
@type = token_type
end
|
#skip ⇒ Object
41
42
43
|
# File 'lib/antlr4ruby/lexer.rb', line 41
def skip
@type = SKIP
end
|