expressir 2.4.47-aarch64-linux → 2.4.48-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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/expressir.gemspec +1 -1
  3. data/grammar-parg/CONVENTIONS.md +90 -0
  4. data/grammar-parg/RULE-INVENTORY.txt +252 -0
  5. data/grammar-parg/atoms_to_parg.rb +232 -0
  6. data/grammar-parg/bisect.sh +37 -0
  7. data/grammar-parg/ddmin.sh +39 -0
  8. data/grammar-parg/dsl-dump.json +1 -0
  9. data/grammar-parg/entries.parg.frag +12 -0
  10. data/grammar-parg/express-grammar.artifact.json +1 -0
  11. data/grammar-parg/express-grammar.parg +380 -0
  12. data/grammar-parg/express.json +1 -0
  13. data/grammar-parg/express.parg +57 -0
  14. data/grammar-parg/express_keywords.parg +132 -0
  15. data/grammar-parg/express_literals.parg +14 -0
  16. data/grammar-parg/express_operators.parg +34 -0
  17. data/grammar-parg/express_remarks.parg +19 -0
  18. data/grammar-parg/express_structure.parg +11 -0
  19. data/grammar-parg/generate-terminals.rb +55 -0
  20. data/grammar-parg/keywords.parg.frag +130 -0
  21. data/grammar-parg/literals.parg.frag +9 -0
  22. data/grammar-parg/operators.parg.frag +34 -0
  23. data/grammar-parg/parity-model.rb +68 -0
  24. data/grammar-parg/parity-vm.rb +60 -0
  25. data/grammar-parg/parity.sh +66 -0
  26. data/grammar-parg/parser-dsl-reference.rb.txt +757 -0
  27. data/grammar-parg/splice.rb +16 -0
  28. data/grammar-parg/tree_diff.rb +62 -0
  29. data/lib/expressir/express/grammar/express-grammar.artifact.json +1 -0
  30. data/lib/expressir/express/grammar/parser.rb +38 -0
  31. data/lib/expressir/express/parser.rb +3 -3
  32. data/lib/expressir/express/remark_attacher.rb +4 -2
  33. data/lib/expressir/model/model_element.rb +3 -0
  34. data/lib/expressir/version.rb +1 -1
  35. metadata +30 -9
@@ -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.cached_parser.parse source
82
+ Grammar::Parser.parse_ruby(source)
83
83
  end
84
84
  else
85
- Grammar::Parser.cached_parser.parse source
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.cached_parser.parse(content)
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
@@ -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
@@ -3,6 +3,6 @@ module Expressir
3
3
  # autoload it (Ruby autoload only works for module/class constants, not
4
4
  # for string constants like `Expressir::VERSION`).
5
5
  module Version
6
- VERSION = "2.4.47".freeze
6
+ VERSION = "2.4.48".freeze
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expressir
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.47
4
+ version: 2.4.48
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Ribose Inc.
@@ -128,20 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 1.3.9
132
- - - ">="
133
- - !ruby/object:Gem::Version
134
- version: 1.3.89
131
+ version: 1.3.123
135
132
  type: :runtime
136
133
  prerelease: false
137
134
  version_requirements: !ruby/object:Gem::Requirement
138
135
  requirements:
139
136
  - - "~>"
140
137
  - !ruby/object:Gem::Version
141
- version: 1.3.9
142
- - - ">="
143
- - !ruby/object:Gem::Version
144
- version: 1.3.89
138
+ version: 1.3.123
145
139
  - !ruby/object:Gem::Dependency
146
140
  name: ruby-progressbar
147
141
  requirement: !ruby/object:Gem::Requirement
@@ -455,6 +449,32 @@ files:
455
449
  - exe/expressir-format-test
456
450
  - exe/expressir-lsp
457
451
  - expressir.gemspec
452
+ - grammar-parg/CONVENTIONS.md
453
+ - grammar-parg/RULE-INVENTORY.txt
454
+ - grammar-parg/atoms_to_parg.rb
455
+ - grammar-parg/bisect.sh
456
+ - grammar-parg/ddmin.sh
457
+ - grammar-parg/dsl-dump.json
458
+ - grammar-parg/entries.parg.frag
459
+ - grammar-parg/express-grammar.artifact.json
460
+ - grammar-parg/express-grammar.parg
461
+ - grammar-parg/express.json
462
+ - grammar-parg/express.parg
463
+ - grammar-parg/express_keywords.parg
464
+ - grammar-parg/express_literals.parg
465
+ - grammar-parg/express_operators.parg
466
+ - grammar-parg/express_remarks.parg
467
+ - grammar-parg/express_structure.parg
468
+ - grammar-parg/generate-terminals.rb
469
+ - grammar-parg/keywords.parg.frag
470
+ - grammar-parg/literals.parg.frag
471
+ - grammar-parg/operators.parg.frag
472
+ - grammar-parg/parity-model.rb
473
+ - grammar-parg/parity-vm.rb
474
+ - grammar-parg/parity.sh
475
+ - grammar-parg/parser-dsl-reference.rb.txt
476
+ - grammar-parg/splice.rb
477
+ - grammar-parg/tree_diff.rb
458
478
  - lib/expressir.rb
459
479
  - lib/expressir/3.2/expressir_core.so
460
480
  - lib/expressir/3.3/expressir_core.so
@@ -580,6 +600,7 @@ files:
580
600
  - lib/expressir/express/formatters/statements_formatter.rb
581
601
  - lib/expressir/express/formatters/supertype_expressions_formatter.rb
582
602
  - lib/expressir/express/grammar.rb
603
+ - lib/expressir/express/grammar/express-grammar.artifact.json
583
604
  - lib/expressir/express/grammar/parser.rb
584
605
  - lib/expressir/express/hyperlink_formatter.rb
585
606
  - lib/expressir/express/interface_dot.rb