expressir 2.4.50-aarch64-linux → 2.4.52-aarch64-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/expressir.gemspec +1 -1
- data/grammar-parg/atoms_to_parg.rb +136 -14
- data/grammar-parg/atoms_to_parg_jit.rb.txt.bak +315 -0
- data/grammar-parg/deepest.rb +21 -0
- data/grammar-parg/express-grammar.artifact.json +1 -1
- data/grammar-parg/express-grammar.parg +145 -295
- data/grammar-parg/express_keywords.parg +123 -130
- data/grammar-parg/express_literals.parg +5 -11
- data/grammar-parg/express_operators.parg +23 -32
- data/grammar-parg/express_remarks.parg +5 -17
- data/grammar-parg/parity-model.rb +3 -1
- data/grammar-parg/parity.sh +11 -7
- data/lib/expressir/3.2/expressir_core.so +0 -0
- data/lib/expressir/3.3/expressir_core.so +0 -0
- data/lib/expressir/3.4/expressir_core.so +0 -0
- data/lib/expressir/4.0/expressir_core.so +0 -0
- data/lib/expressir/commands/base.rb +13 -0
- data/lib/expressir/commands/validate.rb +6 -0
- data/lib/expressir/commands/validate_load.rb +23 -15
- data/lib/expressir/commands/validate_remarks.rb +16 -4
- data/lib/expressir/express/core.rb +7 -0
- data/lib/expressir/express/grammar/express-grammar.artifact.json +1 -1
- data/lib/expressir/express/grammar/parg/express_keywords.parg +125 -0
- data/lib/expressir/express/grammar/parg/express_literals.parg +8 -0
- data/lib/expressir/express/grammar/parg/express_operators.parg +25 -0
- data/lib/expressir/express/grammar/parg/express_remarks.parg +7 -0
- data/lib/expressir/express/grammar/parser.rb +10 -1
- data/lib/expressir/express/remark_scanner.rb +21 -0
- data/lib/expressir/version.rb +1 -1
- metadata +9 -5
- data/grammar-parg/express.parg +0 -57
- data/grammar-parg/express_structure.parg +0 -11
data/grammar-parg/parity.sh
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# Corpus parity (issue #578 STEP 1 gate): every .exp fixture must parse
|
|
3
3
|
# identically through the DSL and the edition-2 artifact.
|
|
4
|
-
# PARITY_LIB: a parsanol checkout whose lib/ carries
|
|
5
|
-
# PARITY_LIB=~/src/lutaml/parsanol-
|
|
4
|
+
# PARITY_LIB: a parsanol checkout whose lib/ carries unreleased fixes —
|
|
5
|
+
# PARITY_LIB=~/src/lutaml/parsanol-noedition1/lib ./parity.sh
|
|
6
|
+
# (applies to the CLI artifact lane too, not just the in-process one)
|
|
6
7
|
set -uo pipefail
|
|
7
8
|
cd "$(dirname "$0")"
|
|
8
|
-
EXE
|
|
9
|
+
EXE="${PARSANOL_EXE:-$(bundle exec which parsanol)}"
|
|
10
|
+
ARTIFACT="$(pwd)/express-grammar.artifact.json"
|
|
9
11
|
LIB="${PARITY_LIB:-}"
|
|
10
12
|
|
|
11
13
|
# Oversized fixtures bypass the CLI argv limit: parse through the
|
|
@@ -13,14 +15,16 @@ LIB="${PARITY_LIB:-}"
|
|
|
13
15
|
big_parity() {
|
|
14
16
|
ruby ${LIB:+-I "$LIB"} -e '
|
|
15
17
|
require "parsanol"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
# The split artifact replays its source; the component sources must
|
|
19
|
+
# sit beside it (imports_dir), exactly as the gem lane passes them.
|
|
20
|
+
artifact = Parsanol::PARG::Artifact.from_json(
|
|
21
|
+
File.read(ARGV[1]), imports_dir: File.dirname(ARGV[1]))
|
|
18
22
|
begin
|
|
19
23
|
artifact.parse("syntax", File.read(ARGV[0]), mode: :ruby)
|
|
20
24
|
exit 0
|
|
21
25
|
rescue StandardError
|
|
22
26
|
exit 1
|
|
23
|
-
end' "$1" > /dev/null 2>&1
|
|
27
|
+
end' "$1" "$ARTIFACT" > /dev/null 2>&1
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
pass=0; fail=0; skipped=0
|
|
@@ -43,7 +47,7 @@ for f in $(find /Users/mulgogi/src/lutaml/expressir/spec -name "*.exp" | sort);
|
|
|
43
47
|
fi
|
|
44
48
|
src="$(cat "$f")"
|
|
45
49
|
# artifact accept?
|
|
46
|
-
if ruby "$EXE" parg parse
|
|
50
|
+
if ruby ${LIB:+-I "$LIB"} "$EXE" parg parse "$ARTIFACT" --entry syntax "$src" \
|
|
47
51
|
> /tmp/par-artifact.log 2>&1; then art=ok; else art=fail; fi
|
|
48
52
|
# DSL accept?
|
|
49
53
|
if bundle exec ruby -e '
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require "etc"
|
|
2
|
+
|
|
1
3
|
module Expressir
|
|
2
4
|
module Commands
|
|
3
5
|
class Base
|
|
@@ -7,6 +9,17 @@ module Expressir
|
|
|
7
9
|
@options = options
|
|
8
10
|
end
|
|
9
11
|
|
|
12
|
+
# The parallel-parse worker count for the validate family: the
|
|
13
|
+
# explicit --jobs value, or every core (issue #584). The
|
|
14
|
+
# ParallelFiles facility degrades to sequential where fork is
|
|
15
|
+
# unavailable (e.g. Windows).
|
|
16
|
+
def jobs_count
|
|
17
|
+
jobs = options[:jobs]
|
|
18
|
+
return jobs if jobs.is_a?(Integer) && jobs >= 1
|
|
19
|
+
|
|
20
|
+
Etc.nprocessors
|
|
21
|
+
end
|
|
22
|
+
|
|
10
23
|
# Common utilities that all commands might need
|
|
11
24
|
def say(message)
|
|
12
25
|
# Use instance variable for testability - if output is set, use it
|
|
@@ -29,6 +29,9 @@ module Expressir
|
|
|
29
29
|
DESC
|
|
30
30
|
method_option :verbose, type: :boolean, default: false,
|
|
31
31
|
desc: "Show verbose output"
|
|
32
|
+
method_option :jobs, type: :numeric,
|
|
33
|
+
desc: "Parallel parse workers (issue #584; " \
|
|
34
|
+
"default: every core, 1 = sequential)"
|
|
32
35
|
def load(*paths)
|
|
33
36
|
ValidateLoad.new(options).run(paths)
|
|
34
37
|
end
|
|
@@ -83,6 +86,9 @@ module Expressir
|
|
|
83
86
|
desc "remarks PATH_OR_MANIFEST",
|
|
84
87
|
"Validate remark blocks: a block anchor ([[name]]) must be " \
|
|
85
88
|
"defined in a single remark scope per schema"
|
|
89
|
+
method_option :jobs, type: :numeric,
|
|
90
|
+
desc: "Parallel parse workers (issue #584; " \
|
|
91
|
+
"default: every core, 1 = sequential)"
|
|
86
92
|
def remarks(*paths)
|
|
87
93
|
ValidateRemarks.new(options).run(paths)
|
|
88
94
|
end
|
|
@@ -40,18 +40,36 @@ module Expressir
|
|
|
40
40
|
no_version = []
|
|
41
41
|
no_valid = []
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
# The parses fan out across forked workers (issue #584); the
|
|
44
|
+
# reporting stays on the main thread, in input order. Small
|
|
45
|
+
# sets stay sequential (the facility's own threshold).
|
|
46
|
+
parse = ->(path) do
|
|
47
|
+
Expressir::Express::Parser.from_file(path)
|
|
48
|
+
rescue StandardError
|
|
49
|
+
nil
|
|
50
|
+
end
|
|
51
|
+
results =
|
|
52
|
+
if Expressir::Express::ParallelFiles.sequential?(paths, jobs_count)
|
|
53
|
+
paths.map { |path| parse.call(path) }
|
|
54
|
+
else
|
|
55
|
+
Expressir::Express::ParallelFiles.run(
|
|
56
|
+
paths, parse: parse, max_processes: jobs_count
|
|
57
|
+
)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
paths.zip(results).each do |path, repository|
|
|
44
61
|
x = Pathname.new(path).realpath.relative_path_from(Dir.pwd)
|
|
45
62
|
say "Validating #{x}"
|
|
46
|
-
ret = validate_schema(path)
|
|
47
63
|
|
|
48
|
-
if
|
|
64
|
+
if repository.nil?
|
|
49
65
|
no_valid << "Failed to parse: #{x}"
|
|
50
66
|
next
|
|
51
67
|
end
|
|
52
68
|
|
|
53
|
-
|
|
54
|
-
|
|
69
|
+
repository.schemas.each do |schema|
|
|
70
|
+
unless schema.version&.value
|
|
71
|
+
no_version << "Missing version string: schema `#{schema.id}` | #{x}"
|
|
72
|
+
end
|
|
55
73
|
end
|
|
56
74
|
end
|
|
57
75
|
|
|
@@ -68,16 +86,6 @@ module Expressir
|
|
|
68
86
|
say "Validation passed for all EXPRESS schemas."
|
|
69
87
|
end
|
|
70
88
|
|
|
71
|
-
def validate_schema(path)
|
|
72
|
-
repository = Expressir::Express::Parser.from_file(path)
|
|
73
|
-
repository.schemas.inject([]) do |acc, schema|
|
|
74
|
-
acc << schema.id unless schema.version&.value
|
|
75
|
-
acc
|
|
76
|
-
end
|
|
77
|
-
rescue StandardError
|
|
78
|
-
nil
|
|
79
|
-
end
|
|
80
|
-
|
|
81
89
|
def print_validation_errors(type, array)
|
|
82
90
|
return if array.empty?
|
|
83
91
|
|
|
@@ -52,10 +52,22 @@ module Expressir
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
def validate_from_paths(paths)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
files = schema_paths(paths)
|
|
56
|
+
# The parses fan out across forked workers (issue #584); a
|
|
57
|
+
# parse failure raises in input order, exactly like the
|
|
58
|
+
# sequential pass did. Small sets stay sequential (the
|
|
59
|
+
# facility's own threshold).
|
|
60
|
+
parse = ->(path) { Expressir::Express::Parser.from_file(path) }
|
|
61
|
+
results =
|
|
62
|
+
if Expressir::Express::ParallelFiles.sequential?(files, jobs_count)
|
|
63
|
+
files.map { |path| parse.call(path) }
|
|
64
|
+
else
|
|
65
|
+
Expressir::Express::ParallelFiles.run(
|
|
66
|
+
files, parse: parse, max_processes: jobs_count, strict: true
|
|
67
|
+
)
|
|
68
|
+
end
|
|
69
|
+
parsed = files.zip(results)
|
|
70
|
+
.filter_map { |path, repository| repository && [path, repository.schemas] }
|
|
59
71
|
schema_ids = parsed.flat_map { |_, schemas| schemas.map(&:id) }
|
|
60
72
|
.map { |id| id.to_s.downcase }
|
|
61
73
|
|
|
@@ -40,6 +40,13 @@ module Expressir
|
|
|
40
40
|
JSON.parse(::Expressir::Core.parse_to_model_hash(source, path))
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
+
# Scan remarks (issue #20): an Array of Hashes mirroring
|
|
44
|
+
# RemarkScanner::Remark's fields (position, end_position, line,
|
|
45
|
+
# text, tag, format), straight from the Rust scanner.
|
|
46
|
+
def self.scan_remarks(source)
|
|
47
|
+
::Expressir::Core.scan_remarks(source)
|
|
48
|
+
end
|
|
49
|
+
|
|
43
50
|
# Parse EXPRESS source into the hydrated model directly: the
|
|
44
51
|
# extension walks the wire definition once and constructs every
|
|
45
52
|
# node through Serializable.instantiate (lutaml-model's fast
|