diff options
Diffstat (limited to 'src/sexpr/parser.py')
-rw-r--r-- | src/sexpr/parser.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/sexpr/parser.py b/src/sexpr/parser.py index 201f457..885c63c 100644 --- a/src/sexpr/parser.py +++ b/src/sexpr/parser.py @@ -1,6 +1,4 @@ class SExpr(object): - ''' print a SExpr - ''' __slots__ = ('_value') name = 'tmwa::sexpr::SExpr' enabled = True @@ -23,3 +21,19 @@ class SExpr(object): if t == 3: yield '(token)', v['_str'] yield '_span', v['_span'] + + test_extra = ''' + #include "../strings/fwd.hpp" + using tmwa::operator "" _s; + ''' + + tests = [ + ('tmwa::sexpr::SExpr(); value._type = tmwa::sexpr::LIST; value._list = {tmwa::sexpr::SExpr(), tmwa::sexpr::SExpr()}', + '{(list) = std::vector of length 2, capacity 2 = {{(list) = std::vector of length 0, capacity 0, _span = {begin = {<tmwa::io::Line> = {text = "", filename = "", line = 0, column = 0}, <No data fields>}, end = {<tmwa::io::Line> = {text = "", filename = "", line = 0, column = 0}, <No data fields>}}}, {(list) = std::vector of length 0, capacity 0, _span = {begin = {<tmwa::io::Line> = {text = "", filename = "", line = 0, column = 0}, <No data fields>}, end = {<tmwa::io::Line> = {text = "", filename = "", line = 0, column = 0}, <No data fields>}}}}, _span = {begin = {<tmwa::io::Line> = {text = "", filename = "", line = 0, column = 0}, <No data fields>}, end = {<tmwa::io::Line> = {text = "", filename = "", line = 0, column = 0}, <No data fields>}}}'), + ('tmwa::sexpr::SExpr(); value._type = tmwa::sexpr::INT; value._int = 42', + '{(int) = 42, _span = {begin = {<tmwa::io::Line> = {text = "", filename = "", line = 0, column = 0}, <No data fields>}, end = {<tmwa::io::Line> = {text = "", filename = "", line = 0, column = 0}, <No data fields>}}}'), + ('tmwa::sexpr::SExpr(); value._type = tmwa::sexpr::STRING; value._str = "Hello"_s', + '{(str) = "Hello", _span = {begin = {<tmwa::io::Line> = {text = "", filename = "", line = 0, column = 0}, <No data fields>}, end = {<tmwa::io::Line> = {text = "", filename = "", line = 0, column = 0}, <No data fields>}}}'), + ('tmwa::sexpr::SExpr(); value._type = tmwa::sexpr::TOKEN; value._str = "Hello"_s', + '{(token) = "Hello", _span = {begin = {<tmwa::io::Line> = {text = "", filename = "", line = 0, column = 0}, <No data fields>}, end = {<tmwa::io::Line> = {text = "", filename = "", line = 0, column = 0}, <No data fields>}}}'), + ] |