mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 22:07:57 +02:00
Parsing tests
This commit is contained in:
@ -1,7 +1,10 @@
|
||||
use crate::parser::lexer::SpannedToken;
|
||||
use crate::prelude::*;
|
||||
use adhoc_derive::FromStr;
|
||||
use derive_new::new;
|
||||
use getset::Getters;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use std::io::Write;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize)]
|
||||
@ -27,6 +30,12 @@ impl Operator {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&str> for Operator {
|
||||
fn from(input: &str) -> Operator {
|
||||
Operator::from_str(input).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for Operator {
|
||||
type Err = ();
|
||||
fn from_str(input: &str) -> Result<Self, <Self as std::str::FromStr>::Err> {
|
||||
@ -53,6 +62,42 @@ pub enum Expression {
|
||||
VariableReference(Variable),
|
||||
}
|
||||
|
||||
impl From<&str> for Expression {
|
||||
fn from(input: &str) -> Expression {
|
||||
Expression::Leaf(Leaf::String(input.into()))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<i64> for Expression {
|
||||
fn from(input: i64) -> Expression {
|
||||
Expression::Leaf(Leaf::Int(input.into()))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<BarePath> for Expression {
|
||||
fn from(input: BarePath) -> Expression {
|
||||
Expression::Leaf(Leaf::Bare(input))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Variable> for Expression {
|
||||
fn from(input: Variable) -> Expression {
|
||||
Expression::VariableReference(input)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Flag> for Expression {
|
||||
fn from(input: Flag) -> Expression {
|
||||
Expression::Flag(input)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Binary> for Expression {
|
||||
fn from(input: Binary) -> Expression {
|
||||
Expression::Binary(Box::new(input))
|
||||
}
|
||||
}
|
||||
|
||||
impl Expression {
|
||||
crate fn print(&self) -> String {
|
||||
match self {
|
||||
@ -161,6 +206,13 @@ pub enum Variable {
|
||||
Other(String),
|
||||
}
|
||||
|
||||
crate fn var(name: &str) -> Expression {
|
||||
match name {
|
||||
"it" => Expression::VariableReference(Variable::It),
|
||||
other => Expression::VariableReference(Variable::Other(other.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
impl Variable {
|
||||
crate fn from_str(input: &str) -> Expression {
|
||||
match input {
|
||||
@ -183,6 +235,13 @@ impl Variable {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn bare(s: &str) -> BarePath {
|
||||
BarePath {
|
||||
head: s.into(),
|
||||
tail: vec![],
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq)]
|
||||
pub struct BarePath {
|
||||
head: String,
|
||||
@ -202,6 +261,45 @@ impl BarePath {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, FromStr)]
|
||||
pub enum Unit {
|
||||
#[adhoc(regex = "^B$")]
|
||||
B,
|
||||
#[adhoc(regex = "^KB$")]
|
||||
KB,
|
||||
#[adhoc(regex = "^MB$")]
|
||||
MB,
|
||||
#[adhoc(regex = "^GB$")]
|
||||
GB,
|
||||
#[adhoc(regex = "^TB$")]
|
||||
TB,
|
||||
#[adhoc(regex = "^PB$")]
|
||||
PB,
|
||||
}
|
||||
|
||||
impl From<&str> for Unit {
|
||||
fn from(input: &str) -> Unit {
|
||||
Unit::from_str(input).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl Unit {
|
||||
crate fn compute(&self, size: i64) -> Value {
|
||||
Value::int(match self {
|
||||
Unit::B => size,
|
||||
Unit::KB => size * 1024,
|
||||
Unit::MB => size * 1024 * 1024,
|
||||
Unit::GB => size * 1024 * 1024 * 1024,
|
||||
Unit::TB => size * 1024 * 1024 * 1024 * 1024,
|
||||
Unit::PB => size * 1024 * 1024 * 1024 * 1024 * 1024,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unit(num: i64, unit: impl Into<Unit>) -> Expression {
|
||||
Expression::Leaf(Leaf::Unit(num, unit.into()))
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq)]
|
||||
pub enum Leaf {
|
||||
String(String),
|
||||
@ -210,6 +308,7 @@ pub enum Leaf {
|
||||
#[allow(unused)]
|
||||
Boolean(bool),
|
||||
Int(i64),
|
||||
Unit(i64, Unit),
|
||||
}
|
||||
|
||||
crate fn bare_string(head: &String, tail: &Vec<String>) -> String {
|
||||
@ -225,6 +324,7 @@ impl Leaf {
|
||||
Leaf::Bare(path) => format!("{}", path.to_string()),
|
||||
Leaf::Boolean(b) => format!("{}", b),
|
||||
Leaf::Int(i) => format!("{}", i),
|
||||
Leaf::Unit(i, unit) => format!("{}{:?}", i, unit),
|
||||
}
|
||||
}
|
||||
|
||||
@ -234,17 +334,44 @@ impl Leaf {
|
||||
Leaf::Bare(path) => format!("{}", path.to_string()),
|
||||
Leaf::Boolean(b) => format!("{}", b),
|
||||
Leaf::Int(i) => format!("{}", i),
|
||||
Leaf::Unit(i, unit) => format!("{}{:?}", i, unit),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, new)]
|
||||
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq)]
|
||||
pub struct Binary {
|
||||
crate left: Expression,
|
||||
crate operator: Operator,
|
||||
crate right: Expression,
|
||||
}
|
||||
|
||||
impl Binary {
|
||||
crate fn new(
|
||||
left: impl Into<Expression>,
|
||||
operator: Operator,
|
||||
right: impl Into<Expression>,
|
||||
) -> Binary {
|
||||
Binary {
|
||||
left: left.into(),
|
||||
operator,
|
||||
right: right.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
crate fn binary(
|
||||
left: impl Into<Expression>,
|
||||
operator: impl Into<Operator>,
|
||||
right: impl Into<Expression>,
|
||||
) -> Binary {
|
||||
Binary {
|
||||
left: left.into(),
|
||||
operator: operator.into(),
|
||||
right: right.into(),
|
||||
}
|
||||
}
|
||||
|
||||
impl Binary {
|
||||
fn print(&self) -> String {
|
||||
format!(
|
||||
@ -271,6 +398,14 @@ pub enum Flag {
|
||||
Longhand(String),
|
||||
}
|
||||
|
||||
crate fn flag(s: &str) -> Flag {
|
||||
Flag::Longhand(s.into())
|
||||
}
|
||||
|
||||
crate fn short(s: &str) -> Flag {
|
||||
Flag::Shorthand(s.into())
|
||||
}
|
||||
|
||||
impl Flag {
|
||||
#[allow(unused)]
|
||||
crate fn print(&self) -> String {
|
||||
@ -286,13 +421,45 @@ impl Flag {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(new, Debug, Clone)]
|
||||
#[derive(new, Debug, Clone, Eq, PartialEq)]
|
||||
pub struct ParsedCommand {
|
||||
crate name: String,
|
||||
crate args: Vec<Expression>,
|
||||
}
|
||||
|
||||
#[derive(new, Debug)]
|
||||
impl ParsedCommand {
|
||||
fn print(&self) -> String {
|
||||
let mut out = vec![];
|
||||
|
||||
write!(out, "{}", self.name).unwrap();
|
||||
|
||||
for arg in self.args.iter() {
|
||||
write!(out, " {}", arg.print()).unwrap();
|
||||
}
|
||||
|
||||
String::from_utf8_lossy(&out).into_owned()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&str> for ParsedCommand {
|
||||
fn from(input: &str) -> ParsedCommand {
|
||||
ParsedCommand {
|
||||
name: input.to_string(),
|
||||
args: vec![],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<(&str, Vec<Expression>)> for ParsedCommand {
|
||||
fn from(input: (&str, Vec<Expression>)) -> ParsedCommand {
|
||||
ParsedCommand {
|
||||
name: input.0.to_string(),
|
||||
args: input.1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(new, Debug, Eq, PartialEq)]
|
||||
pub struct Pipeline {
|
||||
crate commands: Vec<ParsedCommand>,
|
||||
}
|
||||
@ -304,4 +471,8 @@ impl Pipeline {
|
||||
|
||||
Pipeline { commands }
|
||||
}
|
||||
|
||||
crate fn print(&self) -> String {
|
||||
itertools::join(self.commands.iter().map(|i| i.print()), " | ")
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ crate enum TopToken {
|
||||
END,
|
||||
|
||||
#[regex = "-?[0-9]+"]
|
||||
#[callback = "after_num"]
|
||||
Num,
|
||||
|
||||
#[regex = r#"'([^']|\\')*'"#]
|
||||
@ -22,9 +23,6 @@ crate enum TopToken {
|
||||
#[regex = r#""([^"]|\\")*""#]
|
||||
DQString,
|
||||
|
||||
#[regex = "-?[0-9]+[A-Za-z]+"]
|
||||
UnitsNum,
|
||||
|
||||
#[regex = r"\$"]
|
||||
#[callback = "start_variable"]
|
||||
Dollar,
|
||||
@ -88,7 +86,6 @@ impl TopToken {
|
||||
Num => Token::Num,
|
||||
SQString => Token::SQString,
|
||||
DQString => Token::DQString,
|
||||
UnitsNum => Token::UnitsNum,
|
||||
Dollar => Token::Dollar,
|
||||
Bare => Token::Bare,
|
||||
Pipe => Token::Pipe,
|
||||
@ -113,6 +110,11 @@ impl TopToken {
|
||||
}
|
||||
}
|
||||
|
||||
fn after_num<S>(lex: &mut logos::Lexer<TopToken, S>) {
|
||||
trace!("after_num EXTRAS={:?}", lex.extras);
|
||||
lex.extras.current = LexerStateName::AfterNum;
|
||||
}
|
||||
|
||||
fn start_variable<S>(lex: &mut logos::Lexer<TopToken, S>) {
|
||||
trace!("start_variable EXTRAS={:?}", lex.extras);
|
||||
lex.extras.current = LexerStateName::Var;
|
||||
@ -123,6 +125,49 @@ fn end_bare_variable<S>(lex: &mut logos::Lexer<TopToken, S>) {
|
||||
lex.extras.current = LexerStateName::AfterVariableToken;
|
||||
}
|
||||
|
||||
#[derive(Logos, Debug, Clone, Copy, Eq, PartialEq)]
|
||||
#[extras = "LexerState"]
|
||||
crate enum AfterNum {
|
||||
#[error]
|
||||
Error,
|
||||
|
||||
#[end]
|
||||
END,
|
||||
|
||||
#[regex = "(B|KB|MB|GB|TB|PB)"]
|
||||
#[callback = "end_unit"]
|
||||
Unit,
|
||||
|
||||
#[regex = r"\s"]
|
||||
#[callback = "end_number"]
|
||||
Whitespace,
|
||||
}
|
||||
|
||||
impl AfterNum {
|
||||
fn to_token(&self) -> Option<Token> {
|
||||
use AfterNum::*;
|
||||
|
||||
let result = match self {
|
||||
END => return None,
|
||||
Unit => Token::Unit,
|
||||
Whitespace => Token::Whitespace,
|
||||
Error => unreachable!("Don't call to_token with the error variant"),
|
||||
};
|
||||
|
||||
Some(result)
|
||||
}
|
||||
}
|
||||
|
||||
fn end_unit<S>(lex: &mut logos::Lexer<AfterNum, S>) {
|
||||
trace!("end_unit EXTRAS={:?}", lex.extras);
|
||||
lex.extras.current = LexerStateName::Top;
|
||||
}
|
||||
|
||||
fn end_number<S>(lex: &mut logos::Lexer<AfterNum, S>) {
|
||||
trace!("end_unit EXTRAS={:?}", lex.extras);
|
||||
lex.extras.current = LexerStateName::Top;
|
||||
}
|
||||
|
||||
#[derive(Logos, Debug, Clone, Copy, Eq, PartialEq)]
|
||||
#[extras = "LexerState"]
|
||||
crate enum VariableToken {
|
||||
@ -241,6 +286,7 @@ crate enum LexerStateName {
|
||||
Top,
|
||||
Var,
|
||||
AfterMemberDot,
|
||||
AfterNum,
|
||||
AfterVariableToken,
|
||||
}
|
||||
|
||||
@ -344,7 +390,7 @@ pub enum Token {
|
||||
Num,
|
||||
SQString,
|
||||
DQString,
|
||||
UnitsNum,
|
||||
Unit,
|
||||
Dollar,
|
||||
Bare,
|
||||
Pipe,
|
||||
@ -421,6 +467,17 @@ impl Iterator for Lexer<'source> {
|
||||
}
|
||||
}
|
||||
|
||||
LexerStateName::AfterNum => {
|
||||
let (lexer, range, slice, token) = advance::<AfterNum>(self.lexer.clone());
|
||||
self.lexer = lexer;
|
||||
|
||||
match token {
|
||||
AfterNum::Error => return Some(Err(lex_error(&range, self.lexer.source))),
|
||||
AfterNum::Whitespace if !self.whitespace => self.next(),
|
||||
other => return spanned(other.to_token()?, slice, &range),
|
||||
}
|
||||
}
|
||||
|
||||
LexerStateName::AfterMemberDot => {
|
||||
let (lexer, range, slice, token) =
|
||||
advance::<AfterMemberDot>(self.lexer.clone());
|
||||
@ -708,7 +765,7 @@ mod tests {
|
||||
|
||||
assert_lex(
|
||||
"open input2.json | from-json | select glossary",
|
||||
tokens![ Bare("open") SP Bare("input2") "???." Member("json") SP "|" SP Bare("from-json") SP "|" SP Bare("select") SP Bare("glossary") ],
|
||||
tokens![ Bare("open") SP Bare("input2.json") SP "|" SP Bare("from-json") SP "|" SP Bare("select") SP Bare("glossary") ],
|
||||
);
|
||||
|
||||
assert_lex(
|
||||
|
@ -22,7 +22,7 @@ Command: ParsedCommand = {
|
||||
Leaf: Expression = {
|
||||
<String> => Expression::Leaf(Leaf::String(<>)),
|
||||
<Int> => Expression::Leaf(Leaf::Int(<>)),
|
||||
<UnitsNum> => Expression::Leaf(Leaf::Int(<>)),
|
||||
<UnitsNum> => Expression::Leaf(<>),
|
||||
<Var> => <>,
|
||||
}
|
||||
|
||||
@ -101,8 +101,8 @@ Int: i64 = {
|
||||
<"num"> => i64::from_str(<>.as_slice()).unwrap()
|
||||
}
|
||||
|
||||
UnitsNum: i64 = {
|
||||
<"unitsnum"> => Byte::from_string(<>.as_slice()).unwrap().get_bytes() as i64
|
||||
UnitsNum: Leaf = {
|
||||
<num: Int> <unit: "unit"> => Leaf::Unit(num, Unit::from_str(unit.as_slice()).unwrap())
|
||||
}
|
||||
|
||||
extern {
|
||||
@ -131,6 +131,6 @@ extern {
|
||||
"bare" => SpannedToken { token: Token::Bare, .. },
|
||||
"dqstring" => SpannedToken { token: Token::DQString, .. },
|
||||
"sqstring" => SpannedToken { token: Token::SQString, .. },
|
||||
"unitsnum" => SpannedToken { token: Token::UnitsNum, .. },
|
||||
"unit" => SpannedToken { token: Token::Unit, .. },
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
// auto-generated: "lalrpop 0.17.0"
|
||||
// sha256: 87c2cd6c2bebdfcacc6ef8d0463e82c6959682b98cab66dffe6dfaf11cb41
|
||||
// sha256: f1722e94b575b555d0b256de7fbf9e994068cc397fab85faa22717fb778ca4
|
||||
#![allow(unused)]
|
||||
use std::str::FromStr;
|
||||
use crate::parser::ast::*;
|
||||
@ -41,108 +41,109 @@ mod __parse__Pipeline {
|
||||
Variant10(i64),
|
||||
Variant11(Operator),
|
||||
Variant12(Pipeline),
|
||||
Variant13(Leaf),
|
||||
}
|
||||
const __ACTION: &'static [i8] = &[
|
||||
// State 0
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 1
|
||||
0, 22, 23, 0, 24, 25, 0, 0, 0, 0, 0, 0, 5, 26, 0, 27, 28, 29, 0, 30, -19, 0,
|
||||
0, 22, 23, 0, 24, 25, 0, 0, 0, 0, 0, 0, 5, 26, 0, 27, 28, 0, 0, 29, -19, 0,
|
||||
// State 2
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0,
|
||||
// State 3
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 4
|
||||
-14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, 34, -14, -14, 0, -14, -14, -14, 0, -14, -14, -14,
|
||||
-14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, 33, -14, -14, 0, -14, -14, 0, 0, -14, -14, -14,
|
||||
// State 5
|
||||
-53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, 0, -53, -53, -53, 0, -53, -53, -53,
|
||||
-53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, 0, -53, -53, 0, 0, -53, -53, -53,
|
||||
// State 6
|
||||
-45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, 0, -45, -45, 0, -45, -45, -45, 0, -45, -45, -45,
|
||||
-45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, 0, -45, -45, 0, -45, -45, 0, 0, -45, -45, -45,
|
||||
// State 7
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -21, 0,
|
||||
// State 8
|
||||
-54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, 0, -54, -54, -54, 0, -54, -54, -54,
|
||||
-54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, 0, -54, -54, 0, 0, -54, -54, -54,
|
||||
// State 9
|
||||
36, -24, -24, 0, -24, -24, 37, 38, 39, 40, 41, 0, -24, -24, 0, -24, -24, -24, 0, -24, -24, 0,
|
||||
35, -24, -24, 0, -24, -24, 36, 37, 38, 39, 40, 0, -24, -24, 0, -24, -24, 0, 0, -24, -24, 0,
|
||||
// State 10
|
||||
0, 22, 23, 0, 24, 25, 0, 0, 0, 0, 0, 0, 5, 26, 0, 27, 28, 29, 0, 30, -20, 0,
|
||||
0, 22, 23, 0, 24, 25, 0, 0, 0, 0, 0, 0, 5, 26, 0, 27, 28, 0, 0, 29, -20, 0,
|
||||
// State 11
|
||||
-46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, 0, -46, -46, 0, -46, -46, -46, 0, -46, -46, -46,
|
||||
-46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, 0, -46, -46, 0, -46, -46, 0, 0, -46, -46, -46,
|
||||
// State 12
|
||||
-30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, 0, -30, -30, -30, 0, -30, -30, -30,
|
||||
-30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, 0, -30, -30, 42, 0, -30, -30, -30,
|
||||
// State 13
|
||||
-13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, 0, -13, -13, -13, 0, -13, -13, -13,
|
||||
-13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, 0, -13, -13, 0, 0, -13, -13, -13,
|
||||
// State 14
|
||||
-12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, 0, -12, -12, -12, 0, -12, -12, -12,
|
||||
-12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, 0, -12, -12, 0, 0, -12, -12, -12,
|
||||
// State 15
|
||||
-22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, 0, -22, -22, 0, -22, -22, -22, 0, -22, -22, -22,
|
||||
-22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, 0, -22, -22, 0, -22, -22, 0, 0, -22, -22, -22,
|
||||
// State 16
|
||||
-23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, 0, -23, -23, 0, -23, -23, -23, 0, -23, -23, -23,
|
||||
-23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, 0, -23, -23, 0, -23, -23, 0, 0, -23, -23, -23,
|
||||
// State 17
|
||||
-29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, 0, -29, -29, -29, 0, -29, -29, -29,
|
||||
-29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, 0, -29, -29, 0, 0, -29, -29, -29,
|
||||
// State 18
|
||||
-31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, 0, -31, -31, -31, 0, -31, -31, -31,
|
||||
-31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, 0, -31, -31, 0, 0, -31, -31, -31,
|
||||
// State 19
|
||||
-32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, 0, -32, -32, -32, 0, -32, -32, -32,
|
||||
-32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, 0, -32, -32, 0, 0, -32, -32, -32,
|
||||
// State 20
|
||||
-44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, 44, -44, -44, 0, -44, -44, -44, 0, -44, -44, -44,
|
||||
-44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, 44, -44, -44, 0, -44, -44, 0, 0, -44, -44, -44,
|
||||
// State 21
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, 0, 0,
|
||||
// State 22
|
||||
0, 22, 23, 0, 24, 25, 0, 0, 0, 0, 0, 0, 5, 26, 0, 27, 28, 29, 0, 30, 0, 0,
|
||||
0, 22, 23, 0, 24, 25, 0, 0, 0, 0, 0, 0, 5, 26, 0, 27, 28, 0, 0, 29, 0, 0,
|
||||
// State 23
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 24
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 25
|
||||
-50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, 0, -50, -50, -50, 0, -50, -50, -50,
|
||||
-50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, 0, -50, -50, 0, 0, -50, -50, -50,
|
||||
// State 26
|
||||
-28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, 0, -28, -28, -28, 0, -28, -28, -28,
|
||||
// State 27
|
||||
-49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, 0, -49, -49, -49, 0, -49, -49, -49,
|
||||
-49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, 0, -49, -49, 0, 0, -49, -49, -49,
|
||||
// State 28
|
||||
-51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, 0, -51, -51, -51, 0, -51, -51, -51,
|
||||
0, 22, 23, 0, 24, 25, 0, 0, 0, 0, 0, 0, 5, 26, 0, 27, 28, 0, 0, 29, 0, 0,
|
||||
// State 29
|
||||
0, 22, 23, 0, 24, 25, 0, 0, 0, 0, 0, 0, 5, 26, 0, 27, 28, 29, 0, 30, 0, 0,
|
||||
// State 30
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 53, 0,
|
||||
// State 31
|
||||
// State 30
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 31
|
||||
-15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, 55, -15, -15, 0, -15, -15, 0, 0, -15, -15, -15,
|
||||
// State 32
|
||||
-15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, 55, -15, -15, 0, -15, -15, -15, 0, -15, -15, -15,
|
||||
// State 33
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 33
|
||||
0, 22, 23, 0, 24, 25, 0, 0, 0, 0, 0, 0, 5, 26, 0, 27, 28, 0, 0, 29, 0, 0,
|
||||
// State 34
|
||||
0, 22, 23, 0, 24, 25, 0, 0, 0, 0, 0, 0, 5, 26, 0, 27, 28, 29, 0, 30, 0, 0,
|
||||
0, -36, -36, 0, -36, -36, 0, 0, 0, 0, 0, 0, -36, -36, 0, -36, -36, 0, 0, -36, 0, 0,
|
||||
// State 35
|
||||
0, -36, -36, 0, -36, -36, 0, 0, 0, 0, 0, 0, -36, -36, 0, -36, -36, -36, 0, -36, 0, 0,
|
||||
0, -37, -37, 0, -37, -37, 0, 0, 0, 0, 0, 0, -37, -37, 0, -37, -37, 0, 0, -37, 0, 0,
|
||||
// State 36
|
||||
0, -37, -37, 0, -37, -37, 0, 0, 0, 0, 0, 0, -37, -37, 0, -37, -37, -37, 0, -37, 0, 0,
|
||||
0, -39, -39, 0, -39, -39, 0, 0, 0, 0, 0, 0, -39, -39, 0, -39, -39, 0, 0, -39, 0, 0,
|
||||
// State 37
|
||||
0, -39, -39, 0, -39, -39, 0, 0, 0, 0, 0, 0, -39, -39, 0, -39, -39, -39, 0, -39, 0, 0,
|
||||
0, -35, -35, 0, -35, -35, 0, 0, 0, 0, 0, 0, -35, -35, 0, -35, -35, 0, 0, -35, 0, 0,
|
||||
// State 38
|
||||
0, -35, -35, 0, -35, -35, 0, 0, 0, 0, 0, 0, -35, -35, 0, -35, -35, -35, 0, -35, 0, 0,
|
||||
0, -38, -38, 0, -38, -38, 0, 0, 0, 0, 0, 0, -38, -38, 0, -38, -38, 0, 0, -38, 0, 0,
|
||||
// State 39
|
||||
0, -38, -38, 0, -38, -38, 0, 0, 0, 0, 0, 0, -38, -38, 0, -38, -38, -38, 0, -38, 0, 0,
|
||||
0, -40, -40, 0, -40, -40, 0, 0, 0, 0, 0, 0, -40, -40, 0, -40, -40, 0, 0, -40, 0, 0,
|
||||
// State 40
|
||||
0, -40, -40, 0, -40, -40, 0, 0, 0, 0, 0, 0, -40, -40, 0, -40, -40, -40, 0, -40, 0, 0,
|
||||
0, -25, -25, 0, -25, -25, 0, 0, 0, 0, 0, 0, -25, -25, 0, -25, -25, 0, 0, -25, -25, 0,
|
||||
// State 41
|
||||
0, -25, -25, 0, -25, -25, 0, 0, 0, 0, 0, 0, -25, -25, 0, -25, -25, -25, 0, -25, -25, 0,
|
||||
-51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, 0, -51, -51, 0, 0, -51, -51, -51,
|
||||
// State 42
|
||||
-43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, 58, -43, -43, 0, -43, -43, -43, 0, -43, -43, -43,
|
||||
-43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, 58, -43, -43, 0, -43, -43, 0, 0, -43, -43, -43,
|
||||
// State 43
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 61, 0, 28, 0, 0, 0, 0, 0,
|
||||
// State 44
|
||||
-52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, 0, -52, -52, -52, 0, -52, -52, -52,
|
||||
-52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, 0, -52, -52, 0, 0, -52, -52, -52,
|
||||
// State 45
|
||||
0, 0, 0, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 46
|
||||
36, 0, 0, 0, 0, 0, 37, 38, 39, 40, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
35, 0, 0, 0, 0, 0, 36, 37, 38, 39, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 47
|
||||
-13, 0, 0, 63, 0, 0, -13, -13, -13, -13, -13, -13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 48
|
||||
-26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, 0, -26, -26, 0, -26, -26, -26, 0, -26, -26, -26,
|
||||
-26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, 0, -26, -26, 0, -26, -26, 0, 0, -26, -26, -26,
|
||||
// State 49
|
||||
-27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, 0, -27, -27, 0, -27, -27, -27, 0, -27, -27, -27,
|
||||
-27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, 0, -27, -27, 0, -27, -27, 0, 0, -27, -27, -27,
|
||||
// State 50
|
||||
-53, 0, 0, 0, 0, 0, -53, -53, -53, -53, -53, -53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64,
|
||||
// State 51
|
||||
@ -154,31 +155,31 @@ mod __parse__Pipeline {
|
||||
// State 54
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 55
|
||||
-4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 0, -4, -4, -4, 0, -4, -4, -4,
|
||||
-4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 0, -4, -4, 0, 0, -4, -4, -4,
|
||||
// State 56
|
||||
0, 0, 0, -16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16, -16,
|
||||
// State 57
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 61, 0, 28, 0, 0, 0, 0, 0,
|
||||
// State 58
|
||||
-7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, 0, -7, -7, -7, 0, -7, -7, -7,
|
||||
-7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, 0, -7, -7, 0, 0, -7, -7, -7,
|
||||
// State 59
|
||||
-34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 0, -34, -34, -34, 0, -34, -34, -34,
|
||||
-34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 0, -34, -34, 0, 0, -34, -34, -34,
|
||||
// State 60
|
||||
-33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, 0, -33, -33, -33, 0, -33, -33, -33,
|
||||
-33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, 0, -33, -33, 0, 0, -33, -33, -33,
|
||||
// State 61
|
||||
-42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, 0, -42, -42, -42, 0, -42, -42, -42,
|
||||
-42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, 0, -42, -42, 0, 0, -42, -42, -42,
|
||||
// State 62
|
||||
-41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, 0, -41, -41, -41, 0, -41, -41, -41,
|
||||
-41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, 0, -41, -41, 0, 0, -41, -41, -41,
|
||||
// State 63
|
||||
-17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, 0, -17, -17, -17, 0, -17, -17, -17,
|
||||
-17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, 0, -17, -17, 0, 0, -17, -17, -17,
|
||||
// State 64
|
||||
-18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, 0, -18, -18, -18, 0, -18, -18, -18,
|
||||
-18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, 0, -18, -18, 0, 0, -18, -18, -18,
|
||||
// State 65
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -11, 0,
|
||||
// State 66
|
||||
-5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, 0, -5, -5, -5, 0, -5, -5, -5,
|
||||
-5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, 0, -5, -5, 0, 0, -5, -5, -5,
|
||||
// State 67
|
||||
-8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, 0, -8, -8, -8, 0, -8, -8, -8,
|
||||
-8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, 0, -8, -8, 0, 0, -8, -8, -8,
|
||||
];
|
||||
const __EOF_ACTION: &'static [i8] = &[
|
||||
// State 0
|
||||
@ -238,15 +239,15 @@ mod __parse__Pipeline {
|
||||
// State 27
|
||||
-49,
|
||||
// State 28
|
||||
-51,
|
||||
0,
|
||||
// State 29
|
||||
0,
|
||||
// State 30
|
||||
-48,
|
||||
// State 31
|
||||
// State 30
|
||||
0,
|
||||
// State 32
|
||||
// State 31
|
||||
-15,
|
||||
// State 32
|
||||
0,
|
||||
// State 33
|
||||
0,
|
||||
// State 34
|
||||
@ -262,9 +263,9 @@ mod __parse__Pipeline {
|
||||
// State 39
|
||||
0,
|
||||
// State 40
|
||||
0,
|
||||
// State 41
|
||||
-25,
|
||||
// State 41
|
||||
-51,
|
||||
// State 42
|
||||
-43,
|
||||
// State 43
|
||||
@ -324,11 +325,11 @@ mod __parse__Pipeline {
|
||||
// State 1
|
||||
0, 0, 0, 0, 0, 0, 0, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 0, 0, 15, 16, 17, 0, 18, 19, 20, 21, 0,
|
||||
// State 2
|
||||
0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 3
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 4
|
||||
0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 5
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 6
|
||||
@ -338,9 +339,9 @@ mod __parse__Pipeline {
|
||||
// State 8
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 9
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 10
|
||||
0, 0, 0, 0, 0, 0, 0, 6, 7, 0, 9, 0, 42, 0, 12, 13, 14, 0, 0, 15, 16, 17, 0, 18, 19, 20, 21, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 6, 7, 0, 9, 0, 41, 0, 12, 13, 14, 0, 0, 15, 16, 17, 0, 18, 19, 20, 21, 0,
|
||||
// State 11
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 12
|
||||
@ -376,19 +377,19 @@ mod __parse__Pipeline {
|
||||
// State 27
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 28
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 29
|
||||
0, 0, 0, 0, 0, 0, 0, 51, 7, 52, 9, 0, 47, 0, 12, 13, 14, 0, 0, 15, 16, 17, 0, 18, 19, 20, 21, 0,
|
||||
// State 30
|
||||
// State 29
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 31
|
||||
// State 30
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 31
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 32
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 33
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 34
|
||||
0, 0, 0, 0, 0, 0, 0, 6, 7, 0, 9, 0, 57, 0, 12, 13, 14, 0, 0, 15, 16, 17, 0, 18, 19, 20, 21, 0,
|
||||
// State 34
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 35
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 36
|
||||
@ -412,7 +413,7 @@ mod __parse__Pipeline {
|
||||
// State 45
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 46
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 47
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// State 48
|
||||
@ -475,7 +476,7 @@ mod __parse__Pipeline {
|
||||
r###""member""###,
|
||||
r###""num""###,
|
||||
r###""sqstring""###,
|
||||
r###""unitsnum""###,
|
||||
r###""unit""###,
|
||||
r###""variable""###,
|
||||
r###""{""###,
|
||||
r###""|""###,
|
||||
@ -609,7 +610,7 @@ mod __parse__Pipeline {
|
||||
SpannedToken { token: Token::Member, .. } if true => Some(14),
|
||||
SpannedToken { token: Token::Num, .. } if true => Some(15),
|
||||
SpannedToken { token: Token::SQString, .. } if true => Some(16),
|
||||
SpannedToken { token: Token::UnitsNum, .. } if true => Some(17),
|
||||
SpannedToken { token: Token::Unit, .. } if true => Some(17),
|
||||
SpannedToken { token: Token::Variable, .. } if true => Some(18),
|
||||
SpannedToken { token: Token::OpenBrace, .. } if true => Some(19),
|
||||
SpannedToken { token: Token::Pipe, .. } if true => Some(20),
|
||||
@ -695,7 +696,7 @@ mod __parse__Pipeline {
|
||||
_ => unreachable!(),
|
||||
},
|
||||
17 => match __token {
|
||||
__tok @ SpannedToken { token: Token::UnitsNum, .. } => __Symbol::Variant0((__tok)),
|
||||
__tok @ SpannedToken { token: Token::Unit, .. } => __Symbol::Variant0((__tok)),
|
||||
_ => unreachable!(),
|
||||
},
|
||||
18 => match __token {
|
||||
@ -1027,7 +1028,7 @@ mod __parse__Pipeline {
|
||||
}
|
||||
50 => {
|
||||
__state_machine::SimulatedReduce::Reduce {
|
||||
states_to_pop: 1,
|
||||
states_to_pop: 2,
|
||||
nonterminal_produced: 24,
|
||||
}
|
||||
}
|
||||
@ -1308,6 +1309,17 @@ mod __parse__Pipeline {
|
||||
_ => panic!("symbol type mismatch")
|
||||
}
|
||||
}
|
||||
fn __pop_Variant13<
|
||||
'input,
|
||||
>(
|
||||
__symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>
|
||||
) -> (usize, Leaf, usize)
|
||||
{
|
||||
match __symbols.pop().unwrap() {
|
||||
(__l, __Symbol::Variant13(__v), __r) => (__l, __v, __r),
|
||||
_ => panic!("symbol type mismatch")
|
||||
}
|
||||
}
|
||||
fn __pop_Variant11<
|
||||
'input,
|
||||
>(
|
||||
@ -1992,7 +2004,7 @@ mod __parse__Pipeline {
|
||||
) -> (usize, usize)
|
||||
{
|
||||
// Leaf = UnitsNum => ActionFn(8);
|
||||
let __sym0 = __pop_Variant10(__symbols);
|
||||
let __sym0 = __pop_Variant13(__symbols);
|
||||
let __start = __sym0.0.clone();
|
||||
let __end = __sym0.2.clone();
|
||||
let __nt = super::__action8::<>(__sym0);
|
||||
@ -2357,13 +2369,14 @@ mod __parse__Pipeline {
|
||||
_: ::std::marker::PhantomData<(&'input ())>,
|
||||
) -> (usize, usize)
|
||||
{
|
||||
// UnitsNum = "unitsnum" => ActionFn(40);
|
||||
let __sym0 = __pop_Variant0(__symbols);
|
||||
// UnitsNum = Int, "unit" => ActionFn(40);
|
||||
let __sym1 = __pop_Variant0(__symbols);
|
||||
let __sym0 = __pop_Variant10(__symbols);
|
||||
let __start = __sym0.0.clone();
|
||||
let __end = __sym0.2.clone();
|
||||
let __nt = super::__action40::<>(__sym0);
|
||||
__symbols.push((__start, __Symbol::Variant10(__nt), __end));
|
||||
(1, 24)
|
||||
let __end = __sym1.2.clone();
|
||||
let __nt = super::__action40::<>(__sym0, __sym1);
|
||||
__symbols.push((__start, __Symbol::Variant13(__nt), __end));
|
||||
(2, 24)
|
||||
}
|
||||
pub(crate) fn __reduce51<
|
||||
'input,
|
||||
@ -2501,10 +2514,10 @@ fn __action7<
|
||||
fn __action8<
|
||||
'input,
|
||||
>(
|
||||
(_, __0, _): (usize, i64, usize),
|
||||
(_, __0, _): (usize, Leaf, usize),
|
||||
) -> Expression
|
||||
{
|
||||
Expression::Leaf(Leaf::Int(__0))
|
||||
Expression::Leaf(__0)
|
||||
}
|
||||
|
||||
fn __action9<
|
||||
@ -2804,10 +2817,11 @@ fn __action39<
|
||||
fn __action40<
|
||||
'input,
|
||||
>(
|
||||
(_, __0, _): (usize, SpannedToken<'input>, usize),
|
||||
) -> i64
|
||||
(_, num, _): (usize, i64, usize),
|
||||
(_, unit, _): (usize, SpannedToken<'input>, usize),
|
||||
) -> Leaf
|
||||
{
|
||||
Byte::from_string(__0.as_slice()).unwrap().get_bytes() as i64
|
||||
Leaf::Unit(num, Unit::from_str(unit.as_slice()).unwrap())
|
||||
}
|
||||
|
||||
fn __action41<
|
||||
|
@ -197,6 +197,7 @@ fn expect_simple_expr(expr: ast::Expression) -> Result<Value, ShellError> {
|
||||
ast::Leaf::String(s) => Value::string(s),
|
||||
ast::Leaf::Boolean(b) => Value::boolean(b),
|
||||
ast::Leaf::Int(i) => Value::int(i),
|
||||
ast::Leaf::Unit(i, unit) => unit.compute(i),
|
||||
}),
|
||||
|
||||
// TODO: Diagnostic
|
||||
|
Reference in New Issue
Block a user