parsanol 1.3.30-arm-linux → 1.3.32-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/README.adoc +18 -0
- 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/version.rb +1 -1
- data/lib/parsanol.rb +50 -0
- 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: bcc6dfae6ffa797eb5cf348321b8ba478685f164c87b9f6d5631ae5d4c875772
|
|
4
|
+
data.tar.gz: 49305e9b8acbf788ebcb7dab375a5e4343652d573b949b33442cad9945f1d028
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 60b8818a30dae829cdd46a49a7315b25c0e29471280c52f322539feb8e6ca5b62dfe90bc6e633faa13f6dc72e236775065ec458b98999015decf5b3c2df62243
|
|
7
|
+
data.tar.gz: cd69af0d55393572413d6378fa3e6992a1275f18b797fa45a0095bdfb38b028ab08e8c0dea3ddaea62fe8900e7c46eb3cfc8226d793ea745259be272a9d243f6
|
data/README.adoc
CHANGED
|
@@ -156,6 +156,24 @@ Run your own benchmarks with:
|
|
|
156
156
|
bundle exec ruby examples/benchmark_examples.rb
|
|
157
157
|
----
|
|
158
158
|
|
|
159
|
+
[[engine-posture]]
|
|
160
|
+
==== Engine roles
|
|
161
|
+
|
|
162
|
+
Parsanol ships two engines with one semantic contract (identical parse
|
|
163
|
+
trees and error messages):
|
|
164
|
+
|
|
165
|
+
* **Native (default)** — the Rust extension. It handles every parsing
|
|
166
|
+
mode, including error cause trees, `prefix:` and `reporter:`, with no
|
|
167
|
+
Ruby fallback during parsing. Prebuilt platform gems cover the common
|
|
168
|
+
triples; `bundle exec rake compile` builds it locally otherwise.
|
|
169
|
+
* **Ruby (`mode: :ruby`)** — the pure-Ruby engine. Its role is
|
|
170
|
+
portability (no prebuilt gem, no Rust toolchain, non-MRI rubies) and
|
|
171
|
+
serving as the semantic reference implementation for differential
|
|
172
|
+
testing against Parslet.
|
|
173
|
+
|
|
174
|
+
When both are available, the native engine is always used unless
|
|
175
|
+
`mode: :ruby` is requested explicitly.
|
|
176
|
+
|
|
159
177
|
[[slice-support]]
|
|
160
178
|
=== Slice Support
|
|
161
179
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/parsanol/version.rb
CHANGED
data/lib/parsanol.rb
CHANGED
|
@@ -129,10 +129,60 @@ module Parsanol
|
|
|
129
129
|
def match(pattern = nil)
|
|
130
130
|
return CharacterClassBuilder.new unless pattern
|
|
131
131
|
|
|
132
|
+
match_quantifier_warning(pattern)
|
|
132
133
|
Atoms::Re.new(pattern)
|
|
133
134
|
end
|
|
134
135
|
module_function :match
|
|
135
136
|
|
|
137
|
+
# `match` consumes exactly one character (Parslet parity), so a regex
|
|
138
|
+
# quantifier is silently truncated: match(/[0-9]+/) matches a single
|
|
139
|
+
# digit. Warn once per offending pattern — the intended spelling is
|
|
140
|
+
# `match("[0-9]").repeat(1)`.
|
|
141
|
+
# Deliberately mutable: it accumulates warned patterns per process.
|
|
142
|
+
QUANTIFIER_WARNED = {} # rubocop:disable Style/MutableConstant
|
|
143
|
+
private_constant :QUANTIFIER_WARNED
|
|
144
|
+
|
|
145
|
+
def match_quantifier_warning(pattern)
|
|
146
|
+
return if QUANTIFIER_WARNED.key?(pattern)
|
|
147
|
+
return unless pattern.is_a?(String)
|
|
148
|
+
return unless quantified_pattern?(pattern)
|
|
149
|
+
|
|
150
|
+
QUANTIFIER_WARNED[pattern] = true
|
|
151
|
+
warn "Parsanol: match(#{pattern.inspect}) matches exactly one character " \
|
|
152
|
+
"(Parslet parity); the quantifier is ignored. " \
|
|
153
|
+
"Use match(...).repeat(1) to match repeatedly."
|
|
154
|
+
end
|
|
155
|
+
module_function :match_quantifier_warning
|
|
156
|
+
|
|
157
|
+
# True when the pattern carries a top-level quantifier (+, *, ?, or
|
|
158
|
+
# {n,m}) outside a character class.
|
|
159
|
+
def quantified_pattern?(pattern)
|
|
160
|
+
in_class = false
|
|
161
|
+
escaped = false
|
|
162
|
+
previous = nil
|
|
163
|
+
|
|
164
|
+
pattern.each_char.with_index do |ch, idx|
|
|
165
|
+
if escaped
|
|
166
|
+
escaped = false
|
|
167
|
+
elsif ch == "\\"
|
|
168
|
+
escaped = true
|
|
169
|
+
elsif in_class
|
|
170
|
+
in_class = false if ch == "]"
|
|
171
|
+
elsif ch == "["
|
|
172
|
+
in_class = true
|
|
173
|
+
elsif %w[+ * ?].include?(ch) || (ch == "{" && idx + 1 < pattern.length && pattern[idx + 1] =~ /\d/)
|
|
174
|
+
# A leading quantifier applies to nothing and cannot truncate a
|
|
175
|
+
# character match; any other quantifier does.
|
|
176
|
+
return true if idx.positive? && !previous.nil? && previous != "("
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
previous = ch
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
false
|
|
183
|
+
end
|
|
184
|
+
module_function :quantified_pattern?
|
|
185
|
+
|
|
136
186
|
# Creates a literal string matcher.
|
|
137
187
|
#
|
|
138
188
|
# @param literal [String] the string to match
|
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.32
|
|
5
5
|
platform: arm-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-09-
|
|
11
|
+
date: 2026-09-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A small Ruby library for constructing parsers in the PEG (Parsing Expression
|
|
14
14
|
Grammar) fashion. Parsanol provides Parslet-compatible API with additional features
|