parsanol 1.3.124-arm-linux → 1.3.126-arm-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/parg/compiler.rb +7 -3
- data/lib/parsanol/version.rb +1 -1
- data/lib/parsanol/vm.rb +15 -6
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b875944f9e4504b567fcf811a42831cf31c1804945a681c9ce87342e468f7fc7
|
|
4
|
+
data.tar.gz: 2f1708d2394539c82e9d9d2b5a3c0a56135112165583361480370fa58d43c0c2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 157335ceb6abe3e2c568c4ce7d76f12f591a68459f5fb9d75c99de6a37dd4caa5d95ae83d48d10748328c2a3d3e9ab26a91253e6711f8fea6c6d07ee3df5212b
|
|
7
|
+
data.tar.gz: 8fd8137a8797d4d3c13359a517ae7d34797dfd4561052f292946bd499c274a93c4350231adb5954a3089b8fb700b126cb5533068562d5521c00e4891c1ed0671
|
|
@@ -632,8 +632,8 @@ module Parsanol
|
|
|
632
632
|
markers[literal] = node.a.to_sym if literal && !literal.strip.empty?
|
|
633
633
|
collect.call(@document.rules[node.a]) if @document.rules.key?(node.a)
|
|
634
634
|
when :alt, :seq then node.a.each { |b| collect.call(b) }
|
|
635
|
-
when :rep, :opt
|
|
636
|
-
when :pred then collect.call(node.b)
|
|
635
|
+
when :rep, :opt then collect.call(node.a)
|
|
636
|
+
when :cap, :pred then collect.call(node.b)
|
|
637
637
|
end
|
|
638
638
|
end
|
|
639
639
|
collect.call(@document.skip_declaration)
|
|
@@ -652,7 +652,11 @@ module Parsanol
|
|
|
652
652
|
case n.kind
|
|
653
653
|
when :lit then literal = n.a
|
|
654
654
|
when :seq, :alt then n.a.each { |c| walk.call(c) unless literal }
|
|
655
|
-
|
|
655
|
+
# :cap stores the capture NAME in `a` (a plain String) and the
|
|
656
|
+
# captured node in `b`; :pred stores its flag in `a`. Walking
|
|
657
|
+
# `a` on either crashes — descend through `b`.
|
|
658
|
+
when :rep, :opt then walk.call(n.a) unless literal
|
|
659
|
+
when :cap, :pred then walk.call(n.b) unless literal
|
|
656
660
|
end
|
|
657
661
|
end
|
|
658
662
|
walk.call(node)
|
data/lib/parsanol/version.rb
CHANGED
data/lib/parsanol/vm.rb
CHANGED
|
@@ -990,8 +990,12 @@ module Parsanol
|
|
|
990
990
|
@memoize = memoize
|
|
991
991
|
end
|
|
992
992
|
|
|
993
|
-
# The RE match's [
|
|
994
|
-
#
|
|
993
|
+
# The RE match's [span length, byte advance], both in BYTES: the
|
|
994
|
+
# interpreter's packed value spans are byte-based (STR packs the
|
|
995
|
+
# literal's byte length; ANY and the RUN ops pack the char's
|
|
996
|
+
# UTF-8 byte width; materialize byteslices the span), so the RE
|
|
997
|
+
# span must count bytes too. Single-class patterns match one
|
|
998
|
+
# character (its byte width); multi-character patterns (%i
|
|
995
999
|
# literals reach RE with no byte table) consume their full
|
|
996
1000
|
# length (ruby#357: advancing one character skipped the
|
|
997
1001
|
# pattern's remainder and let the parse re-match inside it).
|
|
@@ -1002,12 +1006,17 @@ module Parsanol
|
|
|
1002
1006
|
[w, w]
|
|
1003
1007
|
else
|
|
1004
1008
|
len = scanner.skip(pattern)
|
|
1005
|
-
[
|
|
1009
|
+
[len, len]
|
|
1006
1010
|
end
|
|
1007
1011
|
end
|
|
1008
1012
|
|
|
1009
|
-
# An RE instruction's match at pos: [matched?,
|
|
1010
|
-
# advance]
|
|
1013
|
+
# An RE instruction's match at pos: [matched?, span length, byte
|
|
1014
|
+
# advance], both lengths in BYTES (see #re_match_width: the
|
|
1015
|
+
# interpreter's spans are byte-based; a character count here
|
|
1016
|
+
# truncated every slice containing a multibyte character —
|
|
1017
|
+
# ruby#407: "Class[éin]" lost é's second continuation byte
|
|
1018
|
+
# because the span stored the run's char count and materialize
|
|
1019
|
+
# bytesliced it). Single-class patterns match one character;
|
|
1011
1020
|
# multi-character patterns (%i literals reach RE with no byte
|
|
1012
1021
|
# table) consume their FULL length (ruby#357: advancing one
|
|
1013
1022
|
# character skipped the pattern's remainder and let the parse
|
|
@@ -1030,7 +1039,7 @@ module Parsanol
|
|
|
1030
1039
|
[true, w, w]
|
|
1031
1040
|
else
|
|
1032
1041
|
len = scanner.skip(pattern)
|
|
1033
|
-
[true,
|
|
1042
|
+
[true, len, len]
|
|
1034
1043
|
end
|
|
1035
1044
|
end
|
|
1036
1045
|
|