Fix newlines
This commit is contained in:
parent
8d7f8f555f
commit
08a4800175
@ -9,11 +9,12 @@ fn rc_string(s: &str) -> Rc<String> {
|
|||||||
peg::parser! {
|
peg::parser! {
|
||||||
pub grammar schala_parser() for str {
|
pub grammar schala_parser() for str {
|
||||||
|
|
||||||
rule whitespace() = [' ' | '\t' | '\n']*
|
rule whitespace() = [' ' | '\t' ]*
|
||||||
|
rule whitespace_or_newline() = [' ' | '\t' | '\n' ]*
|
||||||
|
|
||||||
rule _ = quiet!{ whitespace() }
|
rule _ = quiet!{ whitespace() }
|
||||||
|
|
||||||
rule __ = quiet!{ [' ' | '\t' ]* }
|
rule __ = quiet!{ whitespace_or_newline() }
|
||||||
|
|
||||||
pub rule program() -> AST =
|
pub rule program() -> AST =
|
||||||
statements:(statement() ** delimiter() ) { AST { id: Default::default(), statements: statements.into() } }
|
statements:(statement() ** delimiter() ) { AST { id: Default::default(), statements: statements.into() } }
|
||||||
@ -32,8 +33,8 @@ peg::parser! {
|
|||||||
kind:statement_kind() { Statement { id: Default::default(), location: Default::default(), kind } }
|
kind:statement_kind() { Statement { id: Default::default(), location: Default::default(), kind } }
|
||||||
|
|
||||||
rule statement_kind() -> StatementKind =
|
rule statement_kind() -> StatementKind =
|
||||||
_ decl:declaration() { StatementKind::Declaration(decl) } /
|
__ decl:declaration() { StatementKind::Declaration(decl) } /
|
||||||
_ expr:expression() { StatementKind::Expression(expr) }
|
__ expr:expression() { StatementKind::Expression(expr) }
|
||||||
|
|
||||||
rule declaration() -> Declaration =
|
rule declaration() -> Declaration =
|
||||||
binding() / type_decl() / annotation() / func()
|
binding() / type_decl() / annotation() / func()
|
||||||
|
Loading…
Reference in New Issue
Block a user