parsanol 1.3.8-x86_64-linux → 1.3.9-x86_64-linux
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/lib/parsanol/3.2/parsanol_native.so +0 -0
- data/lib/parsanol/3.3/parsanol_native.so +0 -0
- data/lib/parsanol/3.4/parsanol_native.so +0 -0
- data/lib/parsanol/4.0/parsanol_native.so +0 -0
- data/lib/parsanol/native/transformer.rb +20 -3
- data/lib/parsanol/native.rb +21 -0
- data/lib/parsanol/slice.rb +4 -0
- data/lib/parsanol/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 920fc5933c1c669e58313a67ca15069071d3cc8bebd7fb252e6436d1954f958c
|
|
4
|
+
data.tar.gz: 667c599072cafd75f3c6fa2922c6bb4039694c21524ecb288aecd27e665ed761
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 58e47f46067ceb15b7310286ac69234e17b0b3a87ea5ae03f4bbbd9db3bab257c4269e917fe676727f9b4751d1e83c7ff44e72241bfc451275f26d53b73a7930
|
|
7
|
+
data.tar.gz: 83d3455b48b81b847c5b5bdfbbb40e1d42587cb0a0f34bc27748ab755ed9f9c221f4cb5eef51dffe2676bf52661dc1c1ca2e938ccb00f731811b6c5fb6f5f956
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -323,9 +323,26 @@ module Parsanol
|
|
|
323
323
|
all_items_are_hashes = non_hash_items.empty?
|
|
324
324
|
|
|
325
325
|
if all_items_are_hashes
|
|
326
|
-
#
|
|
327
|
-
item
|
|
328
|
-
|
|
326
|
+
# Check if merging would overwrite existing keys in merged_hash.
|
|
327
|
+
# If so, this is a repetition pattern (item >> (sep >> item).repeat)
|
|
328
|
+
# and should be kept as array, not merged.
|
|
329
|
+
# Example: merged_hash={namedTypeOrRename: A}, array=[{namedTypeOrRename: B}]
|
|
330
|
+
# → should produce [{namedTypeOrRename: A}, {namedTypeOrRename: B}]
|
|
331
|
+
existing_keys = merged_hash.keys
|
|
332
|
+
shares_keys = item.any? do |sub_item|
|
|
333
|
+
sub_item.is_a?(Hash) && sub_item.keys.intersect?(existing_keys)
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
if shares_keys
|
|
337
|
+
has_non_empty_array = true
|
|
338
|
+
item.each do |sub_item|
|
|
339
|
+
hash_count += 1 if sub_item.is_a?(Hash)
|
|
340
|
+
end
|
|
341
|
+
total_items += 1
|
|
342
|
+
else
|
|
343
|
+
item.each do |sub_item|
|
|
344
|
+
merged_hash.merge!(sub_item) if sub_item.is_a?(Hash)
|
|
345
|
+
end
|
|
329
346
|
end
|
|
330
347
|
else
|
|
331
348
|
# Non-empty repetition with non-hash items - mark that we should keep as array
|
data/lib/parsanol/native.rb
CHANGED
|
@@ -57,6 +57,27 @@ module Parsanol
|
|
|
57
57
|
grammar_atom)
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
+
# Memory-bounded parsing without packrat cache.
|
|
61
|
+
#
|
|
62
|
+
# This creates a fresh arena and empty cache per call, bounding memory
|
|
63
|
+
# to AST size rather than input × atoms. Use for large files.
|
|
64
|
+
#
|
|
65
|
+
# @param grammar [Parsanol::Atoms::Base] Ruby grammar definition
|
|
66
|
+
# @param input [String] Input string to parse
|
|
67
|
+
# @return [Hash, Array, Parsanol::Slice] Transformed AST
|
|
68
|
+
def parse_fresh(grammar, input)
|
|
69
|
+
raise LoadError, "Native parser not available" unless available?
|
|
70
|
+
|
|
71
|
+
grammar_json = if grammar.is_a?(String)
|
|
72
|
+
grammar
|
|
73
|
+
else
|
|
74
|
+
Parser.serialize_grammar(grammar)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
raw_ast = _parse_fresh_raw(grammar_json, input)
|
|
78
|
+
BatchDecoder.decode_and_flatten(raw_ast, input, Parsanol::Slice, grammar)
|
|
79
|
+
end
|
|
80
|
+
|
|
60
81
|
# Parse and return RAW AST without transformation.
|
|
61
82
|
#
|
|
62
83
|
# This returns the raw Parslet intermediate format before any transformation.
|
data/lib/parsanol/slice.rb
CHANGED
data/lib/parsanol/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: parsanol
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.9
|
|
5
5
|
platform: x86_64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-03-
|
|
11
|
+
date: 2026-03-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|