Metadata-Version: 2.2
Name: xsm-parser
Version: 0.1.4
Summary: Executable Shlaer-Mellor State Model Parser
Author-email: Leon Starr <leon_starr@modelint.com>
License: MIT License
        
        Copyright (c) 2019-2023 Leon Starr
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: repository, https://github.com/modelint/xsm-parser
Project-URL: documentation, https://github.com/modelint/xsm-parser/wiki
Keywords: action language,executable uml,state model,state machine,mbse,xuml,xtuml,platform independent,sysml
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Arpeggio
Requires-Dist: tomli; python_version < "3.11"
Provides-Extra: build
Requires-Dist: build; extra == "build"
Requires-Dist: twine; extra == "build"
Provides-Extra: dev
Requires-Dist: bump2version; extra == "dev"
Requires-Dist: pytest; extra == "dev"

# Executable State Model Parser

Parses an *.xsm file (Executable State Model) to yield an abstract syntax tree using python named tuples

### Why you need this

You need to process an *.xsm file in preparation for populating a database or some other purpose

### Installation

Create or use a python 3.11+ environment. Then

% pip install xsm-parser

At this point you can invoke the parser via the command line or from your python script.

#### From your python script

You need this import statement at a minimum:

    from xsm-parser.parser import StateModelParser

You then specify a path as shown:

    result = StateModelParser.parse_file(file_input=path_to_file, debug=False)

Check the code in `parser.py` to verify I haven't changed these parameters on you wihtout updating the readme.

In either case, `result` will be a list of parsed scrall statements. You may find the header of the `visitor.py`
file helpful in interpreting these results.

#### From the command line

This is not the intended usage scenario, but may be helpful for testing or exploration. Since the parser
may generate some diagnostic info you may want to create a fresh working directory and cd into it
first. From there...

    % xsm cabin.xsm

The .xsm extension is not necessary, but the file must contain xsm text. See this repository's wiki for
more about the xsm language. The grammar is defined in the [state_model.peg](https://github.com/modelint/xsm-parser/blob/main/src/xsm_parser/state_model.peg) file. (if the link breaks after I do some update to the code, 
just browse through the code looking for the state_model.peg file, and let me know so I can fix it)

You can also specify a debug option like this:

    % xsm cabin.xsm -D

This will create a diagnostics folder in your current working directory and deposit a couple of PDFs defining
the parse of both the state model grammar: `state_model_tree.pdf` and your supplied text: `state_model.pdf`.

You should also see a file named `xsm-parser.log` in a diagnostics directory within your working directory
