More combine

This commit is contained in:
greg 2020-02-20 02:50:18 -08:00
parent cd49c2c78f
commit 1f4ea71cf9

View File

@ -217,14 +217,16 @@ fn expression_kind(text: &str) -> ParseResult<ExpressionKind> {
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<String, String> {
// let output = expression_kind(input)
let output = thing::perform_parsing(input);
Ok(format!("{:?}", output))
Ok(output)
}