sysmlpy 0.79.0__tar.gz → 0.80.0__tar.gz
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.
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/PKG-INFO +1 -1
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/pyproject.toml +1 -1
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/__init__.py +8 -5
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/antlr_parser.py +144 -2
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/antlr_visitor.py +32 -4
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/definition.py +11 -3
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/evaluator.py +51 -4
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/usage.py +180 -23
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/LICENSE +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/README.md +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/__main__.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/antlr/README.md +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/antlr/SysMLv2Lexer.interp +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/antlr/SysMLv2Lexer.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/antlr/SysMLv2Lexer.tokens +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/antlr/SysMLv2Parser.interp +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/antlr/SysMLv2Parser.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/antlr/SysMLv2Parser.tokens +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/antlr/SysMLv2ParserListener.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/antlr/SysMLv2ParserVisitor.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/antlr/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.interp +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/antlr/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/antlr/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.tokens +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/boxes_view.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/diff.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/examples/attribute_values.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/examples/part_attributes.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/examples/tuples_sequences.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/formatting.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/grammar/antlr4/README.md +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.g4 +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.interp +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.tokens +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/grammar/antlr4/SysMLv2Parser.g4 +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/grammar/antlr4/SysMLv2Parser.interp +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/grammar/antlr4/SysMLv2Parser.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/grammar/antlr4/SysMLv2Parser.tokens +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/grammar/antlr4/SysMLv2ParserListener.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/grammar/antlr4/SysMLv2ParserVisitor.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/grammar/antlr4/desc.xml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/grammar/antlr4/examples/camera.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/grammar/antlr4/examples/toaster-system.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/grammar/antlr4/examples/vehicle-model.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/grammar/antlr4/pom.xml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/grammar/classes.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/interchange.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/LICENSE +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/README.md +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/__init__.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Analysis/AnalysisTooling.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Analysis/SampledFunctions.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Analysis/StateSpaceRepresentation.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Analysis/TradeStudies.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Cause and Effect/CausationConnections.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Cause and Effect/CauseAndEffect.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Geometry/ShapeItems.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Geometry/SpatialItems.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Metadata/ImageMetadata.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Metadata/ModelingMetadata.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Metadata/ParametersOfInterestMetadata.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Metadata/RiskMetadata.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/ISQ.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/ISQAcoustics.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/ISQAtomicNuclear.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/ISQBase.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/ISQCharacteristicNumbers.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/ISQChemistryMolecular.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/ISQCondensedMatter.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/ISQElectromagnetism.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/ISQInformation.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/ISQLight.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/ISQMechanics.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/ISQSpaceTime.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/ISQThermodynamics.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/MeasurementRefCalculations.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/MeasurementReferences.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/Quantities.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/QuantityCalculations.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/SI.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/SIPrefixes.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/TensorCalculations.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/Time.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/USCustomaryUnits.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Quantities and Units/VectorCalculations.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Requirement Derivation/DerivationConnections.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/domain/Requirement Derivation/RequirementDerivation.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/Base.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/BaseFunctions.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/BooleanFunctions.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/Clocks.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/CollectionFunctions.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/Collections.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/ComplexFunctions.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/ControlFunctions.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/ControlPerformances.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/DataFunctions.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/FeatureReferencingPerformances.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/IntegerFunctions.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/KerML.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/Links.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/Metaobjects.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/NaturalFunctions.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/NumericalFunctions.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/Objects.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/Observation.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/OccurrenceFunctions.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/Occurrences.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/Performances.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/RationalFunctions.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/RealFunctions.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/ScalarFunctions.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/ScalarValues.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/SequenceFunctions.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/SpatialFrames.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/StatePerformances.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/StringFunctions.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/Transfers.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/TransitionPerformances.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/TrigFunctions.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/Triggers.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/VectorFunctions.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/kernel/VectorValues.kerml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/Actions.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/Allocations.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/AnalysisCases.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/Attributes.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/Calculations.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/Cases.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/Connections.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/Constraints.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/Flows.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/Interfaces.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/Items.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/Metadata.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/Parts.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/Ports.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/Requirements.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/StandardViewDefinitions.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/States.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/SysML.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/UseCases.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/VerificationCases.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/library/systems/Views.sysml +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/lsp/__init__.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/lsp/__main__.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/lsp/protocol.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/lsp/server.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/lsp/stdio.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/navigate.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/plantuml.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/project.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/semantic.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/sim.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/spreadsheet.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/store.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/traceability.py +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/us_customary_units.txt +0 -0
- {sysmlpy-0.79.0 → sysmlpy-0.80.0}/src/sysmlpy/validator.py +0 -0
|
@@ -34,7 +34,7 @@ __all__ = [
|
|
|
34
34
|
"render_state_transition_view_svg", "boxes_view",
|
|
35
35
|
]
|
|
36
36
|
__author__ = "Jon Fox"
|
|
37
|
-
__version__ = "0.
|
|
37
|
+
__version__ = "0.80.0"
|
|
38
38
|
|
|
39
39
|
from sysmlpy.usage import (
|
|
40
40
|
Item, Attribute, Part, Port, Action, Reference, UseCase, Requirement, Interface, Message,
|
|
@@ -282,7 +282,7 @@ def load(fp) -> Model:
|
|
|
282
282
|
return loads(fp.read())
|
|
283
283
|
|
|
284
284
|
|
|
285
|
-
def loads(s: str, library=None) -> Model:
|
|
285
|
+
def loads(s: str, library=None, rescue_language="English") -> Model:
|
|
286
286
|
"""Loads a model from string.
|
|
287
287
|
|
|
288
288
|
This shortcut function allows a user to build a model from a string by
|
|
@@ -303,7 +303,8 @@ def loads(s: str, library=None) -> Model:
|
|
|
303
303
|
Model
|
|
304
304
|
Model instance built from the SysML source.
|
|
305
305
|
"""
|
|
306
|
-
return Model().load(s, library=library
|
|
306
|
+
return Model().load(s, library=library,
|
|
307
|
+
rescue_language=rescue_language)
|
|
307
308
|
|
|
308
309
|
|
|
309
310
|
def parse(s: str, library=None):
|
|
@@ -327,7 +328,8 @@ def parse(s: str, library=None):
|
|
|
327
328
|
return None, str(e).splitlines()
|
|
328
329
|
|
|
329
330
|
|
|
330
|
-
def load_grammar_antlr(fp, debug=False, library=None
|
|
331
|
+
def load_grammar_antlr(fp, debug=False, library=None,
|
|
332
|
+
rescue_language="English"):
|
|
331
333
|
"""SysML load from file pointer using ANTLR4 parser.
|
|
332
334
|
|
|
333
335
|
Deserialize ``fp`` (a ``.read()``-supporting file-like object containing
|
|
@@ -370,7 +372,8 @@ def load_grammar_antlr(fp, debug=False, library=None):
|
|
|
370
372
|
)
|
|
371
373
|
|
|
372
374
|
try:
|
|
373
|
-
return antlr_visitor.parse_to_dict(s, library=library
|
|
375
|
+
return antlr_visitor.parse_to_dict(s, library=library,
|
|
376
|
+
rescue_language=rescue_language)
|
|
374
377
|
except antlr_parser.SysMLSyntaxError as e:
|
|
375
378
|
raise
|
|
376
379
|
|
|
@@ -7,6 +7,7 @@ generated from the OMG SysML v2 specification (2026-05 release).
|
|
|
7
7
|
"""
|
|
8
8
|
import sys
|
|
9
9
|
import os
|
|
10
|
+
import warnings
|
|
10
11
|
|
|
11
12
|
from antlr4 import InputStream, CommonTokenStream
|
|
12
13
|
from antlr4.atn.PredictionMode import PredictionMode
|
|
@@ -51,7 +52,8 @@ def _make_parser(content):
|
|
|
51
52
|
return lexer, token_stream, parser
|
|
52
53
|
|
|
53
54
|
|
|
54
|
-
def parse(source, library=None, recover=False, prediction_mode="sll"
|
|
55
|
+
def parse(source, library=None, recover=False, prediction_mode="sll",
|
|
56
|
+
rescue_language="English"):
|
|
55
57
|
"""Parse SysML v2.0 source and return a parse tree.
|
|
56
58
|
|
|
57
59
|
Uses two-stage parsing by default (v0.56.0): a fast SLL prediction
|
|
@@ -77,6 +79,11 @@ def parse(source, library=None, recover=False, prediction_mode="sll"):
|
|
|
77
79
|
for debugging). ``"sll_only"`` keeps every pass in SLL
|
|
78
80
|
prediction — including the fallback pass — so diagnostics
|
|
79
81
|
reflect SLL behaviour (error parity with the fast path).
|
|
82
|
+
rescue_language : str, default "English"
|
|
83
|
+
Language tag used when a constraint body that does not parse as
|
|
84
|
+
SysML/KerML is salvaged as a textual representation
|
|
85
|
+
(``rep language "..." /* body */``) instead of failing the whole
|
|
86
|
+
model load (v0.80.0).
|
|
80
87
|
|
|
81
88
|
Returns
|
|
82
89
|
-------
|
|
@@ -90,13 +97,45 @@ def parse(source, library=None, recover=False, prediction_mode="sll"):
|
|
|
90
97
|
(after both parse stages).
|
|
91
98
|
"""
|
|
92
99
|
from pathlib import Path
|
|
93
|
-
|
|
100
|
+
|
|
94
101
|
# Handle string or file input
|
|
95
102
|
if hasattr(source, 'read'):
|
|
96
103
|
content = source.read()
|
|
97
104
|
else:
|
|
98
105
|
content = source
|
|
99
106
|
|
|
107
|
+
try:
|
|
108
|
+
return _parse_tree(content, recover=recover,
|
|
109
|
+
prediction_mode=prediction_mode)
|
|
110
|
+
except SysMLSyntaxError as original_error:
|
|
111
|
+
if recover or not rescue_language:
|
|
112
|
+
raise
|
|
113
|
+
# Constraint-body rescue (v0.80.0): a constraint whose body does
|
|
114
|
+
# not parse as SysML/KerML (e.g. natural-language text) fails the
|
|
115
|
+
# whole model. Salvage such bodies as language-tagged textual
|
|
116
|
+
# representations and retry once.
|
|
117
|
+
rescued = _rescue_constraint_bodies(content, rescue_language)
|
|
118
|
+
if rescued is None:
|
|
119
|
+
raise
|
|
120
|
+
new_content, rescued_names, rescued_language = rescued
|
|
121
|
+
try:
|
|
122
|
+
tree = _parse_tree(new_content, recover=False,
|
|
123
|
+
prediction_mode=prediction_mode)
|
|
124
|
+
except SysMLSyntaxError:
|
|
125
|
+
# Rescue did not make the model parseable (e.g. other errors
|
|
126
|
+
# elsewhere) — surface the original diagnostics.
|
|
127
|
+
raise original_error
|
|
128
|
+
for cname in rescued_names:
|
|
129
|
+
warnings.warn(
|
|
130
|
+
f"constraint {cname!r} body did not parse as SysML; captured "
|
|
131
|
+
f"as textual representation (language {rescued_language!r})",
|
|
132
|
+
stacklevel=3,
|
|
133
|
+
)
|
|
134
|
+
return tree
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def _parse_tree(content, recover=False, prediction_mode="sll"):
|
|
138
|
+
"""Two-stage ANTLR parse (no rescue); the body of historical parse()."""
|
|
100
139
|
force_ll = prediction_mode == "ll"
|
|
101
140
|
sll_only = prediction_mode == "sll_only" or force_ll
|
|
102
141
|
|
|
@@ -156,6 +195,109 @@ def parse(source, library=None, recover=False, prediction_mode="sll"):
|
|
|
156
195
|
return tree
|
|
157
196
|
|
|
158
197
|
|
|
198
|
+
def _rescue_constraint_bodies(content, language="English"):
|
|
199
|
+
"""Salvage constraint bodies that do not parse as SysML/KerML.
|
|
200
|
+
|
|
201
|
+
Scans the source for ``constraint ... { ... }`` blocks, trial-parses
|
|
202
|
+
each body, and wraps failing ones as language-tagged textual
|
|
203
|
+
representations (``rep language "..." /* body */``) so a
|
|
204
|
+
natural-language constraint no longer fails the whole model load.
|
|
205
|
+
|
|
206
|
+
Returns ``(new_content, [constraint names], language)`` when at least
|
|
207
|
+
one body was rewritten, ``None`` when nothing was salvageable.
|
|
208
|
+
|
|
209
|
+
Constraints whose body contains ``*/`` cannot be wrapped in a comment
|
|
210
|
+
and are left untouched (the original error stands).
|
|
211
|
+
"""
|
|
212
|
+
import re as _re
|
|
213
|
+
|
|
214
|
+
spans = []
|
|
215
|
+
try:
|
|
216
|
+
lexer = SysMLv2Lexer(InputStream(content))
|
|
217
|
+
lexer.removeErrorListeners()
|
|
218
|
+
tokens = CommonTokenStream(lexer)
|
|
219
|
+
tokens.fill()
|
|
220
|
+
except Exception:
|
|
221
|
+
return None
|
|
222
|
+
toks = [t for t in tokens.tokens if t.channel == 0]
|
|
223
|
+
n = len(toks)
|
|
224
|
+
i = 0
|
|
225
|
+
while i < n:
|
|
226
|
+
t = toks[i]
|
|
227
|
+
if t.type != SysMLv2Parser.CONSTRAINT:
|
|
228
|
+
i += 1
|
|
229
|
+
continue
|
|
230
|
+
# Walk forward to the opening brace of the body (or bail on ';').
|
|
231
|
+
j = i + 1
|
|
232
|
+
name = None
|
|
233
|
+
lbrace = None
|
|
234
|
+
while j < n:
|
|
235
|
+
tt = toks[j]
|
|
236
|
+
if tt.type == SysMLv2Parser.LBRACE:
|
|
237
|
+
lbrace = j
|
|
238
|
+
break
|
|
239
|
+
if tt.type in (SysMLv2Parser.SEMI, SysMLv2Parser.RBRACE,
|
|
240
|
+
SysMLv2Parser.EOF):
|
|
241
|
+
break
|
|
242
|
+
if name is None and tt.type != SysMLv2Parser.DEF:
|
|
243
|
+
name = tt.text
|
|
244
|
+
j += 1
|
|
245
|
+
if lbrace is None:
|
|
246
|
+
i += 1
|
|
247
|
+
continue
|
|
248
|
+
# Brace-match the body (token stream already excludes comments).
|
|
249
|
+
depth = 0
|
|
250
|
+
k = lbrace
|
|
251
|
+
while k < n:
|
|
252
|
+
if toks[k].type == SysMLv2Parser.LBRACE:
|
|
253
|
+
depth += 1
|
|
254
|
+
elif toks[k].type == SysMLv2Parser.RBRACE:
|
|
255
|
+
depth -= 1
|
|
256
|
+
if depth == 0:
|
|
257
|
+
break
|
|
258
|
+
k += 1
|
|
259
|
+
if k >= n or depth != 0:
|
|
260
|
+
i += 1
|
|
261
|
+
continue
|
|
262
|
+
if k > lbrace + 1:
|
|
263
|
+
start = toks[lbrace + 1].start
|
|
264
|
+
end = toks[k - 1].stop
|
|
265
|
+
body_text = content[start:end + 1]
|
|
266
|
+
else:
|
|
267
|
+
body_text = ""
|
|
268
|
+
start = end = toks[lbrace].stop + 1
|
|
269
|
+
if body_text.strip():
|
|
270
|
+
spans.append((name or "?", start, end, body_text))
|
|
271
|
+
i = k + 1
|
|
272
|
+
|
|
273
|
+
if not spans:
|
|
274
|
+
return None
|
|
275
|
+
|
|
276
|
+
# Trial-parse every body first; rewrite only the ones that fail.
|
|
277
|
+
# Apply the replacements right-to-left so earlier offsets stay valid.
|
|
278
|
+
replacements = []
|
|
279
|
+
rescued_names = []
|
|
280
|
+
for cname, start, end, body_text in spans:
|
|
281
|
+
stripped = body_text.strip()
|
|
282
|
+
if not stripped or "*/" in stripped:
|
|
283
|
+
continue
|
|
284
|
+
probe = ("package __rescue_probe__ { constraint __c__ { "
|
|
285
|
+
+ stripped + " } }")
|
|
286
|
+
try:
|
|
287
|
+
_parse_tree(probe)
|
|
288
|
+
continue # body is valid SysML — leave it alone
|
|
289
|
+
except SysMLSyntaxError:
|
|
290
|
+
pass
|
|
291
|
+
replacements.append((start, end, stripped))
|
|
292
|
+
rescued_names.append(cname)
|
|
293
|
+
if not rescued_names:
|
|
294
|
+
return None
|
|
295
|
+
for start, end, replacement in sorted(replacements, reverse=True):
|
|
296
|
+
wrapped = 'rep language "%s" /*%s*/' % (language, replacement)
|
|
297
|
+
content = content[:start] + wrapped + content[end + 1:]
|
|
298
|
+
return content, rescued_names, language
|
|
299
|
+
|
|
300
|
+
|
|
159
301
|
def parse_file(filepath):
|
|
160
302
|
"""Parse a SysML v2.0 file.
|
|
161
303
|
|
|
@@ -527,7 +527,7 @@ def _visit_annotating_element_dict(annot_elem_ctx):
|
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
|
|
530
|
-
def parse_to_dict(source, library=None):
|
|
530
|
+
def parse_to_dict(source, library=None, rescue_language="English"):
|
|
531
531
|
"""Parse SysML source and return a dictionary.
|
|
532
532
|
|
|
533
533
|
Parameters
|
|
@@ -544,7 +544,8 @@ def parse_to_dict(source, library=None):
|
|
|
544
544
|
"""
|
|
545
545
|
from sysmlpy import antlr_parser
|
|
546
546
|
|
|
547
|
-
tree = antlr_parser.parse(source, library=library
|
|
547
|
+
tree = antlr_parser.parse(source, library=library,
|
|
548
|
+
rescue_language=rescue_language)
|
|
548
549
|
return _visit_root_namespace_dict(tree)
|
|
549
550
|
|
|
550
551
|
|
|
@@ -3535,8 +3536,9 @@ def _visit_non_behavior_body_item(nbi_ctx):
|
|
|
3535
3536
|
}
|
|
3536
3537
|
|
|
3537
3538
|
elif cname == 'DefinitionMemberContext':
|
|
3538
|
-
# Handle comments/documentation inside
|
|
3539
|
-
# Structure: DefinitionMember -> DefinitionElement ->
|
|
3539
|
+
# Handle comments/documentation/textual representations inside
|
|
3540
|
+
# bodies. Structure: DefinitionMember -> DefinitionElement ->
|
|
3541
|
+
# AnnotatingElement -> Comment | Documentation | TextualRepresentation
|
|
3540
3542
|
for c2 in child.children:
|
|
3541
3543
|
if type(c2).__name__ == 'DefinitionElementContext':
|
|
3542
3544
|
for c3 in c2.children:
|
|
@@ -3549,6 +3551,15 @@ def _visit_non_behavior_body_item(nbi_ctx):
|
|
|
3549
3551
|
doc = _visit_documentation_dict(c3.documentation())
|
|
3550
3552
|
if doc:
|
|
3551
3553
|
return doc
|
|
3554
|
+
elif hasattr(c3, 'textualRepresentation') and c3.textualRepresentation():
|
|
3555
|
+
# `rep language "English" /* body text */` —
|
|
3556
|
+
# a constraint/calc body expressed in another
|
|
3557
|
+
# language (v0.80.0). Keep the raw text (with
|
|
3558
|
+
# /* */ markers) so classes.TextualRepresentation
|
|
3559
|
+
# dumps it back verbatim.
|
|
3560
|
+
tr = _visit_textual_representation_dict(c3.textualRepresentation())
|
|
3561
|
+
if tr:
|
|
3562
|
+
return tr
|
|
3552
3563
|
|
|
3553
3564
|
elif cname == 'StructureUsageMemberContext':
|
|
3554
3565
|
# Handle occurrence usages (parts, items, ports)
|
|
@@ -13407,6 +13418,23 @@ def _visit_usage_element_dict(usage_elem_ctx, prefix=None):
|
|
|
13407
13418
|
if hasattr(usage_elem_ctx, 'nonOccurrenceUsageElement') and usage_elem_ctx.nonOccurrenceUsageElement():
|
|
13408
13419
|
non_occ = usage_elem_ctx.nonOccurrenceUsageElement()
|
|
13409
13420
|
|
|
13421
|
+
# Handle referenceUsage (package-level `ref r : Engine;`).
|
|
13422
|
+
# Nested-body refs go through _visit_nested_non_occurrence_usage;
|
|
13423
|
+
# without this branch the package-level form was silently
|
|
13424
|
+
# dropped from the grammar dict.
|
|
13425
|
+
if hasattr(non_occ, 'referenceUsage') and non_occ.referenceUsage():
|
|
13426
|
+
ctx = non_occ.referenceUsage()
|
|
13427
|
+
inner = _make_reference_usage_dict(ctx)
|
|
13428
|
+
if inner:
|
|
13429
|
+
return {
|
|
13430
|
+
"name": "PackageMember",
|
|
13431
|
+
"prefix": prefix,
|
|
13432
|
+
"ownedRelatedElement": {
|
|
13433
|
+
"name": "UsageElement",
|
|
13434
|
+
"ownedRelatedElement": inner,
|
|
13435
|
+
},
|
|
13436
|
+
}
|
|
13437
|
+
|
|
13410
13438
|
if hasattr(non_occ, 'attributeUsage') and non_occ.attributeUsage():
|
|
13411
13439
|
ctx = non_occ.attributeUsage()
|
|
13412
13440
|
name, shortname = _get_usage_identification(ctx)
|
|
@@ -24,7 +24,7 @@ from sysmlpy import Part, Item, Port, Requirement, UseCase, Attribute, Action, C
|
|
|
24
24
|
from sysmlpy.usage import (
|
|
25
25
|
State, Constraint, Connection, Flow, Calculation, Enumeration,
|
|
26
26
|
Allocation, Metadata, Rendering, Individual, FlowDef,
|
|
27
|
-
View, Viewpoint, Concern,
|
|
27
|
+
View, Viewpoint, Concern, Reference,
|
|
28
28
|
)
|
|
29
29
|
|
|
30
30
|
ModelType = TypeVar("Model", bound="Model")
|
|
@@ -62,7 +62,8 @@ class Model(Searchable):
|
|
|
62
62
|
return f"{cls_name}(children=[{children_repr}])"
|
|
63
63
|
return f"{cls_name}()"
|
|
64
64
|
|
|
65
|
-
def load(self: type[ModelType], s: str, library=None
|
|
65
|
+
def load(self: type[ModelType], s: str, library=None,
|
|
66
|
+
rescue_language="English") -> ModelType:
|
|
66
67
|
"""Load a SysML model from a string using ANTLR4 parser.
|
|
67
68
|
|
|
68
69
|
Parameters
|
|
@@ -92,7 +93,8 @@ class Model(Searchable):
|
|
|
92
93
|
if first_word in invalid_starts:
|
|
93
94
|
raise ValueError("Base Model must be encapsulated by a package.")
|
|
94
95
|
|
|
95
|
-
definition = load_grammar_antlr(s, library=library
|
|
96
|
+
definition = load_grammar_antlr(s, library=library,
|
|
97
|
+
rescue_language=rescue_language)["ownedRelationship"]
|
|
96
98
|
return self._load_definition(definition)
|
|
97
99
|
|
|
98
100
|
def _load_definition(self: type[ModelType], definition) -> ModelType:
|
|
@@ -1112,6 +1114,12 @@ class Package(Searchable):
|
|
|
1112
1114
|
child = Attribute().load_from_grammar(inner_element)
|
|
1113
1115
|
child.parent = self
|
|
1114
1116
|
self.children.append(child)
|
|
1117
|
+
elif inner_class == "ReferenceUsage":
|
|
1118
|
+
# v0.79.1: package-level `ref r : Engine;` was dropped
|
|
1119
|
+
# from the object tree (visitor had no dispatch either).
|
|
1120
|
+
child = Reference().load_from_grammar(inner_element)
|
|
1121
|
+
child.parent = self
|
|
1122
|
+
self.children.append(child)
|
|
1115
1123
|
elif inner_class == "ActionDefinition":
|
|
1116
1124
|
child = Action(definition=True).load_from_grammar(inner_element)
|
|
1117
1125
|
child.parent = self
|
|
@@ -200,7 +200,9 @@ class _Collector:
|
|
|
200
200
|
self.root = _Namespace("", ())
|
|
201
201
|
self.types = {} # bare type name -> _Namespace (definitions)
|
|
202
202
|
self.calcs = {} # qname string -> (expr dict, scope namespaces)
|
|
203
|
-
|
|
203
|
+
# (qname string, expr dict, scope namespaces,
|
|
204
|
+
# [(language, text), ...] textual representations)
|
|
205
|
+
self.constraints = []
|
|
204
206
|
self._anon = 0
|
|
205
207
|
|
|
206
208
|
# -- entry ---------------------------------------------------------
|
|
@@ -306,10 +308,12 @@ class _Collector:
|
|
|
306
308
|
|
|
307
309
|
def _handle_constraint(self, node, qname, scope):
|
|
308
310
|
expr = self._body_expression(node.get("body"))
|
|
309
|
-
|
|
311
|
+
textual = self._body_textual_representations(node.get("body"))
|
|
312
|
+
if expr is None and not textual:
|
|
310
313
|
return
|
|
311
314
|
dn = _declared_name(node.get("declaration")) or self._anon_name()
|
|
312
|
-
self.constraints.append(
|
|
315
|
+
self.constraints.append(
|
|
316
|
+
("::".join(qname + (dn,)), expr, list(scope), textual))
|
|
313
317
|
|
|
314
318
|
@staticmethod
|
|
315
319
|
def _body_expression(body):
|
|
@@ -323,6 +327,40 @@ class _Collector:
|
|
|
323
327
|
return oe
|
|
324
328
|
return _find_first(body, "OwnedExpression")
|
|
325
329
|
|
|
330
|
+
@staticmethod
|
|
331
|
+
def _body_textual_representations(body):
|
|
332
|
+
"""[(language, text), ...] from `rep language "..." /* ... */` bodies.
|
|
333
|
+
|
|
334
|
+
The visitor places TextualRepresentation dicts at
|
|
335
|
+
body.part[].item[].item.ownedRelationship[] (CalculationBodyPart ->
|
|
336
|
+
CalculationBodyItem -> ActionBodyItem).
|
|
337
|
+
"""
|
|
338
|
+
out = []
|
|
339
|
+
if not isinstance(body, dict):
|
|
340
|
+
return out
|
|
341
|
+
for part in body.get("part") or []:
|
|
342
|
+
if not isinstance(part, dict):
|
|
343
|
+
continue
|
|
344
|
+
for item in part.get("item") or []:
|
|
345
|
+
if not isinstance(item, dict):
|
|
346
|
+
continue
|
|
347
|
+
abi = item.get("item")
|
|
348
|
+
if not isinstance(abi, dict) or \
|
|
349
|
+
abi.get("name") != "ActionBodyItem":
|
|
350
|
+
continue
|
|
351
|
+
rel = abi.get("ownedRelationship")
|
|
352
|
+
rels = rel if isinstance(rel, list) else (
|
|
353
|
+
[rel] if isinstance(rel, dict) else [])
|
|
354
|
+
for r in rels:
|
|
355
|
+
if isinstance(r, dict) and \
|
|
356
|
+
r.get("name") == "TextualRepresentation":
|
|
357
|
+
text = str(r.get("body") or "")
|
|
358
|
+
# Strip the /* */ comment markers the lexer keeps.
|
|
359
|
+
if text.startswith("/*") and text.endswith("*/"):
|
|
360
|
+
text = text[2:-2].strip()
|
|
361
|
+
out.append((r.get("language") or "", text))
|
|
362
|
+
return out
|
|
363
|
+
|
|
326
364
|
|
|
327
365
|
# ---------------------------------------------------------------------------
|
|
328
366
|
# evaluation pass
|
|
@@ -1104,10 +1142,19 @@ def check_constraints(model, bindings=None):
|
|
|
1104
1142
|
"""
|
|
1105
1143
|
collector = _collect_model(model)
|
|
1106
1144
|
results = []
|
|
1107
|
-
for qname, expr, scope in collector.constraints:
|
|
1145
|
+
for qname, expr, scope, textual in collector.constraints:
|
|
1108
1146
|
evaluator = _Evaluator(scope, bindings=bindings,
|
|
1109
1147
|
types=collector.types)
|
|
1110
1148
|
result = ConstraintResult(qualified_name=qname)
|
|
1149
|
+
if expr is None:
|
|
1150
|
+
language, text = textual[0]
|
|
1151
|
+
result.expression_text = text
|
|
1152
|
+
result.error = (
|
|
1153
|
+
"not machine-evaluable \u2014 textual body in language "
|
|
1154
|
+
f"'{language or 'unspecified'}': {text!r}"
|
|
1155
|
+
)
|
|
1156
|
+
results.append(result)
|
|
1157
|
+
continue
|
|
1111
1158
|
result.expression_text = _expression_text(expr)
|
|
1112
1159
|
try:
|
|
1113
1160
|
value = evaluator.evaluate(expr)
|