From d6d294cabcd01ec7060953e692b3e8c119bd04ec Mon Sep 17 00:00:00 2001 From: s-ol Date: Fri, 31 Jan 2020 16:05:06 +0100 Subject: nested parens in comments --- spec/parsing_spec.moon | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'spec') diff --git a/spec/parsing_spec.moon b/spec/parsing_spec.moon index f1c85f2..5af12ba 100644 --- a/spec/parsing_spec.moon +++ b/spec/parsing_spec.moon @@ -1,4 +1,4 @@ -import space, atom, expr, explist, sexpr, nexpr, program from require 'parsing' +import space, atom, expr, explist, sexpr, nexpr, program, comment from require 'parsing' describe 'atom parsing', -> test 'symbols', -> @@ -104,6 +104,19 @@ describe 'sexpr', -> assert.is.equal 42, node.tag assert.is.equal str, node\stringify! +describe 'comments', -> + comment = comment / 1 + test 'simple parsing', -> + str = '#(this is a comment)' + assert.is.equal str, comment\match str + + test 'nested parsing', -> + str = '#(this is a comment (with nested parenthesis))' + assert.is.equal str, comment\match str + + str = '#(this is a comment #(with nested comments))' + assert.is.equal str, comment\match str + describe 'resynthesis', -> test 'mixed parsing', -> str = '( 3 ok-yes -- cgit v1.2.3