Проверка шаблона шины для iOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

parseLines.py 1.1KB

11 kuukautta sitten
123456789101112131415161718192021222324252627282930313233343536373839404142
  1. from parsing.CoreService import *
  2. from parsing.Mode import *
  3. from parsing.ModelWorld import *
  4. def parseLines(lines, structure):
  5. mode = Mode()
  6. for line in lines:
  7. # Определяем режим строки.
  8. mode.parseLine(line)
  9. ln = line.strip()
  10. # Игнорируем пустую строку.
  11. if len(ln) == 0:
  12. continue
  13. # Игнорируем комментарий.
  14. if ln.startswith("#"):
  15. continue
  16. # model.
  17. if mode.isModel:
  18. structure.model.parseLine(ln)
  19. # core.
  20. elif mode.isCore:
  21. structure.core.isPresent = True
  22. if mode.isAction:
  23. structure.core.parseAction(ln)
  24. elif mode.isPipe:
  25. structure.core.parsePipe(ln)
  26. # service.
  27. elif mode.isService:
  28. structure.service.isPresent = True
  29. if mode.isAction:
  30. structure.service.parseAction(ln)
  31. elif mode.isPipe:
  32. structure.service.parsePipe(ln)
  33. # world.
  34. elif mode.isWorld:
  35. structure.world.parseLine(ln)