Whitespace fixes

This commit is contained in:
greg 2020-03-15 03:45:52 -07:00
parent 3ce73a4b55
commit 5da61658ec
1 changed files with 3 additions and 4 deletions

View File

@ -421,8 +421,7 @@ fn expression_kind(text: &str) -> ParseResult<ExpressionKind> {
}
fn type_anno(text: &str) -> ParseResult<TypeIdentifier> {
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<TypeIdentifier> {
@ -473,7 +472,7 @@ fn func_declaration(text: &str) -> ParseResult<Declaration> {
}
fn func_signature(text: &str) -> ParseResult<Signature> {
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<Vec<FormalParam>> {
}
fn formal_param(text: &str) -> ParseResult<FormalParam> {
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)