Commit 8db866fc authored by Paul Warren's avatar Paul Warren
Browse files

Support for comments

parent 8b2f14cc
Pipeline #106 canceled with stages
......@@ -28,7 +28,7 @@ class Parser:
return schema
def eat_whitespace(self):
self.get_token(r'\s*')
self.get_token(r'(?m)\s*(--[^\r\n]*$)?\s*')
def parse_object(self, x):
x.add_type("object")
......@@ -64,10 +64,10 @@ class Parser:
c.add_type("string");
elif self.get_token('\#'):
c.add_type("number");
elif self.get_token('\%'):
c.add_type("boolean");
elif self.get_token('\^'):
elif self.get_token('B'):
c.add_type("boolean");
elif self.get_token('\~'):
c.add_type("null");
elif self.get_token('\{'):
self.parse_object(c)
elif self.get_token('\['):
......
......@@ -33,7 +33,7 @@ def test_short_schema():
"input": """
{
thing?:{
subthing1?:$,
subthing1?:$, -- with comment
subthing2:$,
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment