parser tests

This commit is contained in:
Guilhem Fauré 2023-05-09 14:37:12 +02:00
parent cda96d1864
commit aa046aa45c

View File

@ -18,3 +18,18 @@ class content:
except Exception as e:
print(" PARSING FAILED :\n", e)
return markdown
# Parses a file & display its parse tree
def test(filename):
print(f"--- Parsing of {filename} ---\n")
parsed = spipParser.parse(open(path.dirname(__file__) + "/" + filename).read())
print(parsed, "\n")
print(f"--- Parse tree of {filename} ---\n\n", parsed.pretty(), "\n")
if __name__ == "__main__":
# Test
test("../test/0.spip")
test("../test/1.spip")
test("../test/2.spip")
test("../test/3.spip")
test("../test/4.spip")