mirror of
https://github.com/drewcassidy/yaclog-ksp.git
synced 2024-09-01 14:58:44 +00:00
cfgnode cleanup and update CHANGELOG.md
This commit is contained in:
parent
55352697dd
commit
7468c3c46f
@ -2,13 +2,19 @@
|
||||
|
||||
All notable changes to this project will be documented in this file
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Added
|
||||
|
||||
- Comment in generated files stating that it was automatically created by this tool
|
||||
|
||||
## 0.1.1 - 2021-04-16
|
||||
|
||||
yaclog-ksp is [now available on PyPi!](https://pypi.org/project/yaclog-ksp/)
|
||||
|
||||
### Changed
|
||||
|
||||
- generator will now use change values instead of nodes when possible for more concise output files.
|
||||
- Generator will now use change values instead of nodes when possible for more concise output files.
|
||||
|
||||
## 0.1.0 - 2021-04-16
|
||||
|
||||
|
@ -72,8 +72,8 @@ class ConfigNode:
|
||||
cfg_error(script, "unexpected end of file")
|
||||
|
||||
@classmethod
|
||||
def load(cls, textv):
|
||||
script = Script("", textv, "{}=", False)
|
||||
def load(cls, text):
|
||||
script = Script("", text, "{}=", False)
|
||||
script.error = cfg_error.__get__(script, Script)
|
||||
nodes = []
|
||||
while script.token_available(True):
|
||||
@ -176,21 +176,10 @@ class ConfigNode:
|
||||
segments[index] = "%s%s = %s\n" % (" " * (level + 1), val[0], val[1])
|
||||
index += 1
|
||||
for node in self.nodes:
|
||||
ntext = node[1].__str__(level + 1)
|
||||
segments[index] = "%s%s %s\n" % (" " * (level + 1), node[0], ntext)
|
||||
text = node[1].__str__(level + 1)
|
||||
segments[index] = "%s%s %s\n" % (" " * (level + 1), node[0], text)
|
||||
index += 1
|
||||
if level >= 0:
|
||||
segments[index] = "%s}\n" % (" " * level)
|
||||
index += 1
|
||||
return "".join(segments)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
|
||||
for arg in sys.argv[1:]:
|
||||
text = open(arg, "rt").read()
|
||||
try:
|
||||
node = ConfigNode.load(text)
|
||||
except ConfigNodeError as e:
|
||||
print(arg + e.message)
|
||||
|
Loading…
Reference in New Issue
Block a user