diff --git a/crates/lang/src/parser.rs b/crates/lang/src/parser.rs index 8422bc0..8090f7b 100644 --- a/crates/lang/src/parser.rs +++ b/crates/lang/src/parser.rs @@ -25,7 +25,6 @@ pub type Spanned = (T, Span); pub fn parse<'src>(src: &'src str) -> ParseResult, Rich<'_, Token<'_>>> { let toks: Vec<_> = Token::lexer(src) .spanned() - .into_iter() .map(|(t, s)| (t.expect("TODO: add lexer error(s)"), Span::from(s))) .collect(); let tok_stream = Stream::from_iter(toks).spanned((src.len()..src.len()).into()); @@ -55,7 +54,7 @@ pub(crate) fn parser< .separated_by(just(Token::Comma)) .collect::>() .map(IndexMap::from_iter) - .delimited_by(just(Token::BracketOpen), just(Token::BracketClose)) + .delimited_by(just(Token::BraceOpen), just(Token::BraceClose)) .map_with(|v, e| (v, e.span())) .labelled("attrset"); @@ -100,3 +99,17 @@ pub(crate) fn parser< decls: IndexMap::from_iter(decls), })) } + +pub mod asg { + use petgraph::graph::DiGraph; + + use super::Spanned; + + pub struct Asg<'src> { + graph: DiGraph, String>, + } + + enum AsgNode<'src> { + Node(Spanned<&'src str>), + } +} diff --git a/testfiles/test.owo b/testfiles/test.owo index f767d2a..11930d6 100644 --- a/testfiles/test.owo +++ b/testfiles/test.owo @@ -1,18 +1,18 @@ def main = meow | uwu - [ foo: @bar - , hello: world @| test [ more: params ] | yay - ] + { foo: @bar + , hello: world @| test { more: params } | yay + } !| awa @| nya | rawr; def test = meow - [ hello: $foo + { hello: $foo , world: @bar - ]; + }; -def blah = [ +def blah = { pipe1: meow | uwu, pipe2: lorem | ipsum -] | flkjdsafkjl; +} | flkjdsafkjl;