antlr4-runtime 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/antlr4/runtime.rb +0 -3
- data/lib/antlr4/runtime/antlr_file_stream.rb +2 -2
- data/lib/antlr4/runtime/array_2d_hash_set.rb +1 -1
- data/lib/antlr4/runtime/atn_config.rb +4 -2
- data/lib/antlr4/runtime/buffered_token_stream.rb +1 -1
- data/lib/antlr4/runtime/dfa.rb +1 -1
- data/lib/antlr4/runtime/dfa_state.rb +2 -1
- data/lib/antlr4/runtime/flexible_hash_map.rb +1 -1
- data/lib/antlr4/runtime/interval_set.rb +2 -2
- data/lib/antlr4/runtime/lexer_channel_action.rb +1 -1
- data/lib/antlr4/runtime/lexer_custom_action.rb +1 -1
- data/lib/antlr4/runtime/lexer_indexed_custom_action.rb +1 -1
- data/lib/antlr4/runtime/lexer_mode_action.rb +1 -1
- data/lib/antlr4/runtime/lexer_more_action.rb +1 -1
- data/lib/antlr4/runtime/lexer_pop_mode_action.rb +1 -1
- data/lib/antlr4/runtime/lexer_push_mode_action.rb +1 -1
- data/lib/antlr4/runtime/lexer_skip_action.rb +5 -1
- data/lib/antlr4/runtime/lexer_type_action.rb +1 -1
- data/lib/antlr4/runtime/parse_tree.rb +1 -1
- data/lib/antlr4/runtime/parser_atn_simulator.rb +1 -2
- data/lib/antlr4/runtime/prediction_context_utils.rb +4 -2
- data/lib/antlr4/runtime/rule_node.rb +0 -2
- data/lib/antlr4/runtime/semantic_context.rb +6 -5
- data/lib/antlr4/runtime/tag_chunk.rb +1 -1
- data/lib/antlr4/runtime/text_chunk.rb +1 -1
- data/lib/antlr4/runtime/triple.rb +1 -1
- data/lib/antlr4/runtime/version.rb +1 -1
- metadata +2 -5
- data/lib/antlr4/runtime/chunk.rb +0 -4
- data/lib/antlr4/runtime/syntax_tree.rb +0 -4
- data/lib/antlr4/runtime/tree.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78c1ec511ddcf4fec60fd365e53346033575d3921de4be084648b9cce1959e14
|
4
|
+
data.tar.gz: 4d27831b78dce625246739d808ed5a8417efcdf2917a0478599c4ebcaedb0d6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff1c3e79f915a0b433abed5ec837eb1523bf52b5fbb991c1be476309eefd192580e3457aaabf21aff372d2e191695ead23b1f5cc91e6ab1c69707fdb395c7030
|
7
|
+
data.tar.gz: b224ea329f5ec05f6f1e22867f17e6b7bd16129e691448e2bc4f0c3568e57c23bddcb97973a8930ff6f54e6e7616cab2f7d296d7a7d10c664f2bb72fb74c48ba
|
data/CHANGELOG.md
CHANGED
data/lib/antlr4/runtime.rb
CHANGED
@@ -36,7 +36,6 @@ module Antlr4
|
|
36
36
|
autoload :BufferedTokenStream, 'antlr4/runtime/buffered_token_stream'
|
37
37
|
autoload :CharStream, 'antlr4/runtime/char_stream'
|
38
38
|
autoload :CharStreams, 'antlr4/runtime/char_streams'
|
39
|
-
autoload :Chunk, 'antlr4/runtime/chunk'
|
40
39
|
autoload :CodePointCharStream, 'antlr4/runtime/code_point_char_stream'
|
41
40
|
autoload :CommonToken, 'antlr4/runtime/common_token'
|
42
41
|
autoload :CommonTokenFactory, 'antlr4/runtime/common_token_factory'
|
@@ -124,7 +123,6 @@ module Antlr4
|
|
124
123
|
autoload :StarBlockStartState, 'antlr4/runtime/star_block_start_state'
|
125
124
|
autoload :StarLoopEntryState, 'antlr4/runtime/star_loop_entry_state'
|
126
125
|
autoload :StarLoopbackState, 'antlr4/runtime/star_loopback_state'
|
127
|
-
autoload :SyntaxTree, 'antlr4/runtime/syntax_tree'
|
128
126
|
autoload :TagChunk, 'antlr4/runtime/tag_chunk'
|
129
127
|
autoload :TerminalNode, 'antlr4/runtime/terminal_node'
|
130
128
|
autoload :TerminalNodeImpl, 'antlr4/runtime/terminal_node_impl'
|
@@ -134,7 +132,6 @@ module Antlr4
|
|
134
132
|
autoload :TokenTagToken, 'antlr4/runtime/token_tag_token'
|
135
133
|
autoload :TokensStartState, 'antlr4/runtime/tokens_start_state'
|
136
134
|
autoload :Transition, 'antlr4/runtime/transition'
|
137
|
-
autoload :Tree, 'antlr4/runtime/tree'
|
138
135
|
autoload :Trees, 'antlr4/runtime/trees'
|
139
136
|
autoload :Triple, 'antlr4/runtime/triple'
|
140
137
|
autoload :Utils, 'antlr4/runtime/utils'
|
@@ -2,10 +2,10 @@ module Antlr4::Runtime
|
|
2
2
|
class ANTLRFileStream < ANTLRInputStream
|
3
3
|
def initialize(file_name, encoding)
|
4
4
|
@file_name = file_name
|
5
|
-
|
5
|
+
load_file(file_name, encoding)
|
6
6
|
end
|
7
7
|
|
8
|
-
def
|
8
|
+
def load_file(file_name, encoding)
|
9
9
|
data = Utils.read_file(file_name, encoding)
|
10
10
|
@n_items = data.length
|
11
11
|
end
|
@@ -12,12 +12,14 @@ module Antlr4::Runtime
|
|
12
12
|
def initialize
|
13
13
|
@reaches_into_outer_context = 0
|
14
14
|
@alt = 0
|
15
|
+
@_hash = nil
|
16
|
+
@_bucket_hash = nil
|
15
17
|
end
|
16
18
|
|
17
19
|
def bucket_hash
|
18
20
|
return @_bucket_hash unless @_bucket_hash.nil?
|
19
21
|
|
20
|
-
|
22
|
+
unless @_bucket_hash.nil?
|
21
23
|
if hash_code == @_bucket_hash
|
22
24
|
puts 'Same hash_code for ATNConfig.bucket_hash'
|
23
25
|
else
|
@@ -139,7 +141,7 @@ module Antlr4::Runtime
|
|
139
141
|
|
140
142
|
hash_code = RumourHash.calculate([@state.state_number, @alt, @context, @semantic_context])
|
141
143
|
|
142
|
-
|
144
|
+
unless @_hash.nil?
|
143
145
|
if hash_code == @_hash
|
144
146
|
puts 'Same hash_code for ATNConfig'
|
145
147
|
else
|
data/lib/antlr4/runtime/dfa.rb
CHANGED
@@ -51,7 +51,7 @@ module Antlr4::Runtime
|
|
51
51
|
@s0.edges[precedence] = start_state
|
52
52
|
end
|
53
53
|
|
54
|
-
def
|
54
|
+
def set_precedence_dfa(precedence_dfa)
|
55
55
|
if precedence_dfa != @precedence_dfa
|
56
56
|
raise UnsupportedOperationException, 'The precedence_dfa field cannot change after a DFA is constructed.'
|
57
57
|
end
|
@@ -20,6 +20,7 @@ module Antlr4::Runtime
|
|
20
20
|
@is_accept_state = false
|
21
21
|
@edges = []
|
22
22
|
@state_number = -1
|
23
|
+
@_hash = nil
|
23
24
|
|
24
25
|
if x.nil?
|
25
26
|
@configs = ATNConfigSet.new
|
@@ -72,7 +73,7 @@ module Antlr4::Runtime
|
|
72
73
|
|
73
74
|
hash_code = RumourHash.calculate([configs.hash])
|
74
75
|
|
75
|
-
|
76
|
+
unless @_hash.nil?
|
76
77
|
if hash_code == @_hash
|
77
78
|
puts 'Same hash_code for DFAState'
|
78
79
|
else
|
@@ -124,7 +124,7 @@ module Antlr4::Runtime
|
|
124
124
|
def subtract(a)
|
125
125
|
return IntervalSet.new self if a.nil? || a.is_nil
|
126
126
|
|
127
|
-
|
127
|
+
subtract_interval_sets(self, a)
|
128
128
|
end
|
129
129
|
|
130
130
|
def subtract_interval_sets(left, right)
|
@@ -297,7 +297,7 @@ module Antlr4::Runtime
|
|
297
297
|
|
298
298
|
hash_code = RumourHash.calculate(ints)
|
299
299
|
|
300
|
-
|
300
|
+
unless @_hash.nil?
|
301
301
|
if hash_code == @_hash
|
302
302
|
puts 'Same hash_code for IntervalSet'
|
303
303
|
else
|
@@ -3,6 +3,10 @@ module Antlr4::Runtime
|
|
3
3
|
class LexerSkipAction < LexerAction
|
4
4
|
include Singleton
|
5
5
|
|
6
|
+
def initialize
|
7
|
+
@_hash = nil
|
8
|
+
end
|
9
|
+
|
6
10
|
def action_type
|
7
11
|
LexerActionType::SKIP
|
8
12
|
end
|
@@ -20,7 +24,7 @@ module Antlr4::Runtime
|
|
20
24
|
|
21
25
|
hash_code = RumourHash.calculate([action_type])
|
22
26
|
|
23
|
-
|
27
|
+
unless @_hash.nil?
|
24
28
|
if hash_code == @_hash
|
25
29
|
puts 'Same hash_code for LexerSkipAction'
|
26
30
|
else
|
@@ -246,8 +246,7 @@ module Antlr4::Runtime
|
|
246
246
|
end
|
247
247
|
|
248
248
|
# all adds to dfa are done after we've created full D state
|
249
|
-
|
250
|
-
d
|
249
|
+
add_dfa_edge(dfa, prev_d, t, d)
|
251
250
|
end
|
252
251
|
|
253
252
|
def predicate_dfa_state(dfa_state, decision_state) # We need to test all predicates, even in DFA states that
|
@@ -4,6 +4,8 @@ module Antlr4::Runtime
|
|
4
4
|
INITIAL_HASH = 1
|
5
5
|
EMPTY_RETURN_STATE = Integer::MAX
|
6
6
|
|
7
|
+
@@_hash = nil
|
8
|
+
|
7
9
|
def self.from_rule_context(atn, outer_ctx)
|
8
10
|
outer_ctx = ParserRuleContext::EMPTY if outer_ctx.nil?
|
9
11
|
|
@@ -388,9 +390,9 @@ module Antlr4::Runtime
|
|
388
390
|
end
|
389
391
|
|
390
392
|
def self.calculate_empty_hash_code
|
391
|
-
return
|
393
|
+
return @@_hash unless @@_hash.nil?
|
392
394
|
|
393
|
-
|
395
|
+
@@_hash = RumourHash.calculate([INITIAL_HASH])
|
394
396
|
end
|
395
397
|
|
396
398
|
def self.calculate_hash_code1(parent, return_state)
|
@@ -16,6 +16,7 @@ module Antlr4::Runtime
|
|
16
16
|
@rule_index = rule_index
|
17
17
|
@pred_index = pred_index
|
18
18
|
@is_ctx_dependent = is_ctx_dependent
|
19
|
+
@_hash = nil
|
19
20
|
end
|
20
21
|
|
21
22
|
def eval(parser, parser_call_stack)
|
@@ -28,7 +29,7 @@ module Antlr4::Runtime
|
|
28
29
|
|
29
30
|
hash_code = RumourHash.calculate([@rule_index, @pred_index, @is_ctx_dependent ? 1 : 0])
|
30
31
|
|
31
|
-
|
32
|
+
unless @_hash.nil?
|
32
33
|
if hash_code == @_hash
|
33
34
|
puts 'Same hash_code for SemanticContext'
|
34
35
|
else
|
@@ -46,7 +47,7 @@ module Antlr4::Runtime
|
|
46
47
|
end
|
47
48
|
|
48
49
|
def to_s
|
49
|
-
'' + @rule_index + ':' + @pred_index + '
|
50
|
+
'{' + @rule_index + ':' + @pred_index + '}?'
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
@@ -84,7 +85,7 @@ module Antlr4::Runtime
|
|
84
85
|
|
85
86
|
# precedence >= _precedenceStack.peek()
|
86
87
|
def to_s
|
87
|
-
'' + @precedence + '>=
|
88
|
+
'{' + @precedence + '>=prec}?'
|
88
89
|
end
|
89
90
|
end
|
90
91
|
|
@@ -125,7 +126,7 @@ module Antlr4::Runtime
|
|
125
126
|
|
126
127
|
def hash
|
127
128
|
hash_code = RumourHash.calculate(@opnds, AND.hash)
|
128
|
-
|
129
|
+
unless @_hash2.nil?
|
129
130
|
if hash_code == @_hash2
|
130
131
|
puts 'Same hash_code for SemanticContext_2'
|
131
132
|
else
|
@@ -220,7 +221,7 @@ module Antlr4::Runtime
|
|
220
221
|
|
221
222
|
def hash
|
222
223
|
hash_code = MurmurHash.calculate(@opnds, OR.hash)
|
223
|
-
|
224
|
+
unless @_hash3.nil?
|
224
225
|
if hash_code == @_hash3
|
225
226
|
puts 'Same hash_code for SemanticContext_2'
|
226
227
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: antlr4-runtime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Walmsley
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -105,7 +105,6 @@ files:
|
|
105
105
|
- lib/antlr4/runtime/buffered_token_stream.rb
|
106
106
|
- lib/antlr4/runtime/char_stream.rb
|
107
107
|
- lib/antlr4/runtime/char_streams.rb
|
108
|
-
- lib/antlr4/runtime/chunk.rb
|
109
108
|
- lib/antlr4/runtime/code_point_char_stream.rb
|
110
109
|
- lib/antlr4/runtime/common_token.rb
|
111
110
|
- lib/antlr4/runtime/common_token_factory.rb
|
@@ -193,7 +192,6 @@ files:
|
|
193
192
|
- lib/antlr4/runtime/star_block_start_state.rb
|
194
193
|
- lib/antlr4/runtime/star_loop_entry_state.rb
|
195
194
|
- lib/antlr4/runtime/star_loopback_state.rb
|
196
|
-
- lib/antlr4/runtime/syntax_tree.rb
|
197
195
|
- lib/antlr4/runtime/tag_chunk.rb
|
198
196
|
- lib/antlr4/runtime/terminal_node.rb
|
199
197
|
- lib/antlr4/runtime/terminal_node_impl.rb
|
@@ -203,7 +201,6 @@ files:
|
|
203
201
|
- lib/antlr4/runtime/token_tag_token.rb
|
204
202
|
- lib/antlr4/runtime/tokens_start_state.rb
|
205
203
|
- lib/antlr4/runtime/transition.rb
|
206
|
-
- lib/antlr4/runtime/tree.rb
|
207
204
|
- lib/antlr4/runtime/trees.rb
|
208
205
|
- lib/antlr4/runtime/triple.rb
|
209
206
|
- lib/antlr4/runtime/utils.rb
|
data/lib/antlr4/runtime/chunk.rb
DELETED
data/lib/antlr4/runtime/tree.rb
DELETED