antlr4-runtime 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +4 -0
- data/ext/rumourhash/rumourhash.c +56 -12
- data/lib/antlr4/runtime.rb +0 -1
- data/lib/antlr4/runtime/array_2d_hash_set.rb +1 -1
- data/lib/antlr4/runtime/atn_config.rb +2 -2
- data/lib/antlr4/runtime/bit_set.rb +13 -6
- data/lib/antlr4/runtime/buffered_token_stream.rb +6 -3
- data/lib/antlr4/runtime/char_streams.rb +1 -1
- data/lib/antlr4/runtime/common_token.rb +4 -4
- data/lib/antlr4/runtime/default_error_strategy.rb +1 -1
- data/lib/antlr4/runtime/dfa_state.rb +2 -1
- data/lib/antlr4/runtime/flexible_hash_map.rb +3 -3
- data/lib/antlr4/runtime/interval_set.rb +5 -9
- data/lib/antlr4/runtime/lexer.rb +9 -1
- data/lib/antlr4/runtime/lexer_action_executor.rb +1 -1
- data/lib/antlr4/runtime/lexer_atn_simulator.rb +9 -8
- data/lib/antlr4/runtime/lexer_channel_action.rb +2 -2
- data/lib/antlr4/runtime/lexer_custom_action.rb +2 -1
- data/lib/antlr4/runtime/lexer_indexed_custom_action.rb +2 -2
- data/lib/antlr4/runtime/lexer_mode_action.rb +2 -2
- data/lib/antlr4/runtime/lexer_more_action.rb +2 -2
- data/lib/antlr4/runtime/lexer_pop_mode_action.rb +2 -2
- data/lib/antlr4/runtime/lexer_push_mode_action.rb +2 -2
- data/lib/antlr4/runtime/lexer_skip_action.rb +1 -1
- data/lib/antlr4/runtime/lexer_type_action.rb +2 -2
- data/lib/antlr4/runtime/ll1_analyzer.rb +4 -2
- data/lib/antlr4/runtime/parser.rb +2 -2
- data/lib/antlr4/runtime/parser_rule_context.rb +1 -1
- data/lib/antlr4/runtime/prediction_context.rb +1 -1
- data/lib/antlr4/runtime/prediction_context_utils.rb +3 -3
- data/lib/antlr4/runtime/prediction_mode.rb +1 -1
- data/lib/antlr4/runtime/semantic_context.rb +4 -4
- data/lib/antlr4/runtime/triple.rb +2 -2
- data/lib/antlr4/runtime/version.rb +1 -1
- metadata +2 -4
- data/ext/rumourhash/Makefile +0 -264
- data/lib/antlr4/runtime/murmur_hash.rb +0 -99
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ec888a28668505439b0e3e2f068cd6318373095dee14c9ce0d7efc977abb159
|
4
|
+
data.tar.gz: 828c1614048ee0b76c8ad1814ea8e373757071bf36bed66d66286272330d88dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7c4ea5af9d828124b7fa34e43db1593c44653ca4900660c8743d9cd7871cbff9d12cf10a982006c95db41a77cf4622326d74cccf839e6a99c717a5461be6747
|
7
|
+
data.tar.gz: b56c6dbf61b1ef856ffd72d80ebc38e1c7cde728519a9bc471861c533ba0e74d0c36a39a8d68c6978304c24c563e02f0445601afd26d753a9b97a299331ebe92
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/ext/rumourhash/rumourhash.c
CHANGED
@@ -6,11 +6,9 @@
|
|
6
6
|
#define r2 13
|
7
7
|
#define m 5
|
8
8
|
#define n 0xE6546B64
|
9
|
+
#define defaultSeed 7
|
9
10
|
|
10
|
-
static
|
11
|
-
long hash = NUM2LONG(hashv);
|
12
|
-
long value = NUM2LONG(valuev);
|
13
|
-
|
11
|
+
static long rumour_hash_update_int_impl(VALUE self, long hash, long value) {
|
14
12
|
long k = value;
|
15
13
|
k *= c1;
|
16
14
|
k = (k << r1) | (k >> (32 - r1));
|
@@ -20,13 +18,17 @@ static VALUE rumour_hash_update_int(VALUE self, VALUE hashv, VALUE valuev) {
|
|
20
18
|
hash = (hash << r2) | (hash >> (32 - r2));
|
21
19
|
hash *= m + n;
|
22
20
|
|
23
|
-
return
|
21
|
+
return hash;
|
24
22
|
}
|
25
23
|
|
26
|
-
static VALUE
|
24
|
+
static VALUE rumour_hash_update_int(VALUE self, VALUE hashv, VALUE valuev) {
|
27
25
|
long hash = NUM2LONG(hashv);
|
28
|
-
long
|
26
|
+
long value = NUM2LONG(valuev);
|
27
|
+
hash = rumour_hash_update_int_impl(self, hash, value);
|
28
|
+
return LONG2NUM(hash);
|
29
|
+
}
|
29
30
|
|
31
|
+
static long rumour_hash_finish_impl(VALUE self, long hash, long n_words) {
|
30
32
|
hash = hash ^ (n_words * 4);
|
31
33
|
hash = hash ^ (hash >> 16);
|
32
34
|
hash *= 0x85EBCA6B;
|
@@ -34,10 +36,52 @@ static VALUE rumour_hash_finish(VALUE self, VALUE hashv, VALUE n_wordsv) {
|
|
34
36
|
hash *= 0xC2B2AE35;
|
35
37
|
hash ^= (hash >> 16);
|
36
38
|
|
39
|
+
return hash;
|
40
|
+
}
|
41
|
+
|
42
|
+
static VALUE rumour_hash_finish(VALUE self, VALUE hashv, VALUE n_wordsv) {
|
43
|
+
long hash = NUM2LONG(hashv);
|
44
|
+
long n_words = NUM2LONG(n_wordsv);
|
45
|
+
hash = rumour_hash_finish_impl(self, hash, n_words);
|
46
|
+
return LONG2NUM(hash);
|
47
|
+
}
|
48
|
+
|
49
|
+
static VALUE rumour_hash_calculate(int argc, VALUE* argv, VALUE self) {
|
50
|
+
VALUE itemsv;
|
51
|
+
VALUE seed;
|
52
|
+
|
53
|
+
rb_scan_args(argc, argv, "11", &itemsv, &seed);
|
54
|
+
|
55
|
+
long hash;
|
56
|
+
|
57
|
+
if (seed == Qnil) {
|
58
|
+
hash = defaultSeed;
|
59
|
+
} else {
|
60
|
+
hash = NUM2LONG(seed);
|
61
|
+
}
|
62
|
+
|
63
|
+
for (int i = 0; i < RARRAY_LEN(itemsv); i ++) {
|
64
|
+
VALUE current = RARRAY_AREF(itemsv, i);
|
65
|
+
long val;
|
66
|
+
|
67
|
+
if (current == Qnil || current == Qfalse) {
|
68
|
+
val = 0;
|
69
|
+
} else if (current == Qtrue) {
|
70
|
+
val = 1;
|
71
|
+
} else if (CLASS_OF(current) == rb_cInteger) {
|
72
|
+
val = NUM2LONG(current);
|
73
|
+
} else {
|
74
|
+
val = NUM2LONG(rb_hash(current));
|
75
|
+
}
|
76
|
+
|
77
|
+
hash = rumour_hash_update_int_impl(self, hash, val);
|
78
|
+
}
|
79
|
+
|
80
|
+
hash = rumour_hash_finish_impl(self, hash, RARRAY_LEN(itemsv));
|
37
81
|
return LONG2NUM(hash);
|
38
82
|
}
|
39
83
|
|
40
|
-
static VALUE
|
84
|
+
static VALUE rumour_hash_bit_count(VALUE self, VALUE v) {
|
41
85
|
long num = NUM2LONG(v);
|
42
86
|
int count = 0;
|
43
87
|
|
@@ -52,8 +96,8 @@ static VALUE bit_count(VALUE self, VALUE v) {
|
|
52
96
|
|
53
97
|
void Init_rumourhash() {
|
54
98
|
VALUE mod = rb_define_module("RumourHash");
|
55
|
-
|
56
|
-
|
57
|
-
|
99
|
+
rb_define_singleton_method(mod, "calculate", rumour_hash_calculate, -1);
|
100
|
+
rb_define_singleton_method(mod, "update_int", rumour_hash_update_int, 2);
|
101
|
+
rb_define_singleton_method(mod, "finish", rumour_hash_finish, 2);
|
102
|
+
rb_define_singleton_method(mod, "bit_count", rumour_hash_bit_count, 1);
|
58
103
|
}
|
59
|
-
|
data/lib/antlr4/runtime.rb
CHANGED
@@ -85,7 +85,6 @@ module Antlr4
|
|
85
85
|
autoload :LL1Analyzer, 'antlr4/runtime/ll1_analyzer'
|
86
86
|
autoload :LookaheadEventInfo, 'antlr4/runtime/lookahead_event_info'
|
87
87
|
autoload :LoopEndState, 'antlr4/runtime/loop_end_state'
|
88
|
-
autoload :MurmurHash, 'antlr4/runtime/murmur_hash'
|
89
88
|
autoload :NoViableAltException, 'antlr4/runtime/no_viable_alt_exception'
|
90
89
|
autoload :NotSetTransition, 'antlr4/runtime/not_set_transition'
|
91
90
|
autoload :ObjectEqualityComparator, 'antlr4/runtime/object_equality_comparator'
|
@@ -24,7 +24,7 @@ module Antlr4::Runtime
|
|
24
24
|
puts 'Different hash_code for ATNConfig.bucket_hash'
|
25
25
|
end
|
26
26
|
end
|
27
|
-
@_bucket_hash =
|
27
|
+
@_bucket_hash = RumourHash.calculate([@state.state_number, @alt])
|
28
28
|
end
|
29
29
|
|
30
30
|
def atn_config_copy(old)
|
@@ -137,7 +137,7 @@ module Antlr4::Runtime
|
|
137
137
|
def hash
|
138
138
|
return @_hash unless @_hash.nil?
|
139
139
|
|
140
|
-
hash_code =
|
140
|
+
hash_code = RumourHash.calculate([@state.state_number, @alt, @context, @semantic_context])
|
141
141
|
|
142
142
|
if !@_hash.nil?
|
143
143
|
if hash_code == @_hash
|
@@ -1,7 +1,3 @@
|
|
1
|
-
require 'rumourhash/rumourhash'
|
2
|
-
|
3
|
-
include RumourHash
|
4
|
-
|
5
1
|
module Antlr4::Runtime
|
6
2
|
|
7
3
|
class BitSet
|
@@ -17,12 +13,23 @@ module Antlr4::Runtime
|
|
17
13
|
@bits |= (1 << x)
|
18
14
|
end
|
19
15
|
|
16
|
+
def clear(idx = nil)
|
17
|
+
# check for zero to avoid trying to take the log2 of it, which
|
18
|
+
# returns -Infinity
|
19
|
+
if !idx || bits == 0
|
20
|
+
@bits = 0
|
21
|
+
return
|
22
|
+
end
|
23
|
+
|
24
|
+
@bits &= 2**Math.log2(bits).ceil - 2**idx - 1
|
25
|
+
end
|
26
|
+
|
20
27
|
def get(x)
|
21
28
|
(@bits & (1 << x)) > 0 ? true : false
|
22
29
|
end
|
23
30
|
|
24
31
|
def cardinality
|
25
|
-
bit_count(@bits)
|
32
|
+
RumourHash.bit_count(@bits)
|
26
33
|
end
|
27
34
|
|
28
35
|
def or(bit_set)
|
@@ -51,4 +58,4 @@ module Antlr4::Runtime
|
|
51
58
|
buf
|
52
59
|
end
|
53
60
|
end
|
54
|
-
end
|
61
|
+
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'antlr4/runtime/writable_token'
|
2
|
+
require 'antlr4/runtime/token_stream'
|
3
|
+
|
1
4
|
module Antlr4::Runtime
|
2
5
|
|
3
6
|
class BufferedTokenStream < TokenStream
|
@@ -75,7 +78,7 @@ module Antlr4::Runtime
|
|
75
78
|
i = 0
|
76
79
|
while i < n
|
77
80
|
t = @token_source.next_token
|
78
|
-
t.
|
81
|
+
t.token_index = @tokens.length if t.is_a? WritableToken
|
79
82
|
@tokens << t
|
80
83
|
if t.type == Token::EOF
|
81
84
|
@fetched_eof = true
|
@@ -303,7 +306,7 @@ module Antlr4::Runtime
|
|
303
306
|
break if t.type == Token::EOF
|
304
307
|
|
305
308
|
buf << t.text
|
306
|
-
i += 1
|
309
|
+
buf << i += 1
|
307
310
|
end
|
308
311
|
buf
|
309
312
|
end
|
@@ -329,4 +332,4 @@ module Antlr4::Runtime
|
|
329
332
|
end
|
330
333
|
end
|
331
334
|
end
|
332
|
-
end
|
335
|
+
end
|
@@ -11,7 +11,7 @@ module Antlr4::Runtime
|
|
11
11
|
attr_accessor :char_position_in_line
|
12
12
|
attr_accessor :channel
|
13
13
|
attr_accessor :source
|
14
|
-
attr_accessor :
|
14
|
+
attr_accessor :token_index
|
15
15
|
attr_accessor :start
|
16
16
|
attr_accessor :stop
|
17
17
|
attr_accessor :_text
|
@@ -19,7 +19,7 @@ module Antlr4::Runtime
|
|
19
19
|
def initialize(type = nil)
|
20
20
|
@char_position_in_line = -1
|
21
21
|
@channel = Token::DEFAULT_CHANNEL
|
22
|
-
@
|
22
|
+
@token_index = -1
|
23
23
|
@type = type
|
24
24
|
@source = @@EMPTY_SOURCE
|
25
25
|
@_text = nil
|
@@ -48,7 +48,7 @@ module Antlr4::Runtime
|
|
48
48
|
result = CommonToken.new(old_token.type)
|
49
49
|
|
50
50
|
result.line = old_token.line
|
51
|
-
result.
|
51
|
+
result.token_index = old_token.token_index
|
52
52
|
result.char_position_in_line = old_token.char_position_in_line
|
53
53
|
result.channel = old_token.channel
|
54
54
|
result.start = old_token.start_index
|
@@ -122,4 +122,4 @@ module Antlr4::Runtime
|
|
122
122
|
'[@' << token_index.to_s << ',' << @start.to_s << ':' << @stop.to_s << "='" << txt << "',<" << type_string << '>' << channel_str << ',' << @line.to_s << ':' << char_position_in_line.to_s << ']'
|
123
123
|
end
|
124
124
|
end
|
125
|
-
end
|
125
|
+
end
|
@@ -53,7 +53,7 @@ module Antlr4::Runtime
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def recover(recognizer, _e)
|
56
|
-
if @last_error_index == recognizer._input.index && !@last_error_states.nil? && @last_error_states.
|
56
|
+
if @last_error_index == recognizer._input.index && !@last_error_states.nil? && @last_error_states.contains(recognizer._state_number)
|
57
57
|
# uh oh, another error at same token index and previously-visited
|
58
58
|
# state in ATN must be a case where lt(1) is in the recovery
|
59
59
|
# token set so nothing got consumed. Consume a single token
|
@@ -70,7 +70,7 @@ module Antlr4::Runtime
|
|
70
70
|
def hash
|
71
71
|
return @_hash unless @_hash.nil?
|
72
72
|
|
73
|
-
hash_code =
|
73
|
+
hash_code = RumourHash.calculate([configs.hash])
|
74
74
|
|
75
75
|
if !@_hash.nil?
|
76
76
|
if hash_code == @_hash
|
@@ -79,6 +79,7 @@ module Antlr4::Runtime
|
|
79
79
|
puts 'Different hash_code for DFAState'
|
80
80
|
end
|
81
81
|
end
|
82
|
+
|
82
83
|
@_hash = hash_code
|
83
84
|
end
|
84
85
|
|
@@ -19,7 +19,7 @@ module Antlr4::Runtime
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def initialize(comparator = nil, initial_capacity = nil, initial_bucket_capacity = nil)
|
22
|
-
comparator = ObjectEqualityComparator.
|
22
|
+
comparator = ObjectEqualityComparator.instance if comparator.nil?
|
23
23
|
|
24
24
|
initial_capacity = INITIAL_CAPACITY if initial_capacity.nil?
|
25
25
|
initial_bucket_capacity = INITIAL_BUCKET_CAPACITY if initial_bucket_capacity.nil?
|
@@ -132,7 +132,7 @@ module Antlr4::Runtime
|
|
132
132
|
i += 1
|
133
133
|
end
|
134
134
|
|
135
|
-
hash_code =
|
135
|
+
hash_code = RumourHash.calculate(objs)
|
136
136
|
|
137
137
|
if !@_hash.nil?
|
138
138
|
if hash_code == @_hash
|
@@ -229,4 +229,4 @@ module Antlr4::Runtime
|
|
229
229
|
buf.to_s
|
230
230
|
end
|
231
231
|
end
|
232
|
-
end
|
232
|
+
end
|
@@ -290,16 +290,12 @@ module Antlr4::Runtime
|
|
290
290
|
end
|
291
291
|
|
292
292
|
def hash
|
293
|
-
ints = []
|
294
|
-
|
295
|
-
|
296
|
-
interval = @intervals[i]
|
297
|
-
ints << interval.a
|
298
|
-
ints << interval.b
|
299
|
-
i += 1
|
293
|
+
ints = @intervals.each_with_object([]) do |interval, ret|
|
294
|
+
ret << interval.a
|
295
|
+
ret << interval.b
|
300
296
|
end
|
301
297
|
|
302
|
-
hash_code =
|
298
|
+
hash_code = RumourHash.calculate(ints)
|
303
299
|
|
304
300
|
if !@_hash.nil?
|
305
301
|
if hash_code == @_hash
|
@@ -499,4 +495,4 @@ module Antlr4::Runtime
|
|
499
495
|
@@empty_set = IntervalSet.new
|
500
496
|
@@empty_set.readonly(true)
|
501
497
|
end
|
502
|
-
end
|
498
|
+
end
|
data/lib/antlr4/runtime/lexer.rb
CHANGED
@@ -55,9 +55,17 @@ module Antlr4::Runtime
|
|
55
55
|
@_factory = CommonTokenFactory.instance
|
56
56
|
end
|
57
57
|
|
58
|
+
def token_factory
|
59
|
+
@_factory
|
60
|
+
end
|
61
|
+
|
62
|
+
def token_factory=(factory)
|
63
|
+
@_factory = factory
|
64
|
+
end
|
65
|
+
|
58
66
|
def next_token
|
59
67
|
if @_input.nil?
|
60
|
-
raise IllegalStateException, '
|
68
|
+
raise IllegalStateException, 'next_token requires a non-nil input stream.'
|
61
69
|
end
|
62
70
|
|
63
71
|
# Mark start location in char stream so unbuffered streams are
|
@@ -348,26 +348,27 @@ module Antlr4::Runtime
|
|
348
348
|
|
349
349
|
def epsilon_target(input, config, t, configs, speculative, treat_eof_as_epsilon)
|
350
350
|
c = nil
|
351
|
-
|
352
|
-
|
351
|
+
serialization_type = t.serialization_type
|
352
|
+
|
353
|
+
if serialization_type == Transition::RULE
|
353
354
|
rule_transition = t
|
354
355
|
new_context = SingletonPredictionContext.new(config.context, rule_transition.follow_state.state_number)
|
355
356
|
c = LexerATNConfig.new
|
356
357
|
c.lexer_atn_config5(config, t.target, new_context)
|
357
358
|
|
358
|
-
|
359
|
+
elsif serialization_type == Transition::PRECEDENCE
|
359
360
|
|
360
361
|
raise UnsupportedOperationException, 'Precedence predicates are not supported in lexers.'
|
361
362
|
|
362
|
-
|
363
|
+
elsif serialization_type == Transition::PREDICATE
|
363
364
|
pt = t
|
364
|
-
puts('EVAL rule ' + pt.rule_index + ':' + pt.pred_index) if @@debug
|
365
|
+
# puts('EVAL rule ' + pt.rule_index + ':' + pt.pred_index) if @@debug
|
365
366
|
configs.has_semantic_context = true
|
366
367
|
if evaluate_predicate(input, pt.rule_index, pt.pred_index, speculative)
|
367
368
|
c = LexerATNConfig.create_from_config(config, t.target)
|
368
369
|
end
|
369
370
|
|
370
|
-
|
371
|
+
elsif serialization_type == Transition::ACTION
|
371
372
|
|
372
373
|
if config.context.nil? || config.context.empty_path?
|
373
374
|
# execute actions anywhere in the start rule for a token.
|
@@ -390,10 +391,10 @@ module Antlr4::Runtime
|
|
390
391
|
c.lexer_atn_config3(config, t.target)
|
391
392
|
end
|
392
393
|
|
393
|
-
|
394
|
+
elsif serialization_type == Transition::EPSILON
|
394
395
|
c = LexerATNConfig.new
|
395
396
|
c.lexer_atn_config3(config, t.target)
|
396
|
-
|
397
|
+
elsif serialization_type == Transition::ATOM || serialization_type == Transition::RANGE || serialization_type == Transition::SET
|
397
398
|
if treat_eof_as_epsilon
|
398
399
|
if t.matches(CharStream.EOF, Lexer.MIN_CHAR_VALUE, Lexer.MAX_CHAR_VALUE)
|
399
400
|
c = LexerATNConfig.create_from_config(config, t.target)
|
@@ -22,7 +22,7 @@ module Antlr4::Runtime
|
|
22
22
|
def hash
|
23
23
|
return @_hash unless @_hash.nil?
|
24
24
|
|
25
|
-
hash_code =
|
25
|
+
hash_code = RumourHash.calculate([action_type.ordinal, channel])
|
26
26
|
|
27
27
|
if !@_hash.nil?
|
28
28
|
if hash_code == @_hash
|
@@ -48,4 +48,4 @@ module Antlr4::Runtime
|
|
48
48
|
'channel(' << @channel.to_s << ')'
|
49
49
|
end
|
50
50
|
end
|
51
|
-
end
|
51
|
+
end
|
@@ -24,7 +24,7 @@ module Antlr4::Runtime
|
|
24
24
|
def hash
|
25
25
|
return @_hash unless @_hash.nil?
|
26
26
|
|
27
|
-
hash_code =
|
27
|
+
hash_code = RumourHash.calculate([action_type, rule_index, action_index])
|
28
28
|
|
29
29
|
if !@_hash.nil?
|
30
30
|
if hash_code == @_hash
|
@@ -33,6 +33,7 @@ module Antlr4::Runtime
|
|
33
33
|
puts 'Different hash_code for LexerCustomAction'
|
34
34
|
end
|
35
35
|
end
|
36
|
+
|
36
37
|
@_hash = hash_code
|
37
38
|
end
|
38
39
|
|
@@ -24,7 +24,7 @@ module Antlr4::Runtime
|
|
24
24
|
def hash
|
25
25
|
return @_hash unless @_hash.nil?
|
26
26
|
|
27
|
-
hash_code =
|
27
|
+
hash_code = RumourHash.calculate([offset, action])
|
28
28
|
|
29
29
|
if !@_hash.nil?
|
30
30
|
if hash_code == @_hash
|
@@ -46,4 +46,4 @@ module Antlr4::Runtime
|
|
46
46
|
@offset == other.offset && @action == other.action
|
47
47
|
end
|
48
48
|
end
|
49
|
-
end
|
49
|
+
end
|
@@ -22,7 +22,7 @@ module Antlr4::Runtime
|
|
22
22
|
def hash
|
23
23
|
return @_hash unless @_hash.nil?
|
24
24
|
|
25
|
-
hash_code =
|
25
|
+
hash_code = RumourHash.calculate([action_type, mode])
|
26
26
|
|
27
27
|
if !@_hash.nil?
|
28
28
|
if hash_code == @_hash
|
@@ -48,4 +48,4 @@ module Antlr4::Runtime
|
|
48
48
|
'mode(' << @mode << ')'
|
49
49
|
end
|
50
50
|
end
|
51
|
-
end
|
51
|
+
end
|
@@ -18,7 +18,7 @@ module Antlr4::Runtime
|
|
18
18
|
def hash
|
19
19
|
return @_hash unless @_hash.nil?
|
20
20
|
|
21
|
-
hash_code =
|
21
|
+
hash_code = RumourHash.calculate([action_type])
|
22
22
|
|
23
23
|
if !@_hash.nil?
|
24
24
|
if hash_code == @_hash
|
@@ -38,4 +38,4 @@ module Antlr4::Runtime
|
|
38
38
|
'more'
|
39
39
|
end
|
40
40
|
end
|
41
|
-
end
|
41
|
+
end
|
@@ -18,7 +18,7 @@ module Antlr4::Runtime
|
|
18
18
|
def hash
|
19
19
|
return @_hash unless @_hash.nil?
|
20
20
|
|
21
|
-
hash_code =
|
21
|
+
hash_code = RumourHash.calculate([action_type])
|
22
22
|
|
23
23
|
if !@_hash.nil?
|
24
24
|
if hash_code == @_hash
|
@@ -38,4 +38,4 @@ module Antlr4::Runtime
|
|
38
38
|
'popMode'
|
39
39
|
end
|
40
40
|
end
|
41
|
-
end
|
41
|
+
end
|
@@ -22,7 +22,7 @@ module Antlr4::Runtime
|
|
22
22
|
def hash
|
23
23
|
return @_hash unless @_hash.nil?
|
24
24
|
|
25
|
-
hash_code =
|
25
|
+
hash_code = RumourHash.calculate([action_type, mode])
|
26
26
|
|
27
27
|
if !@_hash.nil?
|
28
28
|
if hash_code == @_hash
|
@@ -48,4 +48,4 @@ module Antlr4::Runtime
|
|
48
48
|
'pushMode(' << @mode << ')'
|
49
49
|
end
|
50
50
|
end
|
51
|
-
end
|
51
|
+
end
|
@@ -22,7 +22,7 @@ module Antlr4::Runtime
|
|
22
22
|
def hash
|
23
23
|
return @_hash unless @_hash.nil?
|
24
24
|
|
25
|
-
hash_code =
|
25
|
+
hash_code = RumourHash.calculate([action_type, @type])
|
26
26
|
|
27
27
|
if !@_hash.nil?
|
28
28
|
if hash_code == @_hash
|
@@ -48,4 +48,4 @@ module Antlr4::Runtime
|
|
48
48
|
'type(' << @type << ')'
|
49
49
|
end
|
50
50
|
end
|
51
|
-
end
|
51
|
+
end
|
@@ -3,6 +3,8 @@ module Antlr4::Runtime
|
|
3
3
|
class LL1Analyzer
|
4
4
|
@@hit_pred = Token::INVALID_TYPE
|
5
5
|
|
6
|
+
attr_reader :atn
|
7
|
+
|
6
8
|
def initialize(atn)
|
7
9
|
@atn = atn
|
8
10
|
end
|
@@ -29,7 +31,7 @@ module Antlr4::Runtime
|
|
29
31
|
r = IntervalSet.new
|
30
32
|
see_thru_preds = true # ignore preds get all lookahead
|
31
33
|
look_context = !ctx.nil? ? PredictionContextUtils.from_rule_context(s.atn, ctx) : nil
|
32
|
-
_look(s, stop_state, look_context, r, Set.new,
|
34
|
+
_look(s, stop_state, look_context, r, Set.new, BitSet.new, see_thru_preds, true)
|
33
35
|
r
|
34
36
|
end
|
35
37
|
|
@@ -70,7 +72,7 @@ module Antlr4::Runtime
|
|
70
72
|
calledRuleStack.clear(s.rule_index)
|
71
73
|
i = 0
|
72
74
|
while i < ctx.size
|
73
|
-
return_state = atn.states
|
75
|
+
return_state = atn.states[ctx.get_return_state(i)]
|
74
76
|
|
75
77
|
_look(return_state, stopState, ctx.get_parent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF)
|
76
78
|
i += 1
|
@@ -171,8 +171,8 @@ module Antlr4::Runtime
|
|
171
171
|
@_input.token_source.token_factory
|
172
172
|
end
|
173
173
|
|
174
|
-
def
|
175
|
-
@_input.token_source.
|
174
|
+
def token_factory=(factory)
|
175
|
+
@_input.token_source.token_factory = factory
|
176
176
|
end
|
177
177
|
|
178
178
|
def get_atn_with_bypass_alts
|
@@ -390,15 +390,15 @@ module Antlr4::Runtime
|
|
390
390
|
def self.calculate_empty_hash_code
|
391
391
|
return @_hash unless @_hash.nil?
|
392
392
|
|
393
|
-
@_hash =
|
393
|
+
@_hash = RumourHash.calculate([INITIAL_HASH])
|
394
394
|
end
|
395
395
|
|
396
396
|
def self.calculate_hash_code1(parent, return_state)
|
397
|
-
|
397
|
+
RumourHash.calculate([return_state, parent])
|
398
398
|
end
|
399
399
|
|
400
400
|
def self.calculate_hash_code2(parents, return_states)
|
401
|
-
|
401
|
+
RumourHash.calculate(return_states + parents)
|
402
402
|
end
|
403
403
|
end
|
404
404
|
end
|
@@ -26,7 +26,7 @@ module Antlr4::Runtime
|
|
26
26
|
def hash
|
27
27
|
return @_hash unless @_hash.nil?
|
28
28
|
|
29
|
-
hash_code =
|
29
|
+
hash_code = RumourHash.calculate([@rule_index, @pred_index, @is_ctx_dependent ? 1 : 0])
|
30
30
|
|
31
31
|
if !@_hash.nil?
|
32
32
|
if hash_code == @_hash
|
@@ -124,7 +124,7 @@ module Antlr4::Runtime
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def hash
|
127
|
-
hash_code =
|
127
|
+
hash_code = RumourHash.calculate(@opnds, AND.hash)
|
128
128
|
if !@_hash2.nil?
|
129
129
|
if hash_code == @_hash2
|
130
130
|
puts 'Same hash_code for SemanticContext_2'
|
@@ -219,7 +219,7 @@ module Antlr4::Runtime
|
|
219
219
|
end
|
220
220
|
|
221
221
|
def hash
|
222
|
-
hash_code = MurmurHash.
|
222
|
+
hash_code = MurmurHash.calculate(@opnds, OR.hash)
|
223
223
|
if !@_hash3.nil?
|
224
224
|
if hash_code == @_hash3
|
225
225
|
puts 'Same hash_code for SemanticContext_2'
|
@@ -308,4 +308,4 @@ module Antlr4::Runtime
|
|
308
308
|
|
309
309
|
NONE = Predicate.new
|
310
310
|
end
|
311
|
-
end
|
311
|
+
end
|
@@ -21,7 +21,7 @@ module Antlr4::Runtime
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def hash
|
24
|
-
hash_code =
|
24
|
+
hash_code = RumourHash.hash([@a, @b, @c])
|
25
25
|
|
26
26
|
if !@_hash.nil?
|
27
27
|
if hash_code == @_hash
|
@@ -37,4 +37,4 @@ module Antlr4::Runtime
|
|
37
37
|
'(' << @a.to_s << ',' << @b.to_s << ', ' << @c.to_s << ')'
|
38
38
|
end
|
39
39
|
end
|
40
|
-
end
|
40
|
+
end
|
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.4
|
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-05-
|
11
|
+
date: 2019-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -73,7 +73,6 @@ files:
|
|
73
73
|
- antlr4-runtime.gemspec
|
74
74
|
- bin/console
|
75
75
|
- bin/setup
|
76
|
-
- ext/rumourhash/Makefile
|
77
76
|
- ext/rumourhash/extconf.rb
|
78
77
|
- ext/rumourhash/rumourhash.c
|
79
78
|
- lib/antlr4/runtime.rb
|
@@ -155,7 +154,6 @@ files:
|
|
155
154
|
- lib/antlr4/runtime/ll1_analyzer.rb
|
156
155
|
- lib/antlr4/runtime/lookahead_event_info.rb
|
157
156
|
- lib/antlr4/runtime/loop_end_state.rb
|
158
|
-
- lib/antlr4/runtime/murmur_hash.rb
|
159
157
|
- lib/antlr4/runtime/no_viable_alt_exception.rb
|
160
158
|
- lib/antlr4/runtime/not_set_transition.rb
|
161
159
|
- lib/antlr4/runtime/object_equality_comparator.rb
|
data/ext/rumourhash/Makefile
DELETED
@@ -1,264 +0,0 @@
|
|
1
|
-
|
2
|
-
SHELL = /bin/sh
|
3
|
-
|
4
|
-
# V=0 quiet, V=1 verbose. other values don't work.
|
5
|
-
V = 0
|
6
|
-
Q1 = $(V:1=)
|
7
|
-
Q = $(Q1:0=@)
|
8
|
-
ECHO1 = $(V:1=@ :)
|
9
|
-
ECHO = $(ECHO1:0=@ echo)
|
10
|
-
NULLCMD = :
|
11
|
-
|
12
|
-
#### Start of system configuration section. ####
|
13
|
-
|
14
|
-
srcdir = .
|
15
|
-
topdir = /Users/tonywalmsley/.rvm/rubies/ruby-2.5.3/include/ruby-2.5.0
|
16
|
-
hdrdir = $(topdir)
|
17
|
-
arch_hdrdir = /Users/tonywalmsley/.rvm/rubies/ruby-2.5.3/include/ruby-2.5.0/x86_64-darwin18
|
18
|
-
PATH_SEPARATOR = :
|
19
|
-
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
|
20
|
-
prefix = $(DESTDIR)/Users/tonywalmsley/.rvm/rubies/ruby-2.5.3
|
21
|
-
rubysitearchprefix = $(rubylibprefix)/$(sitearch)
|
22
|
-
rubyarchprefix = $(rubylibprefix)/$(arch)
|
23
|
-
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
24
|
-
exec_prefix = $(prefix)
|
25
|
-
vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
|
26
|
-
sitearchhdrdir = $(sitehdrdir)/$(sitearch)
|
27
|
-
rubyarchhdrdir = $(rubyhdrdir)/$(arch)
|
28
|
-
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
29
|
-
sitehdrdir = $(rubyhdrdir)/site_ruby
|
30
|
-
rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
|
31
|
-
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
32
|
-
vendorlibdir = $(vendordir)/$(ruby_version)
|
33
|
-
vendordir = $(rubylibprefix)/vendor_ruby
|
34
|
-
sitearchdir = $(sitelibdir)/$(sitearch)
|
35
|
-
sitelibdir = $(sitedir)/$(ruby_version)
|
36
|
-
sitedir = $(rubylibprefix)/site_ruby
|
37
|
-
rubyarchdir = $(rubylibdir)/$(arch)
|
38
|
-
rubylibdir = $(rubylibprefix)/$(ruby_version)
|
39
|
-
sitearchincludedir = $(includedir)/$(sitearch)
|
40
|
-
archincludedir = $(includedir)/$(arch)
|
41
|
-
sitearchlibdir = $(libdir)/$(sitearch)
|
42
|
-
archlibdir = $(libdir)/$(arch)
|
43
|
-
ridir = $(datarootdir)/$(RI_BASE_NAME)
|
44
|
-
mandir = $(datarootdir)/man
|
45
|
-
localedir = $(datarootdir)/locale
|
46
|
-
libdir = $(exec_prefix)/lib
|
47
|
-
psdir = $(docdir)
|
48
|
-
pdfdir = $(docdir)
|
49
|
-
dvidir = $(docdir)
|
50
|
-
htmldir = $(docdir)
|
51
|
-
infodir = $(datarootdir)/info
|
52
|
-
docdir = $(datarootdir)/doc/$(PACKAGE)
|
53
|
-
oldincludedir = $(SDKROOT)/usr/include
|
54
|
-
includedir = $(prefix)/include
|
55
|
-
localstatedir = $(prefix)/var
|
56
|
-
sharedstatedir = $(prefix)/com
|
57
|
-
sysconfdir = $(prefix)/etc
|
58
|
-
datadir = $(datarootdir)
|
59
|
-
datarootdir = $(prefix)/share
|
60
|
-
libexecdir = $(exec_prefix)/libexec
|
61
|
-
sbindir = $(exec_prefix)/sbin
|
62
|
-
bindir = $(exec_prefix)/bin
|
63
|
-
archdir = $(rubyarchdir)
|
64
|
-
|
65
|
-
|
66
|
-
CC = gcc
|
67
|
-
CXX = g++
|
68
|
-
LIBRUBY = $(LIBRUBY_SO)
|
69
|
-
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
70
|
-
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
71
|
-
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static -framework Foundation
|
72
|
-
empty =
|
73
|
-
OUTFLAG = -o $(empty)
|
74
|
-
COUTFLAG = -o $(empty)
|
75
|
-
CSRCFLAG = $(empty)
|
76
|
-
|
77
|
-
RUBY_EXTCONF_H =
|
78
|
-
cflags = $(optflags) $(debugflags) $(warnflags)
|
79
|
-
cxxflags = $(optflags) $(debugflags) $(warnflags)
|
80
|
-
optflags = -O3
|
81
|
-
debugflags = -ggdb3
|
82
|
-
warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens
|
83
|
-
CCDLFLAGS = -fno-common
|
84
|
-
CFLAGS = $(CCDLFLAGS) $(cflags) -fno-common -pipe $(ARCH_FLAG)
|
85
|
-
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
86
|
-
DEFS =
|
87
|
-
CPPFLAGS = -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
|
88
|
-
CXXFLAGS = $(CCDLFLAGS) $(cxxflags) $(ARCH_FLAG)
|
89
|
-
ldflags = -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl@1.1/lib
|
90
|
-
dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl@1.1/lib
|
91
|
-
ARCH_FLAG =
|
92
|
-
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
93
|
-
LDSHARED = $(CC) -dynamic -bundle
|
94
|
-
LDSHAREDXX = $(CXX) -dynamic -bundle
|
95
|
-
AR = libtool -static
|
96
|
-
EXEEXT =
|
97
|
-
|
98
|
-
RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
|
99
|
-
RUBY_SO_NAME = ruby.2.5.3
|
100
|
-
RUBYW_INSTALL_NAME =
|
101
|
-
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
|
102
|
-
RUBYW_BASE_NAME = rubyw
|
103
|
-
RUBY_BASE_NAME = ruby
|
104
|
-
|
105
|
-
arch = x86_64-darwin18
|
106
|
-
sitearch = $(arch)
|
107
|
-
ruby_version = 2.5.0
|
108
|
-
ruby = $(bindir)/$(RUBY_BASE_NAME)
|
109
|
-
RUBY = $(ruby)
|
110
|
-
ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
|
111
|
-
|
112
|
-
RM = rm -f
|
113
|
-
RM_RF = $(RUBY) -run -e rm -- -rf
|
114
|
-
RMDIRS = rmdir -p
|
115
|
-
MAKEDIRS = /usr/local/opt/coreutils/bin/gmkdir -p
|
116
|
-
INSTALL = /usr/local/opt/coreutils/bin/ginstall -c
|
117
|
-
INSTALL_PROG = $(INSTALL) -m 0755
|
118
|
-
INSTALL_DATA = $(INSTALL) -m 644
|
119
|
-
COPY = cp
|
120
|
-
TOUCH = exit >
|
121
|
-
|
122
|
-
#### End of system configuration section. ####
|
123
|
-
|
124
|
-
preload =
|
125
|
-
libpath = . $(libdir) /usr/local/opt/libyaml/lib /usr/local/opt/readline/lib /usr/local/opt/libksba/lib /usr/local/opt/openssl@1.1/lib
|
126
|
-
LIBPATH = -L. -L$(libdir) -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl@1.1/lib
|
127
|
-
DEFFILE =
|
128
|
-
|
129
|
-
CLEANFILES = mkmf.log
|
130
|
-
DISTCLEANFILES =
|
131
|
-
DISTCLEANDIRS =
|
132
|
-
|
133
|
-
extout =
|
134
|
-
extout_prefix =
|
135
|
-
target_prefix =
|
136
|
-
LOCAL_LIBS =
|
137
|
-
LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl -lobjc
|
138
|
-
ORIG_SRCS = rumourhash.c
|
139
|
-
SRCS = $(ORIG_SRCS)
|
140
|
-
OBJS = rumourhash.o
|
141
|
-
HDRS =
|
142
|
-
LOCAL_HDRS =
|
143
|
-
TARGET = rumourhash
|
144
|
-
TARGET_NAME = rumourhash
|
145
|
-
TARGET_ENTRY = Init_$(TARGET_NAME)
|
146
|
-
DLLIB = $(TARGET).bundle
|
147
|
-
EXTSTATIC =
|
148
|
-
STATIC_LIB =
|
149
|
-
|
150
|
-
TIMESTAMP_DIR = .
|
151
|
-
BINDIR = $(bindir)
|
152
|
-
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
153
|
-
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
154
|
-
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
155
|
-
HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
|
156
|
-
ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
|
157
|
-
TARGET_SO_DIR =
|
158
|
-
TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
|
159
|
-
CLEANLIBS = $(TARGET_SO)
|
160
|
-
CLEANOBJS = *.o *.bak
|
161
|
-
|
162
|
-
all: $(DLLIB)
|
163
|
-
static: $(STATIC_LIB)
|
164
|
-
.PHONY: all install static install-so install-rb
|
165
|
-
.PHONY: clean clean-so clean-static clean-rb
|
166
|
-
|
167
|
-
clean-static::
|
168
|
-
clean-rb-default::
|
169
|
-
clean-rb::
|
170
|
-
clean-so::
|
171
|
-
clean: clean-so clean-static clean-rb-default clean-rb
|
172
|
-
-$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
|
173
|
-
|
174
|
-
distclean-rb-default::
|
175
|
-
distclean-rb::
|
176
|
-
distclean-so::
|
177
|
-
distclean-static::
|
178
|
-
distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
|
179
|
-
-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
180
|
-
-$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
181
|
-
-$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
|
182
|
-
|
183
|
-
realclean: distclean
|
184
|
-
install: install-so install-rb
|
185
|
-
|
186
|
-
install-so: $(DLLIB) $(TIMESTAMP_DIR)/.sitearchdir.time
|
187
|
-
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
188
|
-
clean-static::
|
189
|
-
-$(Q)$(RM) $(STATIC_LIB)
|
190
|
-
install-rb: pre-install-rb do-install-rb install-rb-default
|
191
|
-
install-rb-default: pre-install-rb-default do-install-rb-default
|
192
|
-
pre-install-rb: Makefile
|
193
|
-
pre-install-rb-default: Makefile
|
194
|
-
do-install-rb:
|
195
|
-
do-install-rb-default:
|
196
|
-
pre-install-rb-default:
|
197
|
-
@$(NULLCMD)
|
198
|
-
$(TIMESTAMP_DIR)/.sitearchdir.time:
|
199
|
-
$(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
|
200
|
-
$(Q) $(TOUCH) $@
|
201
|
-
|
202
|
-
site-install: site-install-so site-install-rb
|
203
|
-
site-install-so: install-so
|
204
|
-
site-install-rb: install-rb
|
205
|
-
|
206
|
-
.SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
|
207
|
-
|
208
|
-
.cc.o:
|
209
|
-
$(ECHO) compiling $(<)
|
210
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
211
|
-
|
212
|
-
.cc.S:
|
213
|
-
$(ECHO) translating $(<)
|
214
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
215
|
-
|
216
|
-
.mm.o:
|
217
|
-
$(ECHO) compiling $(<)
|
218
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
219
|
-
|
220
|
-
.mm.S:
|
221
|
-
$(ECHO) translating $(<)
|
222
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
223
|
-
|
224
|
-
.cxx.o:
|
225
|
-
$(ECHO) compiling $(<)
|
226
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
227
|
-
|
228
|
-
.cxx.S:
|
229
|
-
$(ECHO) translating $(<)
|
230
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
231
|
-
|
232
|
-
.cpp.o:
|
233
|
-
$(ECHO) compiling $(<)
|
234
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
235
|
-
|
236
|
-
.cpp.S:
|
237
|
-
$(ECHO) translating $(<)
|
238
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
239
|
-
|
240
|
-
.c.o:
|
241
|
-
$(ECHO) compiling $(<)
|
242
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
243
|
-
|
244
|
-
.c.S:
|
245
|
-
$(ECHO) translating $(<)
|
246
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
247
|
-
|
248
|
-
.m.o:
|
249
|
-
$(ECHO) compiling $(<)
|
250
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
251
|
-
|
252
|
-
.m.S:
|
253
|
-
$(ECHO) translating $(<)
|
254
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
255
|
-
|
256
|
-
$(TARGET_SO): $(OBJS) Makefile
|
257
|
-
$(ECHO) linking shared-object $(DLLIB)
|
258
|
-
-$(Q)$(RM) $(@)
|
259
|
-
$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
260
|
-
$(Q) $(POSTLINK)
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
$(OBJS): $(HDRS) $(ruby_headers)
|
@@ -1,99 +0,0 @@
|
|
1
|
-
require 'rumourhash/rumourhash'
|
2
|
-
|
3
|
-
include RumourHash
|
4
|
-
|
5
|
-
module Antlr4::Runtime
|
6
|
-
class MurmurHash
|
7
|
-
DEFAULT_SEED = 0
|
8
|
-
MASK_32 = 0xFFFFFFFF
|
9
|
-
|
10
|
-
def self.hash_int(num)
|
11
|
-
hash_code = 7
|
12
|
-
hash_code = RumourHash.rumour_hash_update_int(hash_code, num)
|
13
|
-
RumourHash.rumour_hash_finish(hash_code, 0)
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.hash_int_obj(num, obj)
|
17
|
-
hash_code = 7
|
18
|
-
hash_code = RumourHash.rumour_hash_update_int(hash_code, num)
|
19
|
-
hash_code = RumourHash.rumour_hash_update_int(hash_code, !obj.nil? ? obj.hash : 0)
|
20
|
-
RumourHash.rumour_hash_finish(hash_code, 2)
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.hash_int_int_obj_obj(num1, num2, obj1, obj2)
|
24
|
-
hash_code = 7
|
25
|
-
hash_code = RumourHash.rumour_hash_update_int(hash_code, num1)
|
26
|
-
hash_code = RumourHash.rumour_hash_update_int(hash_code, num2)
|
27
|
-
hash_code = RumourHash.rumour_hash_update_int(hash_code, !obj1.nil? ? obj1.hash : 0)
|
28
|
-
hash_code = RumourHash.rumour_hash_update_int(hash_code, !obj2.nil? ? obj2.hash : 0)
|
29
|
-
RumourHash.rumour_hash_finish(hash_code, 4)
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.hash_int_int(num1, num2)
|
33
|
-
hash_code = 7
|
34
|
-
hash_code = RumourHash.rumour_hash_update_int(hash_code, num1)
|
35
|
-
hash_code = RumourHash.rumour_hash_update_int(hash_code, num2)
|
36
|
-
RumourHash.rumour_hash_finish(hash_code, 2)
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.hash_objs(objs)
|
40
|
-
hash_code = 7
|
41
|
-
|
42
|
-
i = 0
|
43
|
-
while i < objs.length
|
44
|
-
obj = objs[i]
|
45
|
-
hash_code = RumourHash.rumour_hash_update_int(hash_code, !obj.nil? ? obj.hash : 0)
|
46
|
-
i += 1
|
47
|
-
end
|
48
|
-
|
49
|
-
RumourHash.rumour_hash_finish(hash_code, objs.length)
|
50
|
-
end
|
51
|
-
|
52
|
-
def self.hash_ints_objs(nums, objs)
|
53
|
-
hash_code = 7
|
54
|
-
|
55
|
-
i = 0
|
56
|
-
while i < objs.length
|
57
|
-
obj = objs[i]
|
58
|
-
hash_code = RumourHash.rumour_hash_update_int(hash_code, !obj.nil? ? obj.hash : 0)
|
59
|
-
i += 1
|
60
|
-
end
|
61
|
-
|
62
|
-
i = 0
|
63
|
-
while i < nums.length
|
64
|
-
num = nums[i]
|
65
|
-
hash_code = RumourHash.rumour_hash_update_int(hash_code, num)
|
66
|
-
i += 1
|
67
|
-
end
|
68
|
-
|
69
|
-
RumourHash.rumour_hash_finish(hash_code, 2 * objs.length)
|
70
|
-
end
|
71
|
-
|
72
|
-
def self.hash_ints(nums)
|
73
|
-
hash_code = 7
|
74
|
-
|
75
|
-
i = 0
|
76
|
-
while i < nums.length
|
77
|
-
num = nums[i]
|
78
|
-
hash_code = RumourHash.rumour_hash_update_int(hash_code, num)
|
79
|
-
i += 1
|
80
|
-
end
|
81
|
-
|
82
|
-
RumourHash.rumour_hash_finish(hash_code, 2 * nums.length)
|
83
|
-
end
|
84
|
-
|
85
|
-
private
|
86
|
-
|
87
|
-
def self.hash(data, seed)
|
88
|
-
hash = seed
|
89
|
-
i = 0
|
90
|
-
while i < data.length
|
91
|
-
value = data[i]
|
92
|
-
hash = RumourHash.rumour_hash_update_int(hash, !value.nil? ? value.hash : 0)
|
93
|
-
i += 1
|
94
|
-
end
|
95
|
-
|
96
|
-
RumourHash.rumour_hash_finish(hash, data.length)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|