check_model.py 640 B

1234567891011121314151617181920212223
  1. import argparse
  2. import sys
  3. import termcolor
  4. from sccd.statechart.parser.xml import *
  5. from sccd.statechart.static.priority import *
  6. if __name__ == "__main__":
  7. parser = argparse.ArgumentParser(
  8. description="Check if input file(s) is valid statechart model.")
  9. parser.add_argument('path', metavar='PATH', type=str, help="Model to check.")
  10. args = parser.parse_args()
  11. src = args.path
  12. path = os.path.dirname(src)
  13. rules = [("statechart", statechart_parser_rules(Globals(), path, load_external=True))]
  14. statechart = parse_f(src, rules)
  15. assert isinstance(statechart, Statechart)
  16. print("Model is OK.")