parsanol 1.3.91-arm-linux → 1.3.92-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/3.2/parsanol_native.so +2 -2
- data/lib/parsanol/3.3/parsanol_native.so +2 -2
- data/lib/parsanol/3.4/parsanol_native.so +2 -2
- data/lib/parsanol/4.0/parsanol_native.so +2 -2
- data/lib/parsanol/native/libparsanol.so +0 -0
- data/lib/parsanol/parg/artifact.rb +30 -8
- data/lib/parsanol/parg/cli.rb +36 -2
- data/lib/parsanol/parg/compiler.rb +6 -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: 94ab60f4150519a940dd2084dcc399fe2e2691c94865d0673c128ef13e551e6c
|
|
4
|
+
data.tar.gz: f032f98ca251fbbff68a71dce5b143a64602b9956b91d5ab3da97b0cbccb8310
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f4f5e09e4f5e30fb52b3704e1348341ee2bdfab777392acdd11f98fce87e8aa0d9f69992abce1ecb137856857cac9d0d68b84717470db9235fb736e599bb54fe
|
|
7
|
+
data.tar.gz: 7d14b295b9e53af62f279c4c66201a492e5cf5b57a550077d69d2d40355d55b65e107e6c0b35b71d3e1ccb8b31231a4fc598c6da3228ef27fbeada7a08a9965d
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: data/lib/parsanol/3.2/parsanol_native.so
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 34018692 bytes
|
|
4
|
+
sha256: 73a0d5df2c8be448527b97be77cf17d2d32406a6fa95bad552ac33c93a3f53de
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: data/lib/parsanol/3.3/parsanol_native.so
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 34203972 bytes
|
|
4
|
+
sha256: c076da7d2462c80cffdaa4fee81a97622f90fd996cddc885ed0c1947bda237f4
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: data/lib/parsanol/3.4/parsanol_native.so
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 34198132 bytes
|
|
4
|
+
sha256: 42ec5b96bfe8efb05a8377c9ae8410635f8916e9e3ea84e2f9e6a8d741159b58
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: data/lib/parsanol/4.0/parsanol_native.so
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 34207868 bytes
|
|
4
|
+
sha256: 56addd9fe8da96b569b0e50b2b30a1a28c382ce12cc035a0debf42d7679d197e
|
|
Binary file
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "digest"
|
|
3
4
|
require "json"
|
|
4
5
|
require "yaml"
|
|
5
6
|
|
|
@@ -11,20 +12,21 @@ module Parsanol
|
|
|
11
12
|
# consume; the embedded PARG source lets a Ruby runtime recompile the atom
|
|
12
13
|
# tree locally without any other dependency.
|
|
13
14
|
class Artifact
|
|
14
|
-
attr_reader :envelope, :path, :tables_dir
|
|
15
|
+
attr_reader :envelope, :path, :tables_dir, :imports_dir
|
|
15
16
|
|
|
16
|
-
def self.load(path, tables_dir: nil)
|
|
17
|
+
def self.load(path, tables_dir: nil, imports_dir: nil)
|
|
17
18
|
envelope = JSON.parse(PARG.read_utf8(path))
|
|
18
|
-
new(envelope, path, tables_dir || File.dirname(path)
|
|
19
|
+
new(envelope, path, tables_dir || File.dirname(path),
|
|
20
|
+
imports_dir: imports_dir)
|
|
19
21
|
end
|
|
20
22
|
|
|
21
|
-
def self.from_json(text, tables_dir: nil)
|
|
22
|
-
new(JSON.parse(text), nil, tables_dir)
|
|
23
|
+
def self.from_json(text, tables_dir: nil, imports_dir: nil)
|
|
24
|
+
new(JSON.parse(text), nil, tables_dir, imports_dir: imports_dir)
|
|
23
25
|
end
|
|
24
26
|
|
|
25
27
|
SUPPORTED_SHAPE = "parsanol-tree/v2"
|
|
26
28
|
|
|
27
|
-
def initialize(envelope, path, tables_dir)
|
|
29
|
+
def initialize(envelope, path, tables_dir, imports_dir: nil)
|
|
28
30
|
unless envelope["shape"] == SUPPORTED_SHAPE
|
|
29
31
|
raise ArtifactError,
|
|
30
32
|
"unsupported artifact shape #{envelope['shape'].inspect} " \
|
|
@@ -38,12 +40,30 @@ module Parsanol
|
|
|
38
40
|
@envelope = envelope
|
|
39
41
|
@path = path
|
|
40
42
|
@tables_dir = tables_dir
|
|
43
|
+
# parsanol-ruby#208: `use`-importing grammars need the imported
|
|
44
|
+
# sources when the pure-Ruby path recompiles the embedded source;
|
|
45
|
+
# in-memory artifacts (path nil) pass the directory explicitly.
|
|
46
|
+
@imports_dir = imports_dir
|
|
41
47
|
verify_checksum!
|
|
42
48
|
@compiler = nil
|
|
43
49
|
end
|
|
44
50
|
|
|
45
51
|
def version = envelope["version"]
|
|
46
52
|
|
|
53
|
+
# Freshness (parsanol-ruby#209): what source revision and compiler
|
|
54
|
+
# produced this artifact. `source_hash` is the SHA-256 of the .parg
|
|
55
|
+
# text at compile time; nil on artifacts baked before the field
|
|
56
|
+
# existed, so `fresh_against?` answers false rather than guessing.
|
|
57
|
+
def source_hash = envelope["source_hash"]
|
|
58
|
+
|
|
59
|
+
def compiler_version = envelope["compiler_version"]
|
|
60
|
+
|
|
61
|
+
def fresh_against?(source_text)
|
|
62
|
+
return false if source_hash.nil?
|
|
63
|
+
|
|
64
|
+
source_hash == Digest::SHA256.hexdigest(source_text.to_s)
|
|
65
|
+
end
|
|
66
|
+
|
|
47
67
|
def entries = envelope["entries"].keys
|
|
48
68
|
|
|
49
69
|
def entry(name)
|
|
@@ -263,8 +283,10 @@ module Parsanol
|
|
|
263
283
|
# without this the pure-Ruby path fails on artifacts whose
|
|
264
284
|
# native atom graphs inline everything. The imported sources
|
|
265
285
|
# sit beside the artifact (vendors ship them together).
|
|
266
|
-
|
|
267
|
-
|
|
286
|
+
dirs = [path ? File.dirname(path) : nil, @imports_dir]
|
|
287
|
+
.compact
|
|
288
|
+
.select { |dir| File.directory?(dir) }
|
|
289
|
+
Imports.merge!(document, dirs) unless dirs.empty?
|
|
268
290
|
Compiler.new(document, @tables_dir)
|
|
269
291
|
end
|
|
270
292
|
end
|
data/lib/parsanol/parg/cli.rb
CHANGED
|
@@ -22,6 +22,10 @@ module Parsanol
|
|
|
22
22
|
test <file.parg|artifact.json> run the grammar's test section
|
|
23
23
|
parse <file> [--entry E] INPUT parse one input; prints the tree
|
|
24
24
|
and the bound captures
|
|
25
|
+
check --source x.parg --artifact y.json
|
|
26
|
+
verify the artifact was compiled
|
|
27
|
+
from that source (source hash +
|
|
28
|
+
compiler version); exit 1 stale
|
|
25
29
|
repl <file> [--entry E] interactive parse loop (blank
|
|
26
30
|
line quits, :quit exits)
|
|
27
31
|
doc <file> [rule] print rule documentation
|
|
@@ -53,6 +57,7 @@ module Parsanol
|
|
|
53
57
|
when "test" then test
|
|
54
58
|
when "schema" then schema
|
|
55
59
|
when "parse" then parse
|
|
60
|
+
when "check" then check
|
|
56
61
|
when "repl" then repl
|
|
57
62
|
when "doc" then doc
|
|
58
63
|
when "lsp" then Lsp.new.run && 0
|
|
@@ -88,6 +93,33 @@ module Parsanol
|
|
|
88
93
|
0
|
|
89
94
|
end
|
|
90
95
|
|
|
96
|
+
# Freshness (parsanol-ruby#209): verify an artifact was compiled
|
|
97
|
+
# from the given source. The stale-shipped-artifact incident class
|
|
98
|
+
# (an old artifact silently taking precedence over the corrected
|
|
99
|
+
# grammar) is undetectable without the recorded source hash.
|
|
100
|
+
# Exit 0 fresh, 1 stale or unrecorded.
|
|
101
|
+
def check
|
|
102
|
+
source = flag_value("--source")
|
|
103
|
+
artifact_path = flag_value("--artifact")
|
|
104
|
+
unless source && artifact_path && File.file?(source) && File.file?(artifact_path)
|
|
105
|
+
warn USAGE
|
|
106
|
+
return 1
|
|
107
|
+
end
|
|
108
|
+
artifact = Artifact.load(artifact_path)
|
|
109
|
+
if artifact.source_hash.nil?
|
|
110
|
+
puts "STALE? #{artifact_path}: no source hash recorded (pre-freshness artifact)"
|
|
111
|
+
return 1
|
|
112
|
+
end
|
|
113
|
+
if artifact.fresh_against?(PARG.read_utf8(source))
|
|
114
|
+
puts "FRESH #{artifact_path} == #{source} (compiler #{artifact.compiler_version})"
|
|
115
|
+
0
|
|
116
|
+
else
|
|
117
|
+
puts "STALE #{artifact_path} does not match #{source} " \
|
|
118
|
+
"(built from #{artifact.source_hash[0, 12]}… by #{artifact.compiler_version})"
|
|
119
|
+
1
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
91
123
|
def test
|
|
92
124
|
target = @argv.shift
|
|
93
125
|
if File.directory?(target)
|
|
@@ -200,11 +232,13 @@ module Parsanol
|
|
|
200
232
|
|
|
201
233
|
def artifact_for(file)
|
|
202
234
|
if file.end_with?(".json")
|
|
203
|
-
Parsanol::PARG::Artifact.load(file, tables_dir: @tables_dir || default_tables_dir(file)
|
|
235
|
+
Parsanol::PARG::Artifact.load(file, tables_dir: @tables_dir || default_tables_dir(file),
|
|
236
|
+
imports_dir: File.dirname(file))
|
|
204
237
|
else
|
|
205
238
|
artifact = compile_source(file)
|
|
206
239
|
Parsanol::PARG::Artifact.from_json(JSON.generate(artifact.envelope),
|
|
207
|
-
tables_dir: @tables_dir || default_tables_dir(file)
|
|
240
|
+
tables_dir: @tables_dir || default_tables_dir(file),
|
|
241
|
+
imports_dir: File.dirname(file))
|
|
208
242
|
end
|
|
209
243
|
end
|
|
210
244
|
|
|
@@ -758,6 +758,12 @@ module Parsanol
|
|
|
758
758
|
end,
|
|
759
759
|
"docs" => @document.docs,
|
|
760
760
|
"source" => @document.source,
|
|
761
|
+
# Freshness (parsanol-ruby#209): what the artifact was compiled
|
|
762
|
+
# from and with, so loaders can detect a stale artifact and fall
|
|
763
|
+
# back to a reference implementation instead of failing obscurely
|
|
764
|
+
# at parse time. Checksummed like the rest of the envelope.
|
|
765
|
+
"source_hash" => Digest::SHA256.hexdigest(@document.source.to_s),
|
|
766
|
+
"compiler_version" => Parsanol::VERSION,
|
|
761
767
|
}
|
|
762
768
|
if @document.skip_declaration
|
|
763
769
|
# parsanol-ruby#134: declared trivia rule. Injection is baked
|
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.92
|
|
5
5
|
platform: arm-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-15 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
|