expressir 2.4.46 → 2.4.48
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/Gemfile +5 -1
- data/expressir.gemspec +6 -3
- data/grammar-parg/CONVENTIONS.md +90 -0
- data/grammar-parg/RULE-INVENTORY.txt +252 -0
- data/grammar-parg/atoms_to_parg.rb +232 -0
- data/grammar-parg/bisect.sh +37 -0
- data/grammar-parg/ddmin.sh +39 -0
- data/grammar-parg/dsl-dump.json +1 -0
- data/grammar-parg/entries.parg.frag +12 -0
- data/grammar-parg/express-grammar.artifact.json +1 -0
- data/grammar-parg/express-grammar.parg +380 -0
- data/grammar-parg/express.json +1 -0
- data/grammar-parg/express.parg +57 -0
- data/grammar-parg/express_keywords.parg +132 -0
- data/grammar-parg/express_literals.parg +14 -0
- data/grammar-parg/express_operators.parg +34 -0
- data/grammar-parg/express_remarks.parg +19 -0
- data/grammar-parg/express_structure.parg +11 -0
- data/grammar-parg/generate-terminals.rb +55 -0
- data/grammar-parg/keywords.parg.frag +130 -0
- data/grammar-parg/literals.parg.frag +9 -0
- data/grammar-parg/operators.parg.frag +34 -0
- data/grammar-parg/parity-model.rb +68 -0
- data/grammar-parg/parity-vm.rb +60 -0
- data/grammar-parg/parity.sh +66 -0
- data/grammar-parg/parser-dsl-reference.rb.txt +757 -0
- data/grammar-parg/splice.rb +16 -0
- data/grammar-parg/tree_diff.rb +62 -0
- data/lib/expressir/express/grammar/express-grammar.artifact.json +1 -0
- data/lib/expressir/express/grammar/parser.rb +38 -0
- data/lib/expressir/express/parser.rb +3 -3
- data/lib/expressir/express/remark_attacher.rb +4 -2
- data/lib/expressir/model/exp_file.rb +1 -1
- data/lib/expressir/model/model_element.rb +3 -0
- data/lib/expressir/p28/configuration.rb +3 -1
- data/lib/expressir/version.rb +1 -1
- metadata +37 -16
|
@@ -126,6 +126,44 @@ module Expressir
|
|
|
126
126
|
end
|
|
127
127
|
end
|
|
128
128
|
|
|
129
|
+
# The compiled edition-2 PARG artifact: the DSL grammar's
|
|
130
|
+
# serialized twin (grammar-parg/express-grammar.parg, built by
|
|
131
|
+
# grammar-parg/atoms_to_parg.rb from the live atom tree). The
|
|
132
|
+
# artifact lane parses through parsanol's artifact VM and
|
|
133
|
+
# yields the same named trees the DSL path produces.
|
|
134
|
+
ARTIFACT_PATH = File.join(__dir__, "express-grammar.artifact.json")
|
|
135
|
+
|
|
136
|
+
def self.artifact_available?
|
|
137
|
+
return @artifact_available unless @artifact_available.nil?
|
|
138
|
+
|
|
139
|
+
@artifact_available = begin
|
|
140
|
+
require "parsanol/parg/artifact"
|
|
141
|
+
Parsanol::PARG::Artifact.respond_to?(:from_json) && File.exist?(ARTIFACT_PATH)
|
|
142
|
+
rescue LoadError
|
|
143
|
+
false
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def self.parse_artifact(source)
|
|
148
|
+
raise LoadError, "Edition-2 artifact not available" unless artifact_available?
|
|
149
|
+
|
|
150
|
+
@parser_mutex.synchronize do
|
|
151
|
+
@artifact ||= Parsanol::PARG::Artifact.from_json(File.read(ARTIFACT_PATH))
|
|
152
|
+
end
|
|
153
|
+
# mode: :native rides the rs VM when the parsanol native ext
|
|
154
|
+
# is present and falls back to the ruby atom evaluation
|
|
155
|
+
# otherwise (Artifact#parse's own lane logic).
|
|
156
|
+
@artifact.parse("syntax", source)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# The Ruby-lane parse: the edition-2 artifact first, the DSL
|
|
160
|
+
# parser as fallback (issue #578 STEP 4).
|
|
161
|
+
def self.parse_ruby(source)
|
|
162
|
+
parse_artifact(source)
|
|
163
|
+
rescue StandardError, NotImplementedError
|
|
164
|
+
cached_parser.parse(source)
|
|
165
|
+
end
|
|
166
|
+
|
|
129
167
|
def cts(atom)
|
|
130
168
|
spaces >> atom
|
|
131
169
|
end
|
|
@@ -79,10 +79,10 @@ module Expressir
|
|
|
79
79
|
begin
|
|
80
80
|
Grammar::Parser.parse_native(source)
|
|
81
81
|
rescue StandardError
|
|
82
|
-
Grammar::Parser.
|
|
82
|
+
Grammar::Parser.parse_ruby(source)
|
|
83
83
|
end
|
|
84
84
|
else
|
|
85
|
-
Grammar::Parser.
|
|
85
|
+
Grammar::Parser.parse_ruby(source)
|
|
86
86
|
end
|
|
87
87
|
rescue Parsanol::ParseFailed => e
|
|
88
88
|
raise Error::SchemaParseFailure.new(schema_file, e)
|
|
@@ -483,7 +483,7 @@ include_source: nil, root_path: nil, use_native: nil, &block)
|
|
|
483
483
|
ast = if use_native && Grammar::Parser.native_available?
|
|
484
484
|
Grammar::Parser.parse_native(content)
|
|
485
485
|
else
|
|
486
|
-
Grammar::Parser.
|
|
486
|
+
Grammar::Parser.parse_ruby(content)
|
|
487
487
|
end
|
|
488
488
|
rescue Parsanol::ParseFailed, StandardError => e
|
|
489
489
|
raise Error::SchemaParseFailure.new("(from string)", e)
|
|
@@ -930,6 +930,9 @@ module Expressir
|
|
|
930
930
|
|
|
931
931
|
def normalize_path(path)
|
|
932
932
|
return path unless path.include?(":")
|
|
933
|
+
# `__note:two` is one item id (a referable note/example), not a
|
|
934
|
+
# prefix:name pair to split into two path segments.
|
|
935
|
+
return path if path.split(".").last.start_with?("__")
|
|
933
936
|
|
|
934
937
|
path_part, _, item_suffix = path.rpartition(":")
|
|
935
938
|
"#{path_part}.#{item_suffix}"
|
|
@@ -1126,8 +1129,7 @@ module Expressir
|
|
|
1126
1129
|
end
|
|
1127
1130
|
|
|
1128
1131
|
def safe_reset_children_by_id(obj)
|
|
1129
|
-
return unless obj
|
|
1130
|
-
return unless obj.is_a?(Model::ScopeContainer)
|
|
1132
|
+
return unless obj.respond_to?(:reset_children_by_id)
|
|
1131
1133
|
|
|
1132
1134
|
obj.reset_children_by_id
|
|
1133
1135
|
end
|
|
@@ -17,7 +17,7 @@ module Expressir
|
|
|
17
17
|
collection_attributes :schemas
|
|
18
18
|
|
|
19
19
|
attribute :path, :string
|
|
20
|
-
attribute :schemas, Declarations::Schema, collection: true,
|
|
20
|
+
attribute :schemas, Declarations::Schema, collection: true,
|
|
21
21
|
initialize_empty: true
|
|
22
22
|
attribute :_class, :string, default: -> { self.class.name }
|
|
23
23
|
|
|
@@ -210,6 +210,9 @@ module Expressir
|
|
|
210
210
|
return self if path.nil? || path.empty?
|
|
211
211
|
|
|
212
212
|
path_parts = path.safe_downcase.split(".").map do |current_path|
|
|
213
|
+
# `__note:two` is a remark item id, not a prefixed name
|
|
214
|
+
next current_path if current_path.start_with?("__")
|
|
215
|
+
|
|
213
216
|
_, _, current_path = current_path.rpartition(":") # ignore prefix
|
|
214
217
|
current_path
|
|
215
218
|
end
|
|
@@ -114,7 +114,9 @@ module Expressir
|
|
|
114
114
|
return parent.attribute("select").value if parent.element? &&
|
|
115
115
|
parent.name == "entity"
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
# The walk stops at the document node: moxml 0.6 adapters do
|
|
118
|
+
# not answer #parent on it.
|
|
119
|
+
parent = parent.is_a?(Moxml::Document) ? nil : parent.parent
|
|
118
120
|
end
|
|
119
121
|
nil
|
|
120
122
|
end
|
data/lib/expressir/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: expressir
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.4.
|
|
4
|
+
version: 2.4.48
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rb_sys
|
|
@@ -100,28 +100,28 @@ dependencies:
|
|
|
100
100
|
requirements:
|
|
101
101
|
- - "~>"
|
|
102
102
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: 0.8.
|
|
103
|
+
version: 0.8.156
|
|
104
104
|
type: :runtime
|
|
105
105
|
prerelease: false
|
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
|
108
108
|
- - "~>"
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: 0.8.
|
|
110
|
+
version: 0.8.156
|
|
111
111
|
- !ruby/object:Gem::Dependency
|
|
112
112
|
name: moxml
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
|
115
|
-
- - "
|
|
115
|
+
- - "~>"
|
|
116
116
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: 0.
|
|
117
|
+
version: 0.6.0
|
|
118
118
|
type: :runtime
|
|
119
119
|
prerelease: false
|
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
121
|
requirements:
|
|
122
|
-
- - "
|
|
122
|
+
- - "~>"
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: 0.
|
|
124
|
+
version: 0.6.0
|
|
125
125
|
- !ruby/object:Gem::Dependency
|
|
126
126
|
name: paint
|
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -142,20 +142,14 @@ dependencies:
|
|
|
142
142
|
requirements:
|
|
143
143
|
- - "~>"
|
|
144
144
|
- !ruby/object:Gem::Version
|
|
145
|
-
version: 1.3.
|
|
146
|
-
- - ">="
|
|
147
|
-
- !ruby/object:Gem::Version
|
|
148
|
-
version: 1.3.89
|
|
145
|
+
version: 1.3.123
|
|
149
146
|
type: :runtime
|
|
150
147
|
prerelease: false
|
|
151
148
|
version_requirements: !ruby/object:Gem::Requirement
|
|
152
149
|
requirements:
|
|
153
150
|
- - "~>"
|
|
154
151
|
- !ruby/object:Gem::Version
|
|
155
|
-
version: 1.3.
|
|
156
|
-
- - ">="
|
|
157
|
-
- !ruby/object:Gem::Version
|
|
158
|
-
version: 1.3.89
|
|
152
|
+
version: 1.3.123
|
|
159
153
|
- !ruby/object:Gem::Dependency
|
|
160
154
|
name: ruby-progressbar
|
|
161
155
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -474,6 +468,32 @@ files:
|
|
|
474
468
|
- ext/expressir_core/Cargo.toml
|
|
475
469
|
- ext/expressir_core/extconf.rb
|
|
476
470
|
- ext/expressir_core/src/lib.rs
|
|
471
|
+
- grammar-parg/CONVENTIONS.md
|
|
472
|
+
- grammar-parg/RULE-INVENTORY.txt
|
|
473
|
+
- grammar-parg/atoms_to_parg.rb
|
|
474
|
+
- grammar-parg/bisect.sh
|
|
475
|
+
- grammar-parg/ddmin.sh
|
|
476
|
+
- grammar-parg/dsl-dump.json
|
|
477
|
+
- grammar-parg/entries.parg.frag
|
|
478
|
+
- grammar-parg/express-grammar.artifact.json
|
|
479
|
+
- grammar-parg/express-grammar.parg
|
|
480
|
+
- grammar-parg/express.json
|
|
481
|
+
- grammar-parg/express.parg
|
|
482
|
+
- grammar-parg/express_keywords.parg
|
|
483
|
+
- grammar-parg/express_literals.parg
|
|
484
|
+
- grammar-parg/express_operators.parg
|
|
485
|
+
- grammar-parg/express_remarks.parg
|
|
486
|
+
- grammar-parg/express_structure.parg
|
|
487
|
+
- grammar-parg/generate-terminals.rb
|
|
488
|
+
- grammar-parg/keywords.parg.frag
|
|
489
|
+
- grammar-parg/literals.parg.frag
|
|
490
|
+
- grammar-parg/operators.parg.frag
|
|
491
|
+
- grammar-parg/parity-model.rb
|
|
492
|
+
- grammar-parg/parity-vm.rb
|
|
493
|
+
- grammar-parg/parity.sh
|
|
494
|
+
- grammar-parg/parser-dsl-reference.rb.txt
|
|
495
|
+
- grammar-parg/splice.rb
|
|
496
|
+
- grammar-parg/tree_diff.rb
|
|
477
497
|
- lib/expressir.rb
|
|
478
498
|
- lib/expressir/benchmark.rb
|
|
479
499
|
- lib/expressir/changes.rb
|
|
@@ -595,6 +615,7 @@ files:
|
|
|
595
615
|
- lib/expressir/express/formatters/statements_formatter.rb
|
|
596
616
|
- lib/expressir/express/formatters/supertype_expressions_formatter.rb
|
|
597
617
|
- lib/expressir/express/grammar.rb
|
|
618
|
+
- lib/expressir/express/grammar/express-grammar.artifact.json
|
|
598
619
|
- lib/expressir/express/grammar/parser.rb
|
|
599
620
|
- lib/expressir/express/hyperlink_formatter.rb
|
|
600
621
|
- lib/expressir/express/interface_dot.rb
|