diff --git a/src/example.toml b/src/example.toml index 2191afa..a4b0e7f 100644 --- a/src/example.toml +++ b/src/example.toml @@ -75,12 +75,11 @@ contributors = [ ] [fruie] -apple.color = "red" apple.taste.sweet = true [fruie.apple.color] -test="oi" -[fruie.apple.taste] +test={"oi" = 14} +[fruie.apple.color.test] test2="oi" [fruie.apple.texture] # you can add sub-tables diff --git a/src/lexer.py b/src/lexer.py index 8f4ebcb..50ad46b 100644 --- a/src/lexer.py +++ b/src/lexer.py @@ -16,8 +16,12 @@ tokens = [ "INF", "NAN", "COMMENT", + "NEWLINE", ] +def t_NEWLINE(t): + r"\n+\s*" + return t # needs to check if datetime is valid def t_DATETIME(t): @@ -115,7 +119,7 @@ def t_error(t): t.lexer.skip(1) -t_ignore = "\n\t " +t_ignore = "\t " literals = "[]{},=" diff --git a/src/parser.py b/src/parser.py index f695745..0a05862 100644 --- a/src/parser.py +++ b/src/parser.py @@ -16,11 +16,11 @@ def p_content_single(p): def p_tomlEntries_table(p): - """tomlEntries : table""" + """tomlEntries : table NEWLINE""" def p_tomlEntries_object(p): - """tomlEntries : object""" + """tomlEntries : object NEWLINE""" def p_table_simple(p):