antlr4-runtime 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +35 -0
- data/LICENSE.txt +21 -0
- data/README.md +65 -0
- data/Rakefile +6 -0
- data/antlr4-runtime.gemspec +30 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ext/rumourhash/Makefile +264 -0
- data/ext/rumourhash/extconf.rb +3 -0
- data/ext/rumourhash/rumourhash.c +59 -0
- data/lib/antlr4/runtime.rb +37 -0
- data/lib/antlr4/runtime/abstract_parse_tree_visitor.rb +43 -0
- data/lib/antlr4/runtime/abstract_predicate_transition.rb +11 -0
- data/lib/antlr4/runtime/action_transition.rb +29 -0
- data/lib/antlr4/runtime/ambiguity_info.rb +10 -0
- data/lib/antlr4/runtime/antlr_error_listener.rb +15 -0
- data/lib/antlr4/runtime/antlr_error_strategy.rb +24 -0
- data/lib/antlr4/runtime/antlr_file_stream.rb +17 -0
- data/lib/antlr4/runtime/antlr_input_stream.rb +6 -0
- data/lib/antlr4/runtime/array_2d_hash_set.rb +471 -0
- data/lib/antlr4/runtime/array_prediction_context.rb +76 -0
- data/lib/antlr4/runtime/atn.rb +100 -0
- data/lib/antlr4/runtime/atn_config.rb +140 -0
- data/lib/antlr4/runtime/atn_config_set.rb +150 -0
- data/lib/antlr4/runtime/atn_deserialization_options.rb +48 -0
- data/lib/antlr4/runtime/atn_deserializer.rb +737 -0
- data/lib/antlr4/runtime/atn_simulator.rb +69 -0
- data/lib/antlr4/runtime/atn_state.rb +118 -0
- data/lib/antlr4/runtime/atn_type.rb +8 -0
- data/lib/antlr4/runtime/atom_transition.rb +27 -0
- data/lib/antlr4/runtime/bail_error_strategy.rb +31 -0
- data/lib/antlr4/runtime/base_error_listener.rb +18 -0
- data/lib/antlr4/runtime/basic_block_start_state.rb +12 -0
- data/lib/antlr4/runtime/basic_state.rb +11 -0
- data/lib/antlr4/runtime/bit_set.rb +54 -0
- data/lib/antlr4/runtime/block_end_state.rb +15 -0
- data/lib/antlr4/runtime/block_start_state.rb +12 -0
- data/lib/antlr4/runtime/buffered_token_stream.rb +335 -0
- data/lib/antlr4/runtime/char_stream.rb +6 -0
- data/lib/antlr4/runtime/char_streams.rb +12 -0
- data/lib/antlr4/runtime/chunk.rb +4 -0
- data/lib/antlr4/runtime/code_point_char_stream.rb +83 -0
- data/lib/antlr4/runtime/common_token.rb +125 -0
- data/lib/antlr4/runtime/common_token_factory.rb +30 -0
- data/lib/antlr4/runtime/common_token_stream.rb +63 -0
- data/lib/antlr4/runtime/console_error_listener.rb +12 -0
- data/lib/antlr4/runtime/context_sensitivity_info.rb +7 -0
- data/lib/antlr4/runtime/decision_event_info.rb +19 -0
- data/lib/antlr4/runtime/decision_info.rb +36 -0
- data/lib/antlr4/runtime/decision_state.rb +15 -0
- data/lib/antlr4/runtime/default_error_strategy.rb +314 -0
- data/lib/antlr4/runtime/dfa.rb +97 -0
- data/lib/antlr4/runtime/dfa_serializer.rb +62 -0
- data/lib/antlr4/runtime/dfa_state.rb +109 -0
- data/lib/antlr4/runtime/diagnostic_error_listener.rb +58 -0
- data/lib/antlr4/runtime/double_key_map.rb +49 -0
- data/lib/antlr4/runtime/empty_prediction_context.rb +35 -0
- data/lib/antlr4/runtime/epsilon_transition.rb +27 -0
- data/lib/antlr4/runtime/equality_comparator.rb +4 -0
- data/lib/antlr4/runtime/error_info.rb +7 -0
- data/lib/antlr4/runtime/error_node.rb +5 -0
- data/lib/antlr4/runtime/error_node_impl.rb +12 -0
- data/lib/antlr4/runtime/failed_predicate_exception.rb +33 -0
- data/lib/antlr4/runtime/flexible_hash_map.rb +232 -0
- data/lib/antlr4/runtime/input_mismatch_exception.rb +20 -0
- data/lib/antlr4/runtime/int_stream.rb +31 -0
- data/lib/antlr4/runtime/integer.rb +14 -0
- data/lib/antlr4/runtime/interval.rb +111 -0
- data/lib/antlr4/runtime/interval_set.rb +540 -0
- data/lib/antlr4/runtime/lexer.rb +257 -0
- data/lib/antlr4/runtime/lexer_action.rb +12 -0
- data/lib/antlr4/runtime/lexer_action_executor.rb +75 -0
- data/lib/antlr4/runtime/lexer_action_type.rb +12 -0
- data/lib/antlr4/runtime/lexer_atn_config.rb +50 -0
- data/lib/antlr4/runtime/lexer_atn_simulator.rb +522 -0
- data/lib/antlr4/runtime/lexer_channel_action.rb +51 -0
- data/lib/antlr4/runtime/lexer_custom_action.rb +49 -0
- data/lib/antlr4/runtime/lexer_dfa_serializer.rb +12 -0
- data/lib/antlr4/runtime/lexer_indexed_custom_action.rb +49 -0
- data/lib/antlr4/runtime/lexer_mode_action.rb +51 -0
- data/lib/antlr4/runtime/lexer_more_action.rb +41 -0
- data/lib/antlr4/runtime/lexer_no_viable_alt_exception.rb +4 -0
- data/lib/antlr4/runtime/lexer_pop_mode_action.rb +41 -0
- data/lib/antlr4/runtime/lexer_push_mode_action.rb +51 -0
- data/lib/antlr4/runtime/lexer_skip_action.rb +43 -0
- data/lib/antlr4/runtime/lexer_type_action.rb +51 -0
- data/lib/antlr4/runtime/ll1_analyzer.rb +133 -0
- data/lib/antlr4/runtime/lookahead_event_info.rb +10 -0
- data/lib/antlr4/runtime/loop_end_state.rb +15 -0
- data/lib/antlr4/runtime/murmur_hash.rb +99 -0
- data/lib/antlr4/runtime/no_viable_alt_exception.rb +7 -0
- data/lib/antlr4/runtime/not_set_transition.rb +20 -0
- data/lib/antlr4/runtime/object_equality_comparator.rb +18 -0
- data/lib/antlr4/runtime/ordered_atn_config_set.rb +15 -0
- data/lib/antlr4/runtime/parse_cancellation_exception.rb +5 -0
- data/lib/antlr4/runtime/parse_tree.rb +7 -0
- data/lib/antlr4/runtime/parse_tree_listener.rb +4 -0
- data/lib/antlr4/runtime/parse_tree_visitor.rb +4 -0
- data/lib/antlr4/runtime/parser.rb +522 -0
- data/lib/antlr4/runtime/parser_atn_simulator.rb +1171 -0
- data/lib/antlr4/runtime/parser_rule_context.rb +186 -0
- data/lib/antlr4/runtime/plus_block_start_state.rb +11 -0
- data/lib/antlr4/runtime/plus_loopback_state.rb +12 -0
- data/lib/antlr4/runtime/precedence_predicate_transition.rb +31 -0
- data/lib/antlr4/runtime/predicate.rb +6 -0
- data/lib/antlr4/runtime/predicate_eval_info.rb +16 -0
- data/lib/antlr4/runtime/predicate_transition.rb +35 -0
- data/lib/antlr4/runtime/prediction_context.rb +103 -0
- data/lib/antlr4/runtime/prediction_context_cache.rb +28 -0
- data/lib/antlr4/runtime/prediction_context_utils.rb +407 -0
- data/lib/antlr4/runtime/prediction_mode.rb +213 -0
- data/lib/antlr4/runtime/profiling_atn_simulator.rb +149 -0
- data/lib/antlr4/runtime/proxy_error_listener.rb +33 -0
- data/lib/antlr4/runtime/range_transition.rb +29 -0
- data/lib/antlr4/runtime/recognition_exception.rb +17 -0
- data/lib/antlr4/runtime/recognizer.rb +136 -0
- data/lib/antlr4/runtime/rule_context.rb +131 -0
- data/lib/antlr4/runtime/rule_context_with_alt_num.rb +11 -0
- data/lib/antlr4/runtime/rule_node.rb +8 -0
- data/lib/antlr4/runtime/rule_start_state.rb +17 -0
- data/lib/antlr4/runtime/rule_stop_state.rb +12 -0
- data/lib/antlr4/runtime/rule_tag_token.rb +64 -0
- data/lib/antlr4/runtime/rule_transition.rb +29 -0
- data/lib/antlr4/runtime/semantic_context.rb +313 -0
- data/lib/antlr4/runtime/set_transition.rb +29 -0
- data/lib/antlr4/runtime/singleton_prediction_context.rb +56 -0
- data/lib/antlr4/runtime/star_block_start_state.rb +12 -0
- data/lib/antlr4/runtime/star_loop_entry_state.rb +17 -0
- data/lib/antlr4/runtime/star_loopback_state.rb +16 -0
- data/lib/antlr4/runtime/syntax_tree.rb +6 -0
- data/lib/antlr4/runtime/tag_chunk.rb +22 -0
- data/lib/antlr4/runtime/terminal_node.rb +5 -0
- data/lib/antlr4/runtime/terminal_node_impl.rb +50 -0
- data/lib/antlr4/runtime/text_chunk.rb +16 -0
- data/lib/antlr4/runtime/token.rb +13 -0
- data/lib/antlr4/runtime/token_stream.rb +13 -0
- data/lib/antlr4/runtime/token_tag_token.rb +22 -0
- data/lib/antlr4/runtime/tokens_start_state.rb +14 -0
- data/lib/antlr4/runtime/transition.rb +51 -0
- data/lib/antlr4/runtime/tree.rb +4 -0
- data/lib/antlr4/runtime/trees.rb +195 -0
- data/lib/antlr4/runtime/triple.rb +40 -0
- data/lib/antlr4/runtime/utils.rb +117 -0
- data/lib/antlr4/runtime/uuid.rb +46 -0
- data/lib/antlr4/runtime/version.rb +5 -0
- data/lib/antlr4/runtime/vocabulary.rb +12 -0
- data/lib/antlr4/runtime/vocabulary_impl.rb +82 -0
- data/lib/antlr4/runtime/wildcard_transition.rb +20 -0
- data/lib/antlr4/runtime/writable_token.rb +7 -0
- metadata +243 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
module Antlr4::Runtime
|
2
|
+
|
3
|
+
class LexerChannelAction < LexerAction
|
4
|
+
attr_reader :channel
|
5
|
+
|
6
|
+
def initialize(channel)
|
7
|
+
@channel = channel
|
8
|
+
end
|
9
|
+
|
10
|
+
def action_type
|
11
|
+
LexerActionType::CHANNEL
|
12
|
+
end
|
13
|
+
|
14
|
+
def position_dependent?
|
15
|
+
false
|
16
|
+
end
|
17
|
+
|
18
|
+
def execute(lexer)
|
19
|
+
lexer.setChannel(@channel)
|
20
|
+
end
|
21
|
+
|
22
|
+
def hash
|
23
|
+
return @_hash unless @_hash.nil?
|
24
|
+
|
25
|
+
hash_code = MurmurHash.hash_int_int(action_type.ordinal, channel)
|
26
|
+
|
27
|
+
if !@_hash.nil?
|
28
|
+
if hash_code == @_hash
|
29
|
+
puts 'Same hash_code for LexerChannelAction'
|
30
|
+
else
|
31
|
+
puts 'Different hash_code for LexerChannelAction'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
@_hash = hash_code
|
35
|
+
end
|
36
|
+
|
37
|
+
def eql?(other)
|
38
|
+
if other == self
|
39
|
+
return true
|
40
|
+
else
|
41
|
+
return false unless other.is_a? LexerChannelAction
|
42
|
+
end
|
43
|
+
|
44
|
+
@channel == other.channel
|
45
|
+
end
|
46
|
+
|
47
|
+
def to_s
|
48
|
+
'channel(' << @channel.to_s << ')'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Antlr4::Runtime
|
2
|
+
|
3
|
+
class LexerCustomAction < LexerAction
|
4
|
+
attr_reader :ruleIndex
|
5
|
+
attr_reader :action_index
|
6
|
+
|
7
|
+
def initialize(rule_index, action_index)
|
8
|
+
@rule_index = rule_index
|
9
|
+
@action_index = action_index
|
10
|
+
end
|
11
|
+
|
12
|
+
def action_type
|
13
|
+
LexerActionType::CUSTOM
|
14
|
+
end
|
15
|
+
|
16
|
+
def position_dependent?
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
def execute(lexer)
|
21
|
+
lexer.action(nil, @rule_index, @action_index)
|
22
|
+
end
|
23
|
+
|
24
|
+
def hash
|
25
|
+
return @_hash unless @_hash.nil?
|
26
|
+
|
27
|
+
hash_code = MurmurHash.hash_ints([action_type, rule_index, action_index])
|
28
|
+
|
29
|
+
if !@_hash.nil?
|
30
|
+
if hash_code == @_hash
|
31
|
+
puts 'Same hash_code for LexerCustomAction'
|
32
|
+
else
|
33
|
+
puts 'Different hash_code for LexerCustomAction'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
@_hash = hash_code
|
37
|
+
end
|
38
|
+
|
39
|
+
def eql?(other)
|
40
|
+
if other == self
|
41
|
+
return true
|
42
|
+
else
|
43
|
+
return false unless other.is_a? LexerCustomAction
|
44
|
+
end
|
45
|
+
|
46
|
+
@rule_index == other.rule_index && @action_index == other.action_index
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Antlr4::Runtime
|
2
|
+
|
3
|
+
class LexerIndexedCustomAction < LexerAction
|
4
|
+
attr_reader :action
|
5
|
+
attr_reader :offset
|
6
|
+
|
7
|
+
def initialize(offset, action)
|
8
|
+
@offset = offset
|
9
|
+
@action = action
|
10
|
+
end
|
11
|
+
|
12
|
+
def action_type
|
13
|
+
@action.action_type
|
14
|
+
end
|
15
|
+
|
16
|
+
def position_dependent?
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
def execute(lexer) # assume the input stream position was properly set by the calling code
|
21
|
+
@action.execute(lexer)
|
22
|
+
end
|
23
|
+
|
24
|
+
def hash
|
25
|
+
return @_hash unless @_hash.nil?
|
26
|
+
|
27
|
+
hash_code = MurmurHash.hash_int_obj(offset, action)
|
28
|
+
|
29
|
+
if !@_hash.nil?
|
30
|
+
if hash_code == @_hash
|
31
|
+
puts 'Same hash_code for LexerIndexedCustomAction'
|
32
|
+
else
|
33
|
+
puts 'Different hash_code for LexerIndexedCustomAction'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
@_hash = hash_code
|
37
|
+
end
|
38
|
+
|
39
|
+
def eql?(other)
|
40
|
+
if other == self
|
41
|
+
return true
|
42
|
+
else
|
43
|
+
return false unless other.is_a? LexerIndexedCustomAction
|
44
|
+
end
|
45
|
+
|
46
|
+
@offset == other.offset && @action == other.action
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Antlr4::Runtime
|
2
|
+
|
3
|
+
class LexerModeAction < LexerAction
|
4
|
+
attr_reader :mode
|
5
|
+
|
6
|
+
def initialize(mode)
|
7
|
+
@mode = mode
|
8
|
+
end
|
9
|
+
|
10
|
+
def action_type
|
11
|
+
LexerActionType::MODE
|
12
|
+
end
|
13
|
+
|
14
|
+
def position_dependent?
|
15
|
+
false
|
16
|
+
end
|
17
|
+
|
18
|
+
def execute(lexer)
|
19
|
+
lexer.mode(@mode)
|
20
|
+
end
|
21
|
+
|
22
|
+
def hash
|
23
|
+
return @_hash unless @_hash.nil?
|
24
|
+
|
25
|
+
hash_code = MurmurHash.hash_int_int(action_type, mode)
|
26
|
+
|
27
|
+
if !@_hash.nil?
|
28
|
+
if hash_code == @_hash
|
29
|
+
puts 'Same hash_code for LexerModeAction'
|
30
|
+
else
|
31
|
+
puts 'Different hash_code for LexerModeAction'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
@_hash = hash_code
|
35
|
+
end
|
36
|
+
|
37
|
+
def eql?(other)
|
38
|
+
if other == self
|
39
|
+
return true
|
40
|
+
else
|
41
|
+
return false unless other.is_a? LexerModeAction
|
42
|
+
end
|
43
|
+
|
44
|
+
@mode == other.mode
|
45
|
+
end
|
46
|
+
|
47
|
+
def to_s
|
48
|
+
'mode(' << @mode << ')'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Antlr4::Runtime
|
2
|
+
|
3
|
+
class LexerMoreAction < LexerAction
|
4
|
+
include Singleton
|
5
|
+
|
6
|
+
def action_type
|
7
|
+
LexerActionType::MORE
|
8
|
+
end
|
9
|
+
|
10
|
+
def position_dependent?
|
11
|
+
false
|
12
|
+
end
|
13
|
+
|
14
|
+
def execute(lexer)
|
15
|
+
lexer.more
|
16
|
+
end
|
17
|
+
|
18
|
+
def hash
|
19
|
+
return @_hash unless @_hash.nil?
|
20
|
+
|
21
|
+
hash_code = MurmurHash.hash_int(action_type)
|
22
|
+
|
23
|
+
if !@_hash.nil?
|
24
|
+
if hash_code == @_hash
|
25
|
+
puts 'Same hash_code for LexerMoreAction'
|
26
|
+
else
|
27
|
+
puts 'Different hash_code for LexerMoreAction'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
@_hash = hash_code
|
31
|
+
end
|
32
|
+
|
33
|
+
def eql?(other)
|
34
|
+
other == self
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_s
|
38
|
+
'more'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Antlr4::Runtime
|
2
|
+
|
3
|
+
class LexerPopModeAction < LexerAction
|
4
|
+
include Singleton
|
5
|
+
|
6
|
+
def action_type
|
7
|
+
LexerActionType::POP_MODE
|
8
|
+
end
|
9
|
+
|
10
|
+
def position_dependent?
|
11
|
+
false
|
12
|
+
end
|
13
|
+
|
14
|
+
def execute(lexer)
|
15
|
+
lexer.pop_mode
|
16
|
+
end
|
17
|
+
|
18
|
+
def hash
|
19
|
+
return @_hash unless @_hash.nil?
|
20
|
+
|
21
|
+
hash_code = MurmurHash.hash_int(action_type)
|
22
|
+
|
23
|
+
if !@_hash.nil?
|
24
|
+
if hash_code == @_hash
|
25
|
+
puts 'Same hash_code for LexerPopModeAction'
|
26
|
+
else
|
27
|
+
puts 'Different hash_code for LexerPopModeAction'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
@_hash = hash_code
|
31
|
+
end
|
32
|
+
|
33
|
+
def equals(other)
|
34
|
+
other == self
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_s
|
38
|
+
'popMode'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Antlr4::Runtime
|
2
|
+
|
3
|
+
class LexerPushModeAction < LexerAction
|
4
|
+
attr_reader :mode
|
5
|
+
|
6
|
+
def initialize(mode)
|
7
|
+
@mode = mode
|
8
|
+
end
|
9
|
+
|
10
|
+
def action_type
|
11
|
+
LexerActionType::PUSH_MODE
|
12
|
+
end
|
13
|
+
|
14
|
+
def position_dependent?
|
15
|
+
false
|
16
|
+
end
|
17
|
+
|
18
|
+
def execute(lexer)
|
19
|
+
lexer.push_mode(@mode)
|
20
|
+
end
|
21
|
+
|
22
|
+
def hash
|
23
|
+
return @_hash unless @_hash.nil?
|
24
|
+
|
25
|
+
hash_code = MurmurHash.hash_int_int(action_type, mode)
|
26
|
+
|
27
|
+
if !@_hash.nil?
|
28
|
+
if hash_code == @_hash
|
29
|
+
puts 'Same hash_code for LexerPushModeAction'
|
30
|
+
else
|
31
|
+
puts 'Different hash_code for LexerPushModeAction'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
@_hash = hash_code
|
35
|
+
end
|
36
|
+
|
37
|
+
def eql?(other)
|
38
|
+
if other == self
|
39
|
+
return true
|
40
|
+
else
|
41
|
+
return false unless other.is_a? LexerPushModeAction
|
42
|
+
end
|
43
|
+
|
44
|
+
@mode == other.mode
|
45
|
+
end
|
46
|
+
|
47
|
+
def to_s
|
48
|
+
'pushMode(' << @mode << ')'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'antlr4/runtime/lexer_action'
|
2
|
+
|
3
|
+
module Antlr4::Runtime
|
4
|
+
|
5
|
+
class LexerSkipAction < LexerAction
|
6
|
+
include Singleton
|
7
|
+
|
8
|
+
def action_type
|
9
|
+
LexerActionType::SKIP
|
10
|
+
end
|
11
|
+
|
12
|
+
def position_dependent?
|
13
|
+
false
|
14
|
+
end
|
15
|
+
|
16
|
+
def execute(lexer)
|
17
|
+
lexer.skip
|
18
|
+
end
|
19
|
+
|
20
|
+
def hash
|
21
|
+
return @_hash unless @_hash.nil?
|
22
|
+
|
23
|
+
hash_code = MurmurHash.hash_int(action_type)
|
24
|
+
|
25
|
+
if !@_hash.nil?
|
26
|
+
if hash_code == @_hash
|
27
|
+
puts 'Same hash_code for LexerSkipAction'
|
28
|
+
else
|
29
|
+
puts 'Different hash_code for LexerSkipAction'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
@_hash = hash_code
|
33
|
+
end
|
34
|
+
|
35
|
+
def eql?(other)
|
36
|
+
other == self
|
37
|
+
end
|
38
|
+
|
39
|
+
def to_s
|
40
|
+
'skip'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Antlr4::Runtime
|
2
|
+
|
3
|
+
class LexerTypeAction < LexerAction
|
4
|
+
attr_reader :type
|
5
|
+
|
6
|
+
def initialize(type)
|
7
|
+
@type = type
|
8
|
+
end
|
9
|
+
|
10
|
+
def action_type
|
11
|
+
LexerActionType::TYPE
|
12
|
+
end
|
13
|
+
|
14
|
+
def position_dependent?
|
15
|
+
false
|
16
|
+
end
|
17
|
+
|
18
|
+
def execute(lexer)
|
19
|
+
lexer._type = @type
|
20
|
+
end
|
21
|
+
|
22
|
+
def hash
|
23
|
+
return @_hash unless @_hash.nil?
|
24
|
+
|
25
|
+
hash_code = MurmurHash.hash_int_int(action_type, @type)
|
26
|
+
|
27
|
+
if !@_hash.nil?
|
28
|
+
if hash_code == @_hash
|
29
|
+
puts 'Same hash_code for LexerTypeAction'
|
30
|
+
else
|
31
|
+
puts 'Different hash_code for LexerTypeAction'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
@_hash = hash_code
|
35
|
+
end
|
36
|
+
|
37
|
+
def eql?(other)
|
38
|
+
if other == self
|
39
|
+
return true
|
40
|
+
else
|
41
|
+
return false unless other.is_a? LexerTypeAction
|
42
|
+
end
|
43
|
+
|
44
|
+
@type == other.type
|
45
|
+
end
|
46
|
+
|
47
|
+
def to_s
|
48
|
+
'type(' << @type << ')'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|