Formatting
This commit is contained in:
+12
-9
@@ -1,7 +1,7 @@
|
||||
use crate::ast::diagnostics::Diagnostics;
|
||||
use crate::ast::lexer::{Lexer, Token, TokenKind};
|
||||
use crate::ast::nodes::{Node, Symbol, UntypedKind};
|
||||
use crate::ast::types::{Identity, Keyword, NodeIdentity, Value};
|
||||
use crate::ast::diagnostics::Diagnostics;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Parser<'a> {
|
||||
@@ -35,7 +35,8 @@ impl<'a> Parser<'a> {
|
||||
let next = match self.lexer.next_token() {
|
||||
Ok(t) => t,
|
||||
Err(e) => {
|
||||
self.diagnostics.push_error(e, Some(NodeIdentity::new(self.current_token.location)));
|
||||
self.diagnostics
|
||||
.push_error(e, Some(NodeIdentity::new(self.current_token.location)));
|
||||
Token {
|
||||
kind: TokenKind::EOF,
|
||||
location: self.current_token.location,
|
||||
@@ -331,7 +332,10 @@ impl<'a> Parser<'a> {
|
||||
fn parse_param_vector(&mut self) -> Node<UntypedKind> {
|
||||
if *self.peek() != TokenKind::LeftBracket {
|
||||
self.diagnostics.push_error(
|
||||
format!("Expected parameter vector [...] for fn, found {:?}", self.peek()),
|
||||
format!(
|
||||
"Expected parameter vector [...] for fn, found {:?}",
|
||||
self.peek()
|
||||
),
|
||||
Some(NodeIdentity::new(self.current_token.location)),
|
||||
);
|
||||
return Node {
|
||||
@@ -376,7 +380,10 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
_ => {
|
||||
self.diagnostics.push_error(
|
||||
format!("Expected identifier or pattern vector [...] for definition, found {:?}", next),
|
||||
format!(
|
||||
"Expected identifier or pattern vector [...] for definition, found {:?}",
|
||||
next
|
||||
),
|
||||
Some(NodeIdentity::new(self.current_token.location)),
|
||||
);
|
||||
Node {
|
||||
@@ -388,11 +395,7 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_call(
|
||||
&mut self,
|
||||
callee: Node<UntypedKind>,
|
||||
identity: Identity,
|
||||
) -> Node<UntypedKind> {
|
||||
fn parse_call(&mut self, callee: Node<UntypedKind>, identity: Identity) -> Node<UntypedKind> {
|
||||
let mut elements = Vec::new();
|
||||
|
||||
while *self.peek() != TokenKind::RightParen && *self.peek() != TokenKind::EOF {
|
||||
|
||||
Reference in New Issue
Block a user