diff --git a/schala-lang/language/src/parser.rs b/schala-lang/language/src/parser.rs index bf0e961..50a65c7 100644 --- a/schala-lang/language/src/parser.rs +++ b/schala-lang/language/src/parser.rs @@ -217,14 +217,16 @@ fn expression_kind(text: &str) -> ParseResult { mod thing { use crate::ast::*; use crate::builtin::Builtin; - use combine::{many1, Parser, sep_by}; - use combine::parser::char::{letter, space}; - pub fn perform_parsing(input: &str) -> () { - let word = many1(letter()); - let mut parser = sep_by(word, space()); - let result = parser.parse(input); - result + use combine::parser::range::{range, take_while1}; + use combine::parser::repeat::sep_by; + use combine::*; + + pub fn perform_parsing(input: &str) -> String { + let identifier = take_while1(|c: char| c.is_alphabetic()); + let mut parser = sep_by(identifier, range(", ")); + let result: Result<(Vec<&str>, &str), _> = parser.easy_parse(input); + format!("{:?}", result) } } @@ -232,5 +234,5 @@ mod thing { pub fn perform_parsing(input: &str) -> Result { // let output = expression_kind(input) let output = thing::perform_parsing(input); - Ok(format!("{:?}", output)) + Ok(output) }