From 5da61658ec971c1a816d0ffbedb5ef2a3084956f Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 15 Mar 2020 03:45:52 -0700 Subject: [PATCH] Whitespace fixes --- schala-lang/language/src/parser.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/schala-lang/language/src/parser.rs b/schala-lang/language/src/parser.rs index bfc2bf3..f0ee761 100644 --- a/schala-lang/language/src/parser.rs +++ b/schala-lang/language/src/parser.rs @@ -421,8 +421,7 @@ fn expression_kind(text: &str) -> ParseResult { } fn type_anno(text: &str) -> ParseResult { - use nom::character::complete::char; - preceded(ws(char(':')), ws(type_name))(text) + preceded(ws(tag(":")), ws(type_name))(text) } fn type_name(text: &str) -> ParseResult { @@ -473,7 +472,7 @@ fn func_declaration(text: &str) -> ParseResult { } fn func_signature(text: &str) -> ParseResult { - let p = preceded(tag("fn"), tuple((identifier, formal_params, opt(type_anno)))); + let p = preceded(tag("fn"), cut(tuple((ws(identifier), ws(formal_params), opt(ws(type_anno)))))); //TODO fix op map(p, |(name, params, type_anno)| Signature { name, params, type_anno, operator: false }) (text) @@ -484,7 +483,7 @@ fn formal_params(text: &str) -> ParseResult> { } fn formal_param(text: &str) -> ParseResult { - let default = opt(preceded(ws(tag("=")), expression)); + let default = opt(preceded(ws(tag("=")), ws(expression))); let p = tuple((ws(identifier), opt(ws(type_anno)), default)); map(p, |(name, anno, default)| FormalParam { name, anno, default })(text)