From 68cf598920a84d3792cc98df194182f41a949280 Mon Sep 17 00:00:00 2001 From: Arpad Ryszka Date: Sat, 28 Oct 2017 23:21:52 +0200 Subject: [PATCH] automatic whitespace for s-expression --- sexpr.parser | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sexpr.parser b/sexpr.parser index 5ac70c8..49d77c1 100644 --- a/sexpr.parser +++ b/sexpr.parser @@ -1,9 +1,8 @@ -ws:alias = [ \b\f\n\r\t\v]; -comment:alias = ";" [^\n]*; -wsc:alias = ws | comment; -number = "-"? ("0" | [1-9][0-9]*) ("." [0-9]+)? ([eE] [+\-]? [0-9]+)?; -string = "\"" ([^\\"] | "\\" .)* "\""; -symbol = ([^\\ \n\t\b\f\r\v\"()] | "\\" .)+; -list = "(" wsc* (expression wsc*)* ")"; +whitespace:ws = [ \b\f\n\r\t\v]; +comment:alias:ws = ";" [^\n]*; +number:nows = "-"? ("0" | [1-9][0-9]*) ("." [0-9]+)? ([eE] [+\-]? [0-9]+)?; +string:nows = "\"" ([^\\"] | "\\" .)* "\""; +symbol:nows = ([^\\ \n\t\b\f\r\v\"()] | "\\" .)+; +list = "(" expression* ")"; expression:alias = number | string | symbol | list; s-expression = expression;