equal
deleted
inserted
replaced
1 #!/usr/bin/env python3 |
1 #!/usr/bin/env python3 |
2 # vim: set fileencoding=utf-8 : |
2 # vim: set fileencoding=utf-8 : |
3 |
3 |
4 """\ |
4 """\ |
5 YML 2 compiler version 2.6.2 |
5 YML 2 compiler version 6.2 |
6 Copyleft (c), 2009-2019, Volker Birk http://fdik.org/yml/ |
6 Copyleft (c), 2009-2020, Volker Birk http://fdik.org/yml/ |
7 |
7 |
8 """ |
8 """ |
9 |
9 |
10 import sys, os, codecs, locale |
10 import sys, os, codecs, locale |
11 import fileinput, unicodedata |
11 import fileinput, unicodedata |
14 if __name__ == "__main__": |
14 if __name__ == "__main__": |
15 sys.path.insert(0, os.path.dirname(__file__)) |
15 sys.path.insert(0, os.path.dirname(__file__)) |
16 |
16 |
17 from yml2.pyPEG import parse, u |
17 from yml2.pyPEG import parse, u |
18 from yml2.yml2 import ymlCStyle, comment, oldSyntax |
18 from yml2.yml2 import ymlCStyle, comment, oldSyntax |
19 from yml2 import backend |
19 import yml2.backend as backend |
|
20 |
|
21 YML_DEFAULT_PATH = [os.path.dirname(backend.__file__)] |
20 |
22 |
21 def printInfo(option, opt_str, value, parser): |
23 def printInfo(option, opt_str, value, parser): |
22 sys.stdout.write(__doc__) |
24 sys.stdout.write(__doc__) |
23 sys.exit(0) |
25 sys.exit(0) |
24 |
26 |
60 |
62 |
61 try: |
63 try: |
62 if options.includePathText: |
64 if options.includePathText: |
63 backend.includePath = options.includePathText.split(':') |
65 backend.includePath = options.includePathText.split(':') |
64 |
66 |
65 dirs = os.environ.get('YML_PATH', '.').split(':') |
67 dirs = os.environ.get('YML_PATH', '.').split(':') + YML_DEFAULT_PATH |
66 backend.includePath.extend(dirs) |
68 backend.includePath.extend(dirs) |
67 |
69 |
68 files = fileinput.input(args, mode="rU", openhook=fileinput.hook_encoded(options.encoding)) |
70 files = fileinput.input(args, mode="rU", openhook=fileinput.hook_encoded(options.encoding)) |
69 |
71 |
70 ymlC = ymlCStyle() |
72 ymlC = ymlCStyle() |
99 sys.exit(5) |
101 sys.exit(5) |
100 |
102 |
101 |
103 |
102 if __name__ == "__main__": |
104 if __name__ == "__main__": |
103 sys.exit(main()) |
105 sys.exit(main()) |
|
106 |