expressir 1.2.11-aarch64-linux → 2.4.29-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/.cargo/config.toml +3 -0
- data/.github/scripts/test_installed_gem.rb +34 -0
- data/.github/workflows/codeql.yml +35 -0
- data/.github/workflows/docs.yml +99 -0
- data/.github/workflows/links.yml +100 -0
- data/.github/workflows/native-gems.yml +201 -0
- data/.github/workflows/rake.yml +10 -296
- data/.github/workflows/release.yml +26 -114
- data/.github/workflows/rust-ext.yml +41 -0
- data/.github/workflows/stress.yml +36 -0
- data/.github/workflows/validate_schemas.yml +48 -0
- data/.github/workflows/verify_remarks.yml +33 -0
- data/.gitignore +33 -1
- data/.rubocop.yml +11 -11
- data/.rubocop_todo.yml +297 -0
- data/CHANGELOG.md +159 -0
- data/Gemfile +15 -1
- data/README.adoc +2675 -47
- data/Rakefile +34 -10
- data/TODO.bugs/01-stale-transformer-autoload.md +39 -0
- data/TODO.bugs/02-parser-class-instance-vars.md +36 -0
- data/TODO.bugs/03-builder-mutable-state.md +43 -0
- data/TODO.bugs/04-formatter-public-send-dispatch.md +53 -0
- data/TODO.bugs/05-anonymous-formatter-subclass.md +45 -0
- data/TODO.bugs/06-collection-registry-single-source.md +53 -0
- data/TODO.bugs/07-require-relative-cleanup.md +42 -0
- data/TODO.bugs/08-require-expressir-in-commands.md +34 -0
- data/TODO.bugs/09-parser-split.md +53 -0
- data/TODO.bugs/10-to-s-override.md +42 -0
- data/TODO.bugs/11-parser-class-variables.md +39 -0
- data/TODO.bugs/12-marker-modules-vs-registry.md +64 -0
- data/TODO.bugs/13-string-literal-scanner-limitation.md +52 -0
- data/TODO.bugs/14-model-formatting-leak.md +30 -0
- data/TODO.bugs/15-expression-children-macro.md +27 -0
- data/TODO.bugs/16-pretty-formatter-duplication.md +28 -0
- data/TODO.bugs/17-snake-case-cache-mutable-constant.md +28 -0
- data/TODO.bugs/18-const-get-private-constants.md +30 -0
- data/TODO.bugs/19-format-methods-public.md +22 -0
- data/TODO.bugs/20-coverage-nested-entities-dedup.md +20 -0
- data/TODO.bugs/21-operator-tokens-secondary-dispatch.md +21 -0
- data/TODO.bugs/22-builder-fast-path-wrappers.md +32 -0
- data/TODO.bugs/23-coverage-inverse-maps.md +21 -0
- data/TODO.bugs/24-streaming-builder-complexity.md +19 -0
- data/TODO.bugs/25-debug-puts-in-production.md +21 -0
- data/TODO.bugs/26-generic-entity-children-misplaced.md +21 -0
- data/TODO.bugs/27-package-build-god-method.md +19 -0
- data/TODO.bugs/28-package-god-class.md +30 -0
- data/TODO.bugs/29-validate-ascii-god-class.md +24 -0
- data/TODO.bugs/30-unicode-map-extraction.md +19 -0
- data/TODO.bugs/README.md +43 -0
- data/TODO.max-perf/01-restore-ci-green.md +36 -0
- data/TODO.max-perf/02-streaming-parse-path.md +31 -0
- data/TODO.max-perf/03-cli-parallel-opt-in.md +27 -0
- data/TODO.max-perf/04-benchmark-harness.md +28 -0
- data/TODO.max-perf/05-parallel-fidelity-specs.md +22 -0
- data/TODO.max-perf/06-builder-cpu-audit.md +41 -0
- data/TODO.max-perf/07-upstream-parsanol-roadmap.md +27 -0
- data/TODO.max-perf/08-builder-build-perf.md +45 -0
- data/TODO.max-perf/09-grammar-cold-start.md +25 -0
- data/TODO.max-perf/10-parser-facade-hygiene.md +23 -0
- data/TODO.max-perf/11-ci-green-closeout.md +25 -0
- data/TODO.max-perf/12-require-boot-profile.md +25 -0
- data/TODO.max-perf/13-key-conversion-specs.md +26 -0
- data/TODO.max-perf/14-builder-call-handler-audit.md +28 -0
- data/TODO.parity-ee/00-overview.md +76 -0
- data/TODO.parity-ee/01-annex-g-rule-extraction.md +41 -0
- data/TODO.parity-ee/02-eeng-algorithm-inventory.md +8 -0
- data/TODO.parity-ee/03-eeng-oracle-harness.md +33 -0
- data/TODO.parity-ee/04-shtolo-concatenate.md +44 -0
- data/TODO.parity-ee/05-shtolo-longform-flatten.md +53 -0
- data/TODO.parity-ee/06-interface-scheduling-parity.md +47 -0
- data/TODO.parity-ee/07-semantic-checks-port.md +35 -0
- data/TODO.parity-ee/08-pretty-roundtrip-gate.md +27 -0
- data/TODO.parity-ee/09-smrl-index-and-listing.md +22 -0
- data/TODO.parity-ee/10-interface-dot-graph.md +21 -0
- data/TODO.parity-ee/11-import-eeng-tests.md +79 -0
- data/TODO.parity-ee/12-full-check-catalog.md +67 -0
- data/TODO.parity-ee/13-population-p21.md +54 -0
- data/TODO.parity-ee/14-shtolo-completion.md +44 -0
- data/TODO.parity-ee/15-part28-xml.md +51 -0
- data/TODO.parity-ee/16-compare-patch.md +48 -0
- data/TODO.parity-ee/17-official-tests.md +42 -0
- data/TODO.parity-ee/18-mim-mapping.md +47 -0
- data/TODO.parity-ee/19-architecture.md +97 -0
- data/TODO.parity-ee/parity-matrix.md +108 -0
- data/TODO.refpath-v2/00-overview.md +64 -0
- data/TODO.suma-improvements/00-overview.md +23 -0
- data/TODO.suma-improvements/01-prebuilt-platform-gems.md +33 -0
- data/TODO.suma-improvements/02-suma-e2e.md +39 -0
- data/TODO.suma-improvements/03-item-graph.md +22 -0
- data/TODO.suma-improvements/04-compiled-set-default.md +16 -0
- data/TODO.suma-improvements/05-validation-in-docs.md +17 -0
- data/TODO.suma-improvements/06-memory-remeasure.md +36 -0
- data/TODO.suma-improvements/07-part28-xml.md +15 -0
- data/TODO.suma-improvements/08-windows-gnu-toolchain.md +15 -0
- data/TODO.suma-improvements/09-checker-tranche3.md +13 -0
- data/TODO.suma-improvements/10-expressdoc.md +8 -0
- data/benchmark/srl_benchmark.rb +458 -0
- data/benchmark/srl_native_benchmark.rb +146 -0
- data/benchmark/srl_ruby_benchmark.rb +132 -0
- data/bin/rspec +2 -1
- data/docs/Gemfile +12 -0
- data/docs/_config.yml +141 -0
- data/docs/_guides/changes/changes-format.adoc +778 -0
- data/docs/_guides/changes/importing-eengine.adoc +898 -0
- data/docs/_guides/changes/index.adoc +396 -0
- data/docs/_guides/changes/programmatic-usage.adoc +1038 -0
- data/docs/_guides/changes/validating-changes.adoc +681 -0
- data/docs/_guides/cli/benchmark-performance.adoc +834 -0
- data/docs/_guides/cli/coverage-analysis.adoc +921 -0
- data/docs/_guides/cli/format-schemas.adoc +547 -0
- data/docs/_guides/cli/index.adoc +8 -0
- data/docs/_guides/cli/managing-changes.adoc +927 -0
- data/docs/_guides/cli/validate-ascii.adoc +645 -0
- data/docs/_guides/cli/validate-schemas.adoc +534 -0
- data/docs/_guides/formatter/formatter-architecture.adoc +401 -0
- data/docs/_guides/index.adoc +165 -0
- data/docs/_guides/ler/creating-packages.adoc +664 -0
- data/docs/_guides/ler/index.adoc +305 -0
- data/docs/_guides/ler/loading-packages.adoc +707 -0
- data/docs/_guides/ler/package-formats.adoc +748 -0
- data/docs/_guides/ler/querying-packages.adoc +826 -0
- data/docs/_guides/ler/step-packages.adoc +385 -0
- data/docs/_guides/ler/validating-packages.adoc +750 -0
- data/docs/_guides/liquid/basic-templates.adoc +813 -0
- data/docs/_guides/liquid/documentation-generation.adoc +1042 -0
- data/docs/_guides/liquid/drops-reference.adoc +829 -0
- data/docs/_guides/liquid/filters-and-tags.adoc +912 -0
- data/docs/_guides/liquid/index.adoc +468 -0
- data/docs/_guides/manifests/creating-manifests.adoc +483 -0
- data/docs/_guides/manifests/index.adoc +307 -0
- data/docs/_guides/manifests/resolving-manifests.adoc +557 -0
- data/docs/_guides/manifests/validating-manifests.adoc +713 -0
- data/docs/_guides/ruby-api/formatting-schemas.adoc +605 -0
- data/docs/_guides/ruby-api/index.adoc +257 -0
- data/docs/_guides/ruby-api/parsing-files.adoc +421 -0
- data/docs/_guides/ruby-api/search-engine.adoc +609 -0
- data/docs/_guides/ruby-api/working-with-repository.adoc +577 -0
- data/docs/_pages/data-model.adoc +665 -0
- data/docs/_pages/express-language.adoc +506 -0
- data/docs/_pages/getting-started.adoc +414 -0
- data/docs/_pages/index.adoc +116 -0
- data/docs/_pages/introduction.adoc +256 -0
- data/docs/_pages/ler-packages.adoc +837 -0
- data/docs/_pages/parsers.adoc +709 -0
- data/docs/_pages/schema-manifests.adoc +431 -0
- data/docs/_references/index.adoc +228 -0
- data/docs/_tutorials/creating-ler-package.adoc +735 -0
- data/docs/_tutorials/documentation-coverage.adoc +795 -0
- data/docs/_tutorials/formatting-schemas.adoc +89 -0
- data/docs/_tutorials/index.adoc +231 -0
- data/docs/_tutorials/liquid-templates.adoc +806 -0
- data/docs/_tutorials/parsing-your-first-schema.adoc +522 -0
- data/docs/_tutorials/querying-schemas.adoc +751 -0
- data/docs/_tutorials/working-with-multiple-schemas.adoc +676 -0
- data/docs/index.adoc +242 -0
- data/docs/lychee.toml +90 -0
- data/examples/demo_ler_usage.sh +86 -0
- data/examples/ler/README.md +111 -0
- data/examples/ler/simple_example.ler +0 -0
- data/examples/ler/simple_schema.exp +33 -0
- data/examples/ler_build.rb +75 -0
- data/examples/ler_cli.rb +79 -0
- data/examples/ler_demo_complete.rb +276 -0
- data/examples/ler_query.rb +91 -0
- data/examples/ler_query_examples.rb +305 -0
- data/examples/ler_stats.rb +81 -0
- data/examples/phase3_demo.rb +159 -0
- data/examples/query_demo_simple.rb +131 -0
- data/exe/expressir +6 -17
- data/exe/expressir-format +14 -0
- data/exe/{format-test → expressir-format-test} +8 -7
- data/expressir.gemspec +50 -37
- 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/benchmark.rb +310 -0
- data/lib/expressir/changes/item_change.rb +20 -0
- data/lib/expressir/changes/mapping_change.rb +16 -0
- data/lib/expressir/changes/schema_change.rb +85 -0
- data/lib/expressir/changes/version_change.rb +26 -0
- data/lib/expressir/changes.rb +9 -0
- data/lib/expressir/cli.rb +138 -11
- data/lib/expressir/commands/base.rb +25 -0
- data/lib/expressir/commands/benchmark.rb +59 -0
- data/lib/expressir/commands/benchmark_cache.rb +80 -0
- data/lib/expressir/commands/changes.rb +34 -0
- data/lib/expressir/commands/changes_import_eengine.rb +146 -0
- data/lib/expressir/commands/changes_validate.rb +63 -0
- data/lib/expressir/commands/check.rb +56 -0
- data/lib/expressir/commands/clean.rb +20 -0
- data/lib/expressir/commands/coverage.rb +458 -0
- data/lib/expressir/commands/expand.rb +26 -0
- data/lib/expressir/commands/file_violations.rb +70 -0
- data/lib/expressir/commands/fix.rb +33 -0
- data/lib/expressir/commands/flatten.rb +29 -0
- data/lib/expressir/commands/format.rb +43 -0
- data/lib/expressir/commands/manifest.rb +420 -0
- data/lib/expressir/commands/mapping_validate.rb +68 -0
- data/lib/expressir/commands/non_ascii_character.rb +49 -0
- data/lib/expressir/commands/non_ascii_violation_collection.rb +301 -0
- data/lib/expressir/commands/package.rb +1222 -0
- data/lib/expressir/commands/parity_inputs.rb +160 -0
- data/lib/expressir/commands/validate.rb +106 -0
- data/lib/expressir/commands/validate_ascii.rb +94 -0
- data/lib/expressir/commands/validate_load.rb +91 -0
- data/lib/expressir/commands/version.rb +9 -0
- data/lib/expressir/commands/xsd.rb +23 -0
- data/lib/expressir/commands.rb +30 -0
- data/lib/expressir/config.rb +40 -3
- data/lib/expressir/coverage.rb +510 -0
- data/lib/expressir/eengine/arm_compare_report.rb +23 -0
- data/lib/expressir/eengine/changes_section.rb +16 -0
- data/lib/expressir/eengine/compare_report.rb +69 -0
- data/lib/expressir/eengine/mim_compare_report.rb +23 -0
- data/lib/expressir/eengine/modified_object.rb +21 -0
- data/lib/expressir/eengine.rb +9 -0
- data/lib/expressir/errors.rb +113 -0
- data/lib/expressir/express/adoc_hyperlink_formatter.rb +30 -0
- data/lib/expressir/express/adoc_source_formatter.rb +12 -0
- data/lib/expressir/express/ast_key_converter.rb +114 -0
- data/lib/expressir/express/builder.rb +277 -0
- data/lib/expressir/express/builder_context.rb +22 -0
- data/lib/expressir/express/builder_registry.rb +397 -0
- data/lib/expressir/express/builders/attribute_decl_builder.rb +32 -0
- data/lib/expressir/express/builders/built_in_builder.rb +75 -0
- data/lib/expressir/express/builders/constant_builder.rb +108 -0
- data/lib/expressir/express/builders/declaration_builder.rb +20 -0
- data/lib/expressir/express/builders/derive_clause_builder.rb +14 -0
- data/lib/expressir/express/builders/derived_attr_builder.rb +28 -0
- data/lib/expressir/express/builders/domain_rule_builder.rb +21 -0
- data/lib/expressir/express/builders/entity_decl_builder.rb +116 -0
- data/lib/expressir/express/builders/explicit_attr_builder.rb +49 -0
- data/lib/expressir/express/builders/expression_builder.rb +416 -0
- data/lib/expressir/express/builders/function_decl_builder.rb +86 -0
- data/lib/expressir/express/builders/helpers.rb +148 -0
- data/lib/expressir/express/builders/interface_builder.rb +151 -0
- data/lib/expressir/express/builders/inverse_attr_builder.rb +43 -0
- data/lib/expressir/express/builders/inverse_attr_type_builder.rb +30 -0
- data/lib/expressir/express/builders/inverse_clause_builder.rb +14 -0
- data/lib/expressir/express/builders/literal_builder.rb +93 -0
- data/lib/expressir/express/builders/procedure_decl_builder.rb +82 -0
- data/lib/expressir/express/builders/qualifier_builder.rb +102 -0
- data/lib/expressir/express/builders/reference_builder.rb +18 -0
- data/lib/expressir/express/builders/rule_decl_builder.rb +97 -0
- data/lib/expressir/express/builders/schema_body_decl_builder.rb +18 -0
- data/lib/expressir/express/builders/schema_decl_builder.rb +56 -0
- data/lib/expressir/express/builders/schema_version_builder.rb +34 -0
- data/lib/expressir/express/builders/simple_id_builder.rb +17 -0
- data/lib/expressir/express/builders/statement_builder.rb +243 -0
- data/lib/expressir/express/builders/subtype_constraint_builder.rb +166 -0
- data/lib/expressir/express/builders/syntax_builder.rb +30 -0
- data/lib/expressir/express/builders/type_builder.rb +238 -0
- data/lib/expressir/express/builders/type_decl_builder.rb +26 -0
- data/lib/expressir/express/builders/unique_clause_builder.rb +20 -0
- data/lib/expressir/express/builders/unique_rule_builder.rb +41 -0
- data/lib/expressir/express/builders/where_clause_builder.rb +20 -0
- data/lib/expressir/express/builders.rb +55 -0
- data/lib/expressir/express/cache.rb +43 -18
- data/lib/expressir/express/checker.rb +812 -0
- data/lib/expressir/express/concatenator.rb +79 -0
- data/lib/expressir/express/core.rb +95 -0
- data/lib/expressir/express/error.rb +124 -0
- data/lib/expressir/express/formatter.rb +89 -1548
- data/lib/expressir/express/formatters/data_types_formatter.rb +362 -0
- data/lib/expressir/express/formatters/declarations_formatter.rb +753 -0
- data/lib/expressir/express/formatters/expressions_formatter.rb +180 -0
- data/lib/expressir/express/formatters/literals_formatter.rb +55 -0
- data/lib/expressir/express/formatters/references_formatter.rb +53 -0
- data/lib/expressir/express/formatters/remark_formatter.rb +270 -0
- data/lib/expressir/express/formatters/remark_item_formatter.rb +28 -0
- data/lib/expressir/express/formatters/statements_formatter.rb +272 -0
- data/lib/expressir/express/formatters/supertype_expressions_formatter.rb +54 -0
- data/lib/expressir/express/formatters.rb +22 -0
- data/lib/expressir/express/grammar/parser.rb +712 -0
- data/lib/expressir/express/grammar.rb +11 -0
- data/lib/expressir/express/hyperlink_formatter.rb +4 -5
- data/lib/expressir/express/interface_dot.rb +105 -0
- data/lib/expressir/express/lazy_repository.rb +211 -0
- data/lib/expressir/express/line_map.rb +48 -0
- data/lib/expressir/express/listing.rb +174 -0
- data/lib/expressir/express/model_traversal.rb +42 -0
- data/lib/expressir/express/model_visitor.rb +11 -10
- data/lib/expressir/express/node_position_index.rb +342 -0
- data/lib/expressir/express/parallel_files.rb +229 -0
- data/lib/expressir/express/parser.rb +501 -62
- data/lib/expressir/express/pretty_formatter.rb +586 -0
- data/lib/expressir/express/pretty_gate.rb +61 -0
- data/lib/expressir/express/refs_overlay.rb +47 -0
- data/lib/expressir/express/remark_attacher.rb +1098 -0
- data/lib/expressir/express/remark_overlay.rb +86 -0
- data/lib/expressir/express/remark_scanner.rb +245 -0
- data/lib/expressir/express/resolve_references_model_visitor.rb +7 -9
- data/lib/expressir/express/schema_block_scanner.rb +137 -0
- data/lib/expressir/express/schema_head_formatter.rb +4 -5
- data/lib/expressir/express/schema_plain_source_formatter.rb +11 -0
- data/lib/expressir/express/schema_source_formatter.rb +15 -0
- data/lib/expressir/express/scope_resolver.rb +223 -0
- data/lib/expressir/express/self_schema_reference.rb +126 -0
- data/lib/expressir/express/shtolo.rb +679 -0
- data/lib/expressir/express/smrl_xml.rb +125 -0
- data/lib/expressir/express/source_formatter.rb +15 -0
- data/lib/expressir/express/streaming_builder.rb +435 -0
- data/lib/expressir/express/xsd.rb +259 -0
- data/lib/expressir/express.rb +53 -0
- data/lib/expressir/liquid.rb +1 -0
- data/lib/expressir/manifest/resolver.rb +210 -0
- data/lib/expressir/manifest/validator.rb +192 -0
- data/lib/expressir/manifest.rb +6 -0
- data/lib/expressir/mapping/refpath.rb +857 -0
- data/lib/expressir/mapping.rb +253 -0
- data/lib/expressir/model/cache.rb +10 -9
- data/lib/expressir/model/concerns.rb +42 -0
- data/lib/expressir/model/data_types/aggregate.rb +8 -13
- data/lib/expressir/model/data_types/array.rb +15 -21
- data/lib/expressir/model/data_types/bag.rb +11 -15
- data/lib/expressir/model/data_types/binary.rb +9 -12
- data/lib/expressir/model/data_types/boolean.rb +7 -2
- data/lib/expressir/model/data_types/enumeration.rb +11 -15
- data/lib/expressir/model/data_types/enumeration_item.rb +5 -7
- data/lib/expressir/model/data_types/generic.rb +6 -8
- data/lib/expressir/model/data_types/generic_entity.rb +11 -13
- data/lib/expressir/model/data_types/integer.rb +7 -2
- data/lib/expressir/model/data_types/list.rb +13 -18
- data/lib/expressir/model/data_types/logical.rb +7 -2
- data/lib/expressir/model/data_types/number.rb +7 -2
- data/lib/expressir/model/data_types/real.rb +7 -9
- data/lib/expressir/model/data_types/select.rb +13 -18
- data/lib/expressir/model/data_types/set.rb +11 -15
- data/lib/expressir/model/data_types/string.rb +9 -12
- data/lib/expressir/model/data_types.rb +25 -0
- data/lib/expressir/model/declarations/attribute.rb +19 -28
- data/lib/expressir/model/declarations/constant.rb +10 -16
- data/lib/expressir/model/declarations/derived_attribute.rb +25 -0
- data/lib/expressir/model/declarations/entity.rb +39 -30
- data/lib/expressir/model/declarations/function.rb +32 -40
- data/lib/expressir/model/declarations/informal_proposition_rule.rb +25 -0
- data/lib/expressir/model/declarations/interface.rb +25 -16
- data/lib/expressir/model/declarations/interface_item.rb +9 -11
- data/lib/expressir/model/declarations/interfaced_item.rb +15 -19
- data/lib/expressir/model/declarations/inverse_attribute.rb +25 -0
- data/lib/expressir/model/declarations/parameter.rb +10 -16
- data/lib/expressir/model/declarations/procedure.rb +30 -37
- data/lib/expressir/model/declarations/remark_item.rb +11 -11
- data/lib/expressir/model/declarations/rule.rb +38 -43
- data/lib/expressir/model/declarations/schema.rb +162 -64
- data/lib/expressir/model/declarations/schema_version.rb +8 -11
- data/lib/expressir/model/declarations/schema_version_item.rb +8 -11
- data/lib/expressir/model/declarations/subtype_constraint.rb +14 -22
- data/lib/expressir/model/declarations/type.rb +18 -18
- data/lib/expressir/model/declarations/unique_rule.rb +8 -13
- data/lib/expressir/model/declarations/variable.rb +10 -16
- data/lib/expressir/model/declarations/where_rule.rb +8 -13
- data/lib/expressir/model/declarations.rb +31 -0
- data/lib/expressir/model/dependency_resolver.rb +268 -0
- data/lib/expressir/model/exp_file.rb +42 -0
- data/lib/expressir/model/expressions/aggregate_initializer.rb +8 -9
- data/lib/expressir/model/expressions/aggregate_initializer_item.rb +10 -12
- data/lib/expressir/model/expressions/binary_expression.rb +42 -36
- data/lib/expressir/model/expressions/entity_constructor.rb +10 -12
- data/lib/expressir/model/expressions/function_call.rb +10 -12
- data/lib/expressir/model/expressions/interval.rb +18 -23
- data/lib/expressir/model/expressions/query_expression.rb +11 -15
- data/lib/expressir/model/expressions/unary_expression.rb +13 -15
- data/lib/expressir/model/expressions.rb +18 -0
- data/lib/expressir/model/identifier.rb +18 -26
- data/lib/expressir/model/indexes/entity_index.rb +103 -0
- data/lib/expressir/model/indexes/item_graph.rb +185 -0
- data/lib/expressir/model/indexes/reference_index.rb +148 -0
- data/lib/expressir/model/indexes/type_index.rb +149 -0
- data/lib/expressir/model/indexes.rb +12 -0
- data/lib/expressir/model/interface_validator.rb +384 -0
- data/lib/expressir/model/literals/binary.rb +7 -9
- data/lib/expressir/model/literals/integer.rb +7 -9
- data/lib/expressir/model/literals/logical.rb +10 -12
- data/lib/expressir/model/literals/real.rb +7 -9
- data/lib/expressir/model/literals/string.rb +10 -12
- data/lib/expressir/model/literals.rb +13 -0
- data/lib/expressir/model/model_element.rb +286 -117
- data/lib/expressir/model/references/attribute_reference.rb +9 -12
- data/lib/expressir/model/references/group_reference.rb +9 -12
- data/lib/expressir/model/references/index_reference.rb +11 -15
- data/lib/expressir/model/references/simple_reference.rb +11 -14
- data/lib/expressir/model/references.rb +12 -0
- data/lib/expressir/model/remark_format.rb +17 -0
- data/lib/expressir/model/remark_info.rb +92 -0
- data/lib/expressir/model/remark_placement.rb +42 -0
- data/lib/expressir/model/repository.rb +472 -12
- data/lib/expressir/model/repository_validator.rb +293 -0
- data/lib/expressir/model/search_engine.rb +551 -0
- data/lib/expressir/model/statements/alias.rb +12 -16
- data/lib/expressir/model/statements/assignment.rb +12 -11
- data/lib/expressir/model/statements/case.rb +31 -14
- data/lib/expressir/model/statements/case_action.rb +9 -11
- data/lib/expressir/model/statements/compound.rb +10 -8
- data/lib/expressir/model/statements/escape.rb +10 -2
- data/lib/expressir/model/statements/if.rb +15 -14
- data/lib/expressir/model/statements/null.rb +10 -2
- data/lib/expressir/model/statements/procedure_call.rb +11 -11
- data/lib/expressir/model/statements/repeat.rb +21 -28
- data/lib/expressir/model/statements/return.rb +9 -8
- data/lib/expressir/model/statements/skip.rb +10 -2
- data/lib/expressir/model/statements.rb +20 -0
- data/lib/expressir/model/supertype_expressions/binary_supertype_expression.rb +13 -17
- data/lib/expressir/model/supertype_expressions/oneof_supertype_expression.rb +7 -9
- data/lib/expressir/model/supertype_expressions.rb +12 -0
- data/lib/expressir/model.rb +38 -78
- data/lib/expressir/package/builder.rb +231 -0
- data/lib/expressir/package/metadata.rb +79 -0
- data/lib/expressir/package/reader.rb +149 -0
- data/lib/expressir/package.rb +8 -0
- data/lib/expressir/schema_manifest.rb +159 -0
- data/lib/expressir/schema_manifest_entry.rb +15 -0
- data/lib/expressir/version.rb +6 -1
- data/lib/expressir.rb +79 -9
- data/lib/tasks/verify_remarks.rake +16 -0
- data/rakelib/native.rake +24 -0
- data/rakelib/oracle.rake +52 -0
- data/rakelib/verify_remarks.rake +16 -0
- metadata +431 -129
- data/.cross_rubies +0 -20
- data/.gitmodules +0 -6
- data/.yardopts +0 -11
- data/docs/development.md +0 -90
- data/exe/format +0 -18
- data/exe/generate-parser +0 -51
- data/lib/expressir/cli/ui.rb +0 -36
- data/lib/expressir/express/2.7/express_parser.so +0 -0
- data/lib/expressir/express/3.0/express_parser.so +0 -0
- data/lib/expressir/express/3.1/express_parser.so +0 -0
- data/lib/expressir/express/3.2/express_parser.so +0 -0
- data/lib/expressir/express/visitor.rb +0 -2588
- data/lib/expressir/model/data_type.rb +0 -9
- data/lib/expressir/model/declaration.rb +0 -9
- data/lib/expressir/model/expression.rb +0 -9
- data/lib/expressir/model/literal.rb +0 -9
- data/lib/expressir/model/reference.rb +0 -9
- data/lib/expressir/model/statement.rb +0 -9
- data/lib/expressir/model/supertype_expression.rb +0 -9
- data/rakelib/antlr4-native.rake +0 -161
- data/rakelib/cross-ruby.rake +0 -368
- data/spec/acceptance/version_spec.rb +0 -27
- data/spec/expressir/express/cache_spec.rb +0 -89
- data/spec/expressir/express/formatter_spec.rb +0 -173
- data/spec/expressir/express/parser_spec.rb +0 -141
- data/spec/expressir/model/model_element_spec.rb +0 -318
- data/spec/spec_helper.rb +0 -24
- data/spec/support/console_helper.rb +0 -29
- data/spec/syntax/multiple.exp +0 -23
- data/spec/syntax/multiple.yaml +0 -198
- data/spec/syntax/multiple_formatted.exp +0 -71
- data/spec/syntax/multiple_hyperlink_formatted.exp +0 -71
- data/spec/syntax/multiple_schema_head_hyperlink_formatted.exp +0 -13
- data/spec/syntax/remark.exp +0 -193
- data/spec/syntax/remark.yaml +0 -471
- data/spec/syntax/remark_formatted.exp +0 -228
- data/spec/syntax/single.exp +0 -4
- data/spec/syntax/single.yaml +0 -18
- data/spec/syntax/single_formatted.exp +0 -10
- data/spec/syntax/single_formatted.yaml +0 -36
- data/spec/syntax/syntax.exp +0 -333
- data/spec/syntax/syntax.yaml +0 -3509
- data/spec/syntax/syntax_formatted.exp +0 -902
- data/spec/syntax/syntax_hyperlink_formatted.exp +0 -902
- data/spec/syntax/syntax_schema_head_formatted.exp +0 -18
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
require "find"
|
|
2
|
+
require "thor"
|
|
3
|
+
|
|
4
|
+
module Expressir
|
|
5
|
+
module Commands
|
|
6
|
+
# Common parser/discovery helpers shared by parity CLI commands
|
|
7
|
+
# (expand, flatten, check) — they all need: list of files in the
|
|
8
|
+
# interface closure of a root file, and the root schema parsed.
|
|
9
|
+
#
|
|
10
|
+
# Schema resolution order (per the ELF schema manifest directive):
|
|
11
|
+
# 1. `--manifest PATH` — an ELF schema manifest explicitly defines
|
|
12
|
+
# where each schema lives; this is the primary mode.
|
|
13
|
+
# 2. `--stepmod DIR` — explicit opt-in to the STEPmod directory
|
|
14
|
+
# convention (`schemas/**/<name>.exp`) as the fallback.
|
|
15
|
+
# 3. Otherwise the file's own directory is used; a lookup failure
|
|
16
|
+
# warns and points at the two explicit modes.
|
|
17
|
+
module ParityInputs
|
|
18
|
+
module_function
|
|
19
|
+
|
|
20
|
+
# Resolve the transitive interface closure of +root_path+. The queue
|
|
21
|
+
# holds paths and `seen` guards by schema name: mutual USE FROM
|
|
22
|
+
# cycles must terminate (this loop once span rounds forever on them,
|
|
23
|
+
# re-reading the same files).
|
|
24
|
+
def closure_paths(root_path, manifest: nil, stepmod: nil)
|
|
25
|
+
index = schema_index(root_path, manifest: manifest, stepmod: stepmod)
|
|
26
|
+
seen = { File.basename(root_path, ".exp").downcase => root_path }
|
|
27
|
+
missing = []
|
|
28
|
+
queue = [root_path]
|
|
29
|
+
until queue.empty?
|
|
30
|
+
closure_names(File.read(queue.shift)).each do |dep|
|
|
31
|
+
name = dep.downcase
|
|
32
|
+
next if seen.key?(name)
|
|
33
|
+
|
|
34
|
+
path = index&.[](name)
|
|
35
|
+
unless path
|
|
36
|
+
missing << name
|
|
37
|
+
seen[name] = nil
|
|
38
|
+
next
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
seen[name] = path
|
|
42
|
+
queue << path
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
unless missing.empty?
|
|
46
|
+
raise Thor::Error,
|
|
47
|
+
"expressir: schema(s) not found: #{missing.uniq.join(', ')}" \
|
|
48
|
+
"#{resolver_hint(manifest, stepmod)}"
|
|
49
|
+
end
|
|
50
|
+
seen.values.compact.uniq
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def resolver_hint(manifest, stepmod)
|
|
54
|
+
if manifest
|
|
55
|
+
" (not in schema manifest #{manifest})"
|
|
56
|
+
elsif stepmod
|
|
57
|
+
" (not found under STEPmod root #{stepmod})"
|
|
58
|
+
else
|
|
59
|
+
" - provide --manifest PATH (ELF schema manifest) or " \
|
|
60
|
+
"--stepmod DIR to resolve them"
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Schema-name → path index from the ELF schema manifest. An
|
|
65
|
+
# explicitly given manifest that cannot be loaded is fatal (#455):
|
|
66
|
+
# when the root has no interface dependencies the lookup would
|
|
67
|
+
# never consult the index, so a typo'd --manifest would exit 0.
|
|
68
|
+
def manifest_index(manifest_path)
|
|
69
|
+
manifest = Expressir::SchemaManifest.from_file(manifest_path)
|
|
70
|
+
manifest.schemas.to_h do |entry|
|
|
71
|
+
[entry.id.downcase, entry.path]
|
|
72
|
+
end
|
|
73
|
+
rescue StandardError => e
|
|
74
|
+
raise Thor::Error,
|
|
75
|
+
"expressir: could not load schema manifest #{manifest_path}: #{e.message}"
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Schema-name → path index over a STEPmod checkout root (the
|
|
79
|
+
# directory holding `schemas/`, or that directory itself).
|
|
80
|
+
def stepmod_index(stepmod_dir)
|
|
81
|
+
root = File.join(File.expand_path(stepmod_dir), "schemas")
|
|
82
|
+
root = File.expand_path(stepmod_dir) unless File.directory?(root)
|
|
83
|
+
h = {}
|
|
84
|
+
Find.find(root) do |path|
|
|
85
|
+
next unless path.end_with?(".exp")
|
|
86
|
+
|
|
87
|
+
declared = File.read(path)[/\bSCHEMA\s+(\w+)/i, 1]
|
|
88
|
+
h[declared.downcase] = path if declared
|
|
89
|
+
h[File.basename(path, ".exp").downcase] ||= path
|
|
90
|
+
end
|
|
91
|
+
h
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def schema_index(root_path, manifest: nil, stepmod: nil)
|
|
95
|
+
return manifest_index(manifest) if manifest
|
|
96
|
+
return stepmod_index(stepmod) if stepmod
|
|
97
|
+
|
|
98
|
+
# Default: the file's own directory plus, when the root sits
|
|
99
|
+
# inside a STEPmod checkout, its enclosing `schemas/` tree —
|
|
100
|
+
# the layout wg12-step modules live in. Same-directory
|
|
101
|
+
# declarations win over tree hits for the same schema name:
|
|
102
|
+
# the file next to the root is the intentional one (#455).
|
|
103
|
+
index = same_dir_index(root_path)
|
|
104
|
+
ancestor = ancestor_schemas_dir(root_path)
|
|
105
|
+
if ancestor
|
|
106
|
+
tree = stepmod_index(File.dirname(ancestor))
|
|
107
|
+
tree.update(index)
|
|
108
|
+
index = tree
|
|
109
|
+
end
|
|
110
|
+
index
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Nearest ancestor directory NAMED `schemas`, or nil.
|
|
114
|
+
def ancestor_schemas_dir(root_path)
|
|
115
|
+
dir = File.dirname(File.expand_path(root_path))
|
|
116
|
+
until dir == "/"
|
|
117
|
+
return dir if File.basename(dir) == "schemas"
|
|
118
|
+
|
|
119
|
+
dir = File.dirname(dir)
|
|
120
|
+
end
|
|
121
|
+
nil
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def same_dir_index(root_path)
|
|
125
|
+
dir = File.dirname(File.expand_path(root_path))
|
|
126
|
+
h = {}
|
|
127
|
+
Dir.glob(File.join(dir, "*.exp")).each do |path|
|
|
128
|
+
# index by DECLARED schema name first (a file named arm.exp
|
|
129
|
+
# may declare schema m_arm), basename as fallback
|
|
130
|
+
declared = File.read(path)[/\bSCHEMA\s+(\w+)/i, 1]
|
|
131
|
+
h[declared.downcase] = path if declared
|
|
132
|
+
h[File.basename(path, ".exp").downcase] ||= path
|
|
133
|
+
end
|
|
134
|
+
h
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Interface names declared by +source+. Remark text is stripped
|
|
138
|
+
# first: prose like "use from the main schema" must not spawn
|
|
139
|
+
# phantom dependencies.
|
|
140
|
+
def closure_names(source)
|
|
141
|
+
code = source.gsub(/--[^\n]*/, "").gsub(/\(\*.*?\*\)/m, "")
|
|
142
|
+
code.scan(/\bUSE\s+FROM\s+(\w+)/i).flatten.uniq +
|
|
143
|
+
code.scan(/\bREFERENCE\s+FROM\s+(\w+)/i).flatten.uniq
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def root_schema(root_path, manifest: nil, stepmod: nil)
|
|
147
|
+
name = File.read(root_path)[/\bSCHEMA\s+(\w+)/, 1]
|
|
148
|
+
# skip_references: longform generation and checking run their own
|
|
149
|
+
# resolution; resolving every reference of a large closure here made
|
|
150
|
+
# flatten crawl (minutes vs seconds).
|
|
151
|
+
repo = Expressir::Express::Parser.from_files(
|
|
152
|
+
closure_paths(root_path, manifest: manifest, stepmod: stepmod),
|
|
153
|
+
skip_references: true,
|
|
154
|
+
max_processes: 1,
|
|
155
|
+
)
|
|
156
|
+
[repo.schemas.find { |s| s.id&.downcase == name&.downcase }, repo]
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
end
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "thor"
|
|
4
|
+
|
|
5
|
+
module Expressir
|
|
6
|
+
module Commands
|
|
7
|
+
# Thor subcommand for EXPRESS validation operations
|
|
8
|
+
class Validate < Thor
|
|
9
|
+
desc "load PATH_OR_MANIFEST",
|
|
10
|
+
"Validate EXPRESS schema loading and version strings"
|
|
11
|
+
long_desc <<~DESC
|
|
12
|
+
Validate EXPRESS schema(s) for parsing errors and version string presence.
|
|
13
|
+
|
|
14
|
+
Accepts either:
|
|
15
|
+
- Individual EXPRESS file paths (*.exp)
|
|
16
|
+
- A Schema Manifest YAML file (*.yaml) containing schema definitions
|
|
17
|
+
|
|
18
|
+
When using a Schema Manifest, all schemas in the manifest will be validated.
|
|
19
|
+
|
|
20
|
+
Examples:
|
|
21
|
+
# Validate individual EXPRESS files
|
|
22
|
+
expressir validate load schema1.exp schema2.exp
|
|
23
|
+
|
|
24
|
+
# Validate schemas from a manifest
|
|
25
|
+
expressir validate load manifest.yaml
|
|
26
|
+
|
|
27
|
+
# Validate with verbose output
|
|
28
|
+
expressir validate load manifest.yaml --verbose
|
|
29
|
+
DESC
|
|
30
|
+
method_option :verbose, type: :boolean, default: false,
|
|
31
|
+
desc: "Show verbose output"
|
|
32
|
+
def load(*paths)
|
|
33
|
+
ValidateLoad.new(options).run(paths)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
desc "ascii PATH_OR_MANIFEST",
|
|
37
|
+
"Validate EXPRESS files for ASCII-only content"
|
|
38
|
+
long_desc <<~DESC
|
|
39
|
+
Validate EXPRESS file(s) for non-ASCII characters and provide replacement suggestions.
|
|
40
|
+
|
|
41
|
+
Accepts either:
|
|
42
|
+
- Individual EXPRESS file path (*.exp)
|
|
43
|
+
- A directory path (with --recursive option)
|
|
44
|
+
- A Schema Manifest YAML file (*.yaml) containing schema definitions
|
|
45
|
+
|
|
46
|
+
When using a Schema Manifest, all schemas in the manifest will be validated.
|
|
47
|
+
|
|
48
|
+
This command:
|
|
49
|
+
- Scans each line for non-ASCII characters
|
|
50
|
+
- Reports detailed information about each violation
|
|
51
|
+
- Provides specific replacement suggestions (AsciiMath or ISO 10303-11)
|
|
52
|
+
- Displays a summary table showing all violations
|
|
53
|
+
- Optionally outputs structured data in YAML format
|
|
54
|
+
|
|
55
|
+
Examples:
|
|
56
|
+
# Validate a single EXPRESS file
|
|
57
|
+
expressir validate ascii schema.exp
|
|
58
|
+
|
|
59
|
+
# Validate all EXPRESS files in a directory recursively
|
|
60
|
+
expressir validate ascii ../iso-10303/schemas -r
|
|
61
|
+
|
|
62
|
+
# Validate schemas from a manifest
|
|
63
|
+
expressir validate ascii manifest.yaml
|
|
64
|
+
|
|
65
|
+
# Output results in YAML format
|
|
66
|
+
expressir validate ascii manifest.yaml -y
|
|
67
|
+
|
|
68
|
+
# Include remarks in validation (default: false)
|
|
69
|
+
expressir validate ascii schema.exp --check-remarks
|
|
70
|
+
DESC
|
|
71
|
+
method_option :recursive, type: :boolean, default: false, aliases: "-r",
|
|
72
|
+
desc: "Validate EXPRESS files under the specified path recursively"
|
|
73
|
+
method_option :yaml, type: :boolean, default: false, aliases: "-y",
|
|
74
|
+
desc: "Output results in YAML format"
|
|
75
|
+
method_option :check_remarks, type: :boolean, default: false,
|
|
76
|
+
desc: "Include remarks in ASCII validation (default: false, remarks are excluded)"
|
|
77
|
+
method_option :verbose, type: :boolean, default: false,
|
|
78
|
+
desc: "Show verbose output"
|
|
79
|
+
def ascii(path)
|
|
80
|
+
ValidateAscii.new(options).run(path)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
desc "check *PATHS", "Run eeng check-p11 semantic checks"
|
|
84
|
+
long_desc <<~DESC
|
|
85
|
+
Walks one or more EXPRESS files (or directories of .exp) and
|
|
86
|
+
reports the eeng check-p11 note subset covered by Checker:
|
|
87
|
+
redundant interfaces, duplicate resources, unresolved interface
|
|
88
|
+
schema/ref, SUBTYPE OF targets, SELECT/ENUM BASED_ON, and
|
|
89
|
+
WHERE/UNIQUE label patterns.
|
|
90
|
+
|
|
91
|
+
Exits 1 when any error-severity note fires.
|
|
92
|
+
DESC
|
|
93
|
+
method_option :json, type: :boolean, default: false,
|
|
94
|
+
desc: "Emit the report as JSON (errors + warnings)"
|
|
95
|
+
method_option :manifest, type: :string,
|
|
96
|
+
desc: "ELF schema manifest YAML defining where schemas live " \
|
|
97
|
+
"(primary resolution mode)"
|
|
98
|
+
method_option :stepmod, type: :string,
|
|
99
|
+
desc: "STEPmod checkout root — explicit opt-in to directory-" \
|
|
100
|
+
"convention resolution as the fallback"
|
|
101
|
+
def check(*paths)
|
|
102
|
+
Check.new(options).run(*paths)
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "paint"
|
|
4
|
+
require "table_tennis"
|
|
5
|
+
|
|
6
|
+
module Expressir
|
|
7
|
+
module Commands
|
|
8
|
+
class ValidateAscii < Base
|
|
9
|
+
def run(express_file_path) # rubocop:disable Metrics/AbcSize
|
|
10
|
+
# Check if input is a manifest file
|
|
11
|
+
if File.file?(express_file_path) && File.extname(express_file_path) == ".yaml"
|
|
12
|
+
validate_from_manifest(express_file_path)
|
|
13
|
+
return
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Original file/directory validation logic
|
|
17
|
+
if File.file?(express_file_path)
|
|
18
|
+
unless File.exist?(express_file_path)
|
|
19
|
+
raise Errno::ENOENT, "Specified EXPRESS file " \
|
|
20
|
+
"`#{express_file_path}` not found."
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
if File.extname(express_file_path) != ".exp"
|
|
24
|
+
raise ArgumentError, "Specified file `#{express_file_path}` is " \
|
|
25
|
+
"not an EXPRESS file."
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
exp_files = [express_file_path]
|
|
29
|
+
elsif options[:recursive]
|
|
30
|
+
# Support the relative path with glob pattern
|
|
31
|
+
base_path = File.expand_path(express_file_path)
|
|
32
|
+
exp_files = Dir.glob("#{base_path}/**/*.exp")
|
|
33
|
+
else
|
|
34
|
+
# Non-recursive option
|
|
35
|
+
base_path = File.expand_path(express_file_path)
|
|
36
|
+
exp_files = Dir.glob("#{base_path}/*.exp")
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
if exp_files.empty?
|
|
40
|
+
raise Errno::ENOENT, "No EXPRESS files found in " \
|
|
41
|
+
"`#{express_file_path}`."
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
process_files(exp_files)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
def validate_from_manifest(manifest_path)
|
|
50
|
+
unless File.exist?(manifest_path)
|
|
51
|
+
raise Expressir::ManifestNotFoundError.new(manifest_path)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
say "Loading manifest: #{manifest_path}..." if options[:verbose]
|
|
55
|
+
|
|
56
|
+
# Load manifest
|
|
57
|
+
manifest = Expressir::SchemaManifest.from_file(manifest_path)
|
|
58
|
+
|
|
59
|
+
# Extract paths from manifest
|
|
60
|
+
exp_files = manifest.schemas.map(&:path).reject do |p|
|
|
61
|
+
p.nil? || p.empty?
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
if exp_files.empty?
|
|
65
|
+
raise Expressir::NoValidSchemaPathsError.new("No valid schema paths found in manifest")
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
say "Validating #{exp_files.size} schema(s) from manifest for ASCII compliance..." if options[:verbose]
|
|
69
|
+
|
|
70
|
+
process_files(exp_files)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def process_files(exp_files)
|
|
74
|
+
# Process all files and collect violations
|
|
75
|
+
collection = NonAsciiViolationCollection.new(
|
|
76
|
+
check_remarks: options[:check_remarks],
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
exp_files.each do |exp_file|
|
|
80
|
+
collection.process_file(exp_file)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Output results based on format
|
|
84
|
+
if options[:yaml]
|
|
85
|
+
require "yaml"
|
|
86
|
+
puts collection.to_yaml_data.to_yaml
|
|
87
|
+
else
|
|
88
|
+
collection.print_text_output
|
|
89
|
+
collection.print_table_output if collection.files_with_violations.positive?
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Expressir
|
|
4
|
+
module Commands
|
|
5
|
+
class ValidateLoad < Base
|
|
6
|
+
def run(paths)
|
|
7
|
+
# Determine if input is a manifest or direct paths
|
|
8
|
+
if paths.size == 1 && File.extname(paths.first) == ".yaml"
|
|
9
|
+
validate_from_manifest(paths.first)
|
|
10
|
+
else
|
|
11
|
+
validate_from_paths(paths)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def validate_from_manifest(manifest_path)
|
|
18
|
+
unless File.exist?(manifest_path)
|
|
19
|
+
raise Expressir::ManifestNotFoundError.new(manifest_path)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
say "Loading manifest: #{manifest_path}..." if options[:verbose]
|
|
23
|
+
|
|
24
|
+
# Load manifest
|
|
25
|
+
manifest = Expressir::SchemaManifest.from_file(manifest_path)
|
|
26
|
+
|
|
27
|
+
# Extract paths from manifest
|
|
28
|
+
paths = manifest.schemas.map(&:path).reject { |p| p.nil? || p.empty? }
|
|
29
|
+
|
|
30
|
+
if paths.empty?
|
|
31
|
+
raise Expressir::NoValidSchemaPathsError.new("No valid schema paths found in manifest")
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
say "Validating #{paths.size} schema(s) from manifest..." if options[:verbose]
|
|
35
|
+
|
|
36
|
+
validate_from_paths(paths)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def validate_from_paths(paths)
|
|
40
|
+
no_version = []
|
|
41
|
+
no_valid = []
|
|
42
|
+
|
|
43
|
+
paths.each do |path|
|
|
44
|
+
x = Pathname.new(path).realpath.relative_path_from(Dir.pwd)
|
|
45
|
+
say "Validating #{x}"
|
|
46
|
+
ret = validate_schema(path)
|
|
47
|
+
|
|
48
|
+
if ret.nil?
|
|
49
|
+
no_valid << "Failed to parse: #{x}"
|
|
50
|
+
next
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
ret.each do |schema_id|
|
|
54
|
+
no_version << "Missing version string: schema `#{schema_id}` | #{x}"
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
print_validation_errors(:failed_to_parse, no_valid)
|
|
59
|
+
print_validation_errors(:missing_version_string, no_version)
|
|
60
|
+
|
|
61
|
+
unless [no_valid, no_version].all?(&:empty?)
|
|
62
|
+
raise Expressir::SchemaValidationError.new(
|
|
63
|
+
"Schema validation failed",
|
|
64
|
+
errors: no_valid + no_version,
|
|
65
|
+
)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
say "Validation passed for all EXPRESS schemas."
|
|
69
|
+
end
|
|
70
|
+
|
|
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
|
+
def print_validation_errors(type, array)
|
|
82
|
+
return if array.empty?
|
|
83
|
+
|
|
84
|
+
say "#{'*' * 20} RESULTS: #{type.to_s.upcase.tr('_', ' ')} #{'*' * 20}"
|
|
85
|
+
array.each do |msg|
|
|
86
|
+
say msg
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Expressir
|
|
4
|
+
module Commands
|
|
5
|
+
# `expressir xsd` (#276): write the XML Schema rendering of the
|
|
6
|
+
# schema at PATH.
|
|
7
|
+
class Xsd < Base
|
|
8
|
+
def run(path)
|
|
9
|
+
repo = Expressir::Express::Parser.from_file(path)
|
|
10
|
+
schema = repo.schemas.first
|
|
11
|
+
raise Thor::Error, "no schema in #{path}" unless schema
|
|
12
|
+
|
|
13
|
+
xml = Expressir::Express::Xsd.format(schema)
|
|
14
|
+
if options[:output]
|
|
15
|
+
File.write(options[:output], xml)
|
|
16
|
+
say "written to #{options[:output]}"
|
|
17
|
+
else
|
|
18
|
+
$stdout.write(xml)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# lib/expressir/commands.rb
|
|
2
|
+
module Expressir
|
|
3
|
+
module Commands
|
|
4
|
+
autoload :Base, "#{__dir__}/commands/base"
|
|
5
|
+
autoload :Benchmark, "#{__dir__}/commands/benchmark"
|
|
6
|
+
autoload :BenchmarkCache, "#{__dir__}/commands/benchmark_cache"
|
|
7
|
+
autoload :Check, "#{__dir__}/commands/check"
|
|
8
|
+
autoload :Clean, "#{__dir__}/commands/clean"
|
|
9
|
+
autoload :Coverage, "#{__dir__}/commands/coverage"
|
|
10
|
+
autoload :Expand, "#{__dir__}/commands/expand"
|
|
11
|
+
autoload :Fix, "#{__dir__}/commands/fix"
|
|
12
|
+
autoload :Flatten, "#{__dir__}/commands/flatten"
|
|
13
|
+
autoload :Format, "#{__dir__}/commands/format"
|
|
14
|
+
autoload :ParityInputs, "#{__dir__}/commands/parity_inputs"
|
|
15
|
+
autoload :Validate, "#{__dir__}/commands/validate"
|
|
16
|
+
autoload :ValidateLoad, "#{__dir__}/commands/validate_load"
|
|
17
|
+
autoload :ValidateAscii, "#{__dir__}/commands/validate_ascii"
|
|
18
|
+
autoload :NonAsciiCharacter, "#{__dir__}/commands/non_ascii_character"
|
|
19
|
+
autoload :FileViolations, "#{__dir__}/commands/file_violations"
|
|
20
|
+
autoload :NonAsciiViolationCollection, "#{__dir__}/commands/non_ascii_violation_collection"
|
|
21
|
+
autoload :Changes, "#{__dir__}/commands/changes"
|
|
22
|
+
autoload :ChangesValidate, "#{__dir__}/commands/changes_validate"
|
|
23
|
+
autoload :ChangesImportEengine, "#{__dir__}/commands/changes_import_eengine"
|
|
24
|
+
autoload :Version, "#{__dir__}/commands/version"
|
|
25
|
+
autoload :Package, "#{__dir__}/commands/package"
|
|
26
|
+
autoload :Manifest, "#{__dir__}/commands/manifest"
|
|
27
|
+
autoload :MappingValidate, "#{__dir__}/commands/mapping_validate"
|
|
28
|
+
autoload :Xsd, "#{__dir__}/commands/xsd"
|
|
29
|
+
end
|
|
30
|
+
end
|
data/lib/expressir/config.rb
CHANGED
|
@@ -12,12 +12,49 @@ module Expressir
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
class Configuration
|
|
15
|
-
attr_accessor :logs
|
|
15
|
+
attr_accessor :logs, :benchmark_enabled, :benchmark_ips, :benchmark_verbose,
|
|
16
|
+
:benchmark_save, :benchmark_iterations, :benchmark_warmup, :benchmark_parallel,
|
|
17
|
+
:benchmark_format
|
|
16
18
|
|
|
17
19
|
def initialize
|
|
18
20
|
@logs = %i(error)
|
|
21
|
+
# Enable benchmarking via environment variable
|
|
22
|
+
@benchmark_enabled = ENV["EXPRESSIR_BENCHMARK"] == "true"
|
|
23
|
+
# Use benchmark-ips for detailed statistics
|
|
24
|
+
@benchmark_ips = ENV["EXPRESSIR_BENCHMARK_IPS"] == "true"
|
|
25
|
+
# Show verbose output for benchmarking
|
|
26
|
+
@benchmark_verbose = ENV["EXPRESSIR_BENCHMARK_VERBOSE"] == "true"
|
|
27
|
+
# Save benchmark results to file
|
|
28
|
+
@benchmark_save = ENV["EXPRESSIR_BENCHMARK_SAVE"] == "true"
|
|
29
|
+
# Number of iterations for benchmark-ips
|
|
30
|
+
@benchmark_iterations = (ENV["EXPRESSIR_BENCHMARK_ITERATIONS"] || "3").to_i
|
|
31
|
+
# Warmup time for benchmark-ips in seconds
|
|
32
|
+
@benchmark_warmup = (ENV["EXPRESSIR_BENCHMARK_WARMUP"] || "1").to_i
|
|
33
|
+
# Enable parallel processing (for future implementation)
|
|
34
|
+
@benchmark_parallel = ENV["EXPRESSIR_BENCHMARK_PARALLEL"] == "true"
|
|
35
|
+
# Output format for benchmark results (default, json, csv)
|
|
36
|
+
@benchmark_format = ENV["EXPRESSIR_BENCHMARK_FORMAT"] || "default"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Helper methods for checking benchmark settings
|
|
40
|
+
def benchmark_enabled?
|
|
41
|
+
@benchmark_enabled
|
|
19
42
|
end
|
|
20
|
-
end
|
|
21
43
|
|
|
22
|
-
|
|
44
|
+
def benchmark_ips?
|
|
45
|
+
@benchmark_enabled && @benchmark_ips
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def benchmark_verbose?
|
|
49
|
+
@benchmark_enabled && @benchmark_verbose
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def benchmark_save?
|
|
53
|
+
@benchmark_enabled && @benchmark_save
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def benchmark_parallel?
|
|
57
|
+
@benchmark_enabled && @benchmark_parallel
|
|
58
|
+
end
|
|
59
|
+
end
|
|
23
60
|
end
|