Whitespace fixes
This commit is contained in:
parent
3ce73a4b55
commit
5da61658ec
@ -421,8 +421,7 @@ fn expression_kind(text: &str) -> ParseResult<ExpressionKind> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn type_anno(text: &str) -> ParseResult<TypeIdentifier> {
|
fn type_anno(text: &str) -> ParseResult<TypeIdentifier> {
|
||||||
use nom::character::complete::char;
|
preceded(ws(tag(":")), ws(type_name))(text)
|
||||||
preceded(ws(char(':')), ws(type_name))(text)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn type_name(text: &str) -> ParseResult<TypeIdentifier> {
|
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> {
|
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
|
//TODO fix op
|
||||||
map(p, |(name, params, type_anno)| Signature { name, params, type_anno, operator: false })
|
map(p, |(name, params, type_anno)| Signature { name, params, type_anno, operator: false })
|
||||||
(text)
|
(text)
|
||||||
@ -484,7 +483,7 @@ fn formal_params(text: &str) -> ParseResult<Vec<FormalParam>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn formal_param(text: &str) -> ParseResult<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));
|
let p = tuple((ws(identifier), opt(ws(type_anno)), default));
|
||||||
map(p, |(name, anno, default)|
|
map(p, |(name, anno, default)|
|
||||||
FormalParam { name, anno, default })(text)
|
FormalParam { name, anno, default })(text)
|
||||||
|
Loading…
Reference in New Issue
Block a user