|
|
@ -4,7 +4,7 @@ use super::{
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
pub fn parse_line(pair: Pair) -> Vec<Token> {
|
|
|
|
pub fn parse_line(pair: Pair) -> Vec<Token> {
|
|
|
|
pair.into_inner().map(|pair| parse_token(pair)).collect()
|
|
|
|
pair.into_inner().map(parse_token).collect()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Line description e.g. [String, Keyword, Array]
|
|
|
|
// Line description e.g. [String, Keyword, Array]
|
|
|
@ -12,10 +12,10 @@ pub fn parse_line(pair: Pair) -> Vec<Token> {
|
|
|
|
pub fn describe_line(line: &[Token]) -> String {
|
|
|
|
pub fn describe_line(line: &[Token]) -> String {
|
|
|
|
let mut description = "[".to_owned();
|
|
|
|
let mut description = "[".to_owned();
|
|
|
|
let mut iter = line.iter();
|
|
|
|
let mut iter = line.iter();
|
|
|
|
description.push_str(&format!("{}", iter.next().unwrap().print()));
|
|
|
|
description.push_str(iter.next().unwrap().print());
|
|
|
|
for token in iter {
|
|
|
|
for token in iter {
|
|
|
|
description.push_str(&format!(", {}", token.print()));
|
|
|
|
description.push_str(&format!(", {}", token.print()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
description.push_str("]");
|
|
|
|
description.push(']');
|
|
|
|
description
|
|
|
|
description
|
|
|
|
}
|
|
|
|
}
|
|
|
|