mirror of
https://github.com/fluencelabs/lalrpop
synced 2025-04-02 00:11:03 +00:00
Rename @< and @> to @L and @R
This commit is contained in:
parent
b08e0cfe17
commit
69a881d4a5
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -12,7 +12,7 @@ extern token {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub Items: Vec<(usize, usize)> = {
|
pub Items: Vec<(usize, usize)> = {
|
||||||
<@<> <@>> => vec![(<>)];
|
<@L> <@R> => vec![(<>)];
|
||||||
|
|
||||||
<v:Items> <e:Spanned<"+">> => {
|
<v:Items> <e:Spanned<"+">> => {
|
||||||
let mut v = v;
|
let mut v = v;
|
||||||
@ -24,5 +24,5 @@ pub Items: Vec<(usize, usize)> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Spanned<T>: (usize, usize) = {
|
Spanned<T>: (usize, usize) = {
|
||||||
<@<> T <@>> => (<>);
|
<@L> T <@R> => (<>);
|
||||||
};
|
};
|
||||||
|
@ -34,20 +34,20 @@ mod __parse__Items {
|
|||||||
use super::__ToTriple;
|
use super::__ToTriple;
|
||||||
|
|
||||||
pub enum __Nonterminal<> {
|
pub enum __Nonterminal<> {
|
||||||
Spanned_3c_22_2b_22_3e((usize, usize)),
|
|
||||||
_40_3e(usize),
|
|
||||||
____Items(Vec<(usize, usize)>),
|
____Items(Vec<(usize, usize)>),
|
||||||
_40_3c(usize),
|
|
||||||
Items(Vec<(usize, usize)>),
|
Items(Vec<(usize, usize)>),
|
||||||
|
Spanned_3c_22_2b_22_3e((usize, usize)),
|
||||||
|
_40L(usize),
|
||||||
|
_40R(usize),
|
||||||
}
|
}
|
||||||
|
|
||||||
// State 0
|
// State 0
|
||||||
// @< = (*) [EOF]
|
// @L = (*) [EOF]
|
||||||
// @< = (*) ["+"]
|
// @L = (*) ["+"]
|
||||||
// @< = (*) ["-"]
|
// @L = (*) ["-"]
|
||||||
// Items = (*) @< @> [EOF]
|
// Items = (*) @L @R [EOF]
|
||||||
// Items = (*) @< @> ["+"]
|
// Items = (*) @L @R ["+"]
|
||||||
// Items = (*) @< @> ["-"]
|
// Items = (*) @L @R ["-"]
|
||||||
// Items = (*) Items Spanned<"+"> [EOF]
|
// Items = (*) Items Spanned<"+"> [EOF]
|
||||||
// Items = (*) Items Spanned<"+"> ["+"]
|
// Items = (*) Items Spanned<"+"> ["+"]
|
||||||
// Items = (*) Items Spanned<"+"> ["-"]
|
// Items = (*) Items Spanned<"+"> ["-"]
|
||||||
@ -56,12 +56,12 @@ mod __parse__Items {
|
|||||||
// Items = (*) Items "-" ["-"]
|
// Items = (*) Items "-" ["-"]
|
||||||
// __Items = (*) Items [EOF]
|
// __Items = (*) Items [EOF]
|
||||||
//
|
//
|
||||||
// "-" -> Reduce(@< = => Lookahead;)
|
// "-" -> Reduce(@L = => Lookahead;)
|
||||||
// "+" -> Reduce(@< = => Lookahead;)
|
// EOF -> Reduce(@L = => Lookahead;)
|
||||||
// EOF -> Reduce(@< = => Lookahead;)
|
// "+" -> Reduce(@L = => Lookahead;)
|
||||||
//
|
//
|
||||||
|
// @L -> S1
|
||||||
// Items -> S2
|
// Items -> S2
|
||||||
// @< -> S1
|
|
||||||
pub fn __state0<
|
pub fn __state0<
|
||||||
__ERROR,
|
__ERROR,
|
||||||
__TOKENS: Iterator<Item=Result<(usize, Tok, usize),__ERROR>>,
|
__TOKENS: Iterator<Item=Result<(usize, Tok, usize),__ERROR>>,
|
||||||
@ -75,15 +75,15 @@ mod __parse__Items {
|
|||||||
match __lookahead {
|
match __lookahead {
|
||||||
Some((_, Tok::Minus(..), _)) => {
|
Some((_, Tok::Minus(..), _)) => {
|
||||||
let __nt = __lookahead.as_ref().map(|o| ::std::clone::Clone::clone(&o.0)).or_else(|| ::std::clone::Clone::clone(&__lookbehind)).unwrap_or_default();
|
let __nt = __lookahead.as_ref().map(|o| ::std::clone::Clone::clone(&o.0)).or_else(|| ::std::clone::Clone::clone(&__lookbehind)).unwrap_or_default();
|
||||||
__result = (__lookbehind, __lookahead, __Nonterminal::_40_3c(__nt));
|
__result = (__lookbehind, __lookahead, __Nonterminal::_40L(__nt));
|
||||||
}
|
|
||||||
Some((_, Tok::Plus(..), _)) => {
|
|
||||||
let __nt = __lookahead.as_ref().map(|o| ::std::clone::Clone::clone(&o.0)).or_else(|| ::std::clone::Clone::clone(&__lookbehind)).unwrap_or_default();
|
|
||||||
__result = (__lookbehind, __lookahead, __Nonterminal::_40_3c(__nt));
|
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
let __nt = __lookahead.as_ref().map(|o| ::std::clone::Clone::clone(&o.0)).or_else(|| ::std::clone::Clone::clone(&__lookbehind)).unwrap_or_default();
|
let __nt = __lookahead.as_ref().map(|o| ::std::clone::Clone::clone(&o.0)).or_else(|| ::std::clone::Clone::clone(&__lookbehind)).unwrap_or_default();
|
||||||
__result = (__lookbehind, __lookahead, __Nonterminal::_40_3c(__nt));
|
__result = (__lookbehind, __lookahead, __Nonterminal::_40L(__nt));
|
||||||
|
}
|
||||||
|
Some((_, Tok::Plus(..), _)) => {
|
||||||
|
let __nt = __lookahead.as_ref().map(|o| ::std::clone::Clone::clone(&o.0)).or_else(|| ::std::clone::Clone::clone(&__lookbehind)).unwrap_or_default();
|
||||||
|
__result = (__lookbehind, __lookahead, __Nonterminal::_40L(__nt));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Err(__ParseError::UnrecognizedToken {
|
return Err(__ParseError::UnrecognizedToken {
|
||||||
@ -95,14 +95,14 @@ mod __parse__Items {
|
|||||||
loop {
|
loop {
|
||||||
let (__lookbehind, __lookahead, __nt) = __result;
|
let (__lookbehind, __lookahead, __nt) = __result;
|
||||||
match __nt {
|
match __nt {
|
||||||
|
__Nonterminal::_40L(__nt) => {
|
||||||
|
let __sym0 = &mut Some(__nt);
|
||||||
|
__result = try!(__state1(__lookbehind, __lookahead, __tokens, __sym0));
|
||||||
|
}
|
||||||
__Nonterminal::Items(__nt) => {
|
__Nonterminal::Items(__nt) => {
|
||||||
let __sym0 = &mut Some(__nt);
|
let __sym0 = &mut Some(__nt);
|
||||||
__result = try!(__state2(__lookbehind, __lookahead, __tokens, __sym0));
|
__result = try!(__state2(__lookbehind, __lookahead, __tokens, __sym0));
|
||||||
}
|
}
|
||||||
__Nonterminal::_40_3c(__nt) => {
|
|
||||||
let __sym0 = &mut Some(__nt);
|
|
||||||
__result = try!(__state1(__lookbehind, __lookahead, __tokens, __sym0));
|
|
||||||
}
|
|
||||||
_ => {
|
_ => {
|
||||||
return Ok((__lookbehind, __lookahead, __nt));
|
return Ok((__lookbehind, __lookahead, __nt));
|
||||||
}
|
}
|
||||||
@ -111,18 +111,18 @@ mod __parse__Items {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// State 1
|
// State 1
|
||||||
// @> = (*) [EOF]
|
// @R = (*) [EOF]
|
||||||
// @> = (*) ["+"]
|
// @R = (*) ["+"]
|
||||||
// @> = (*) ["-"]
|
// @R = (*) ["-"]
|
||||||
// Items = @< (*) @> [EOF]
|
// Items = @L (*) @R [EOF]
|
||||||
// Items = @< (*) @> ["+"]
|
// Items = @L (*) @R ["+"]
|
||||||
// Items = @< (*) @> ["-"]
|
// Items = @L (*) @R ["-"]
|
||||||
//
|
//
|
||||||
// "-" -> Reduce(@> = => Lookbehind;)
|
// EOF -> Reduce(@R = => Lookbehind;)
|
||||||
// "+" -> Reduce(@> = => Lookbehind;)
|
// "-" -> Reduce(@R = => Lookbehind;)
|
||||||
// EOF -> Reduce(@> = => Lookbehind;)
|
// "+" -> Reduce(@R = => Lookbehind;)
|
||||||
//
|
//
|
||||||
// @> -> S3
|
// @R -> S3
|
||||||
pub fn __state1<
|
pub fn __state1<
|
||||||
__ERROR,
|
__ERROR,
|
||||||
__TOKENS: Iterator<Item=Result<(usize, Tok, usize),__ERROR>>,
|
__TOKENS: Iterator<Item=Result<(usize, Tok, usize),__ERROR>>,
|
||||||
@ -135,17 +135,17 @@ mod __parse__Items {
|
|||||||
{
|
{
|
||||||
let mut __result: (Option<usize>, Option<(usize, Tok, usize)>, __Nonterminal<>);
|
let mut __result: (Option<usize>, Option<(usize, Tok, usize)>, __Nonterminal<>);
|
||||||
match __lookahead {
|
match __lookahead {
|
||||||
|
None => {
|
||||||
|
let __nt = ::std::clone::Clone::clone(&__lookbehind).unwrap_or_default();
|
||||||
|
__result = (__lookbehind, __lookahead, __Nonterminal::_40R(__nt));
|
||||||
|
}
|
||||||
Some((_, Tok::Minus(..), _)) => {
|
Some((_, Tok::Minus(..), _)) => {
|
||||||
let __nt = ::std::clone::Clone::clone(&__lookbehind).unwrap_or_default();
|
let __nt = ::std::clone::Clone::clone(&__lookbehind).unwrap_or_default();
|
||||||
__result = (__lookbehind, __lookahead, __Nonterminal::_40_3e(__nt));
|
__result = (__lookbehind, __lookahead, __Nonterminal::_40R(__nt));
|
||||||
}
|
}
|
||||||
Some((_, Tok::Plus(..), _)) => {
|
Some((_, Tok::Plus(..), _)) => {
|
||||||
let __nt = ::std::clone::Clone::clone(&__lookbehind).unwrap_or_default();
|
let __nt = ::std::clone::Clone::clone(&__lookbehind).unwrap_or_default();
|
||||||
__result = (__lookbehind, __lookahead, __Nonterminal::_40_3e(__nt));
|
__result = (__lookbehind, __lookahead, __Nonterminal::_40R(__nt));
|
||||||
}
|
|
||||||
None => {
|
|
||||||
let __nt = ::std::clone::Clone::clone(&__lookbehind).unwrap_or_default();
|
|
||||||
__result = (__lookbehind, __lookahead, __Nonterminal::_40_3e(__nt));
|
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Err(__ParseError::UnrecognizedToken {
|
return Err(__ParseError::UnrecognizedToken {
|
||||||
@ -157,7 +157,7 @@ mod __parse__Items {
|
|||||||
while __sym0.is_some() {
|
while __sym0.is_some() {
|
||||||
let (__lookbehind, __lookahead, __nt) = __result;
|
let (__lookbehind, __lookahead, __nt) = __result;
|
||||||
match __nt {
|
match __nt {
|
||||||
__Nonterminal::_40_3e(__nt) => {
|
__Nonterminal::_40R(__nt) => {
|
||||||
let __sym1 = &mut Some(__nt);
|
let __sym1 = &mut Some(__nt);
|
||||||
__result = try!(__state3(__lookbehind, __lookahead, __tokens, __sym0, __sym1));
|
__result = try!(__state3(__lookbehind, __lookahead, __tokens, __sym0, __sym1));
|
||||||
}
|
}
|
||||||
@ -170,24 +170,24 @@ mod __parse__Items {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// State 2
|
// State 2
|
||||||
// @< = (*) ["+"]
|
// @L = (*) ["+"]
|
||||||
// Items = Items (*) Spanned<"+"> [EOF]
|
// Items = Items (*) Spanned<"+"> [EOF]
|
||||||
// Items = Items (*) Spanned<"+"> ["+"]
|
// Items = Items (*) Spanned<"+"> ["+"]
|
||||||
// Items = Items (*) Spanned<"+"> ["-"]
|
// Items = Items (*) Spanned<"+"> ["-"]
|
||||||
// Items = Items (*) "-" [EOF]
|
// Items = Items (*) "-" [EOF]
|
||||||
// Items = Items (*) "-" ["+"]
|
// Items = Items (*) "-" ["+"]
|
||||||
// Items = Items (*) "-" ["-"]
|
// Items = Items (*) "-" ["-"]
|
||||||
// Spanned<"+"> = (*) @< "+" @> [EOF]
|
// Spanned<"+"> = (*) @L "+" @R [EOF]
|
||||||
// Spanned<"+"> = (*) @< "+" @> ["+"]
|
// Spanned<"+"> = (*) @L "+" @R ["+"]
|
||||||
// Spanned<"+"> = (*) @< "+" @> ["-"]
|
// Spanned<"+"> = (*) @L "+" @R ["-"]
|
||||||
// __Items = Items (*) [EOF]
|
// __Items = Items (*) [EOF]
|
||||||
//
|
//
|
||||||
// "-" -> Shift(S4)
|
// "+" -> Reduce(@L = => Lookahead;)
|
||||||
// "+" -> Reduce(@< = => Lookahead;)
|
|
||||||
// EOF -> Reduce(__Items = Items => Call(ActionFn(0));)
|
// EOF -> Reduce(__Items = Items => Call(ActionFn(0));)
|
||||||
|
// "-" -> Shift(S4)
|
||||||
//
|
//
|
||||||
// Spanned<"+"> -> S6
|
// @L -> S6
|
||||||
// @< -> S5
|
// Spanned<"+"> -> S5
|
||||||
pub fn __state2<
|
pub fn __state2<
|
||||||
__ERROR,
|
__ERROR,
|
||||||
__TOKENS: Iterator<Item=Result<(usize, Tok, usize),__ERROR>>,
|
__TOKENS: Iterator<Item=Result<(usize, Tok, usize),__ERROR>>,
|
||||||
@ -208,7 +208,7 @@ mod __parse__Items {
|
|||||||
}
|
}
|
||||||
Some((_, Tok::Plus(..), _)) => {
|
Some((_, Tok::Plus(..), _)) => {
|
||||||
let __nt = __lookahead.as_ref().map(|o| ::std::clone::Clone::clone(&o.0)).or_else(|| ::std::clone::Clone::clone(&__lookbehind)).unwrap_or_default();
|
let __nt = __lookahead.as_ref().map(|o| ::std::clone::Clone::clone(&o.0)).or_else(|| ::std::clone::Clone::clone(&__lookbehind)).unwrap_or_default();
|
||||||
__result = (__lookbehind, __lookahead, __Nonterminal::_40_3c(__nt));
|
__result = (__lookbehind, __lookahead, __Nonterminal::_40L(__nt));
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
let __sym0 = __sym0.take().unwrap();
|
let __sym0 = __sym0.take().unwrap();
|
||||||
@ -225,13 +225,13 @@ mod __parse__Items {
|
|||||||
while __sym0.is_some() {
|
while __sym0.is_some() {
|
||||||
let (__lookbehind, __lookahead, __nt) = __result;
|
let (__lookbehind, __lookahead, __nt) = __result;
|
||||||
match __nt {
|
match __nt {
|
||||||
|
__Nonterminal::_40L(__nt) => {
|
||||||
|
let __sym1 = &mut Some(__nt);
|
||||||
|
__result = try!(__state6(__lookbehind, __lookahead, __tokens, __sym1));
|
||||||
|
}
|
||||||
__Nonterminal::Spanned_3c_22_2b_22_3e(__nt) => {
|
__Nonterminal::Spanned_3c_22_2b_22_3e(__nt) => {
|
||||||
let __sym1 = &mut Some(__nt);
|
let __sym1 = &mut Some(__nt);
|
||||||
__result = try!(__state6(__lookbehind, __lookahead, __tokens, __sym0, __sym1));
|
__result = try!(__state5(__lookbehind, __lookahead, __tokens, __sym0, __sym1));
|
||||||
}
|
|
||||||
__Nonterminal::_40_3c(__nt) => {
|
|
||||||
let __sym1 = &mut Some(__nt);
|
|
||||||
__result = try!(__state5(__lookbehind, __lookahead, __tokens, __sym1));
|
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Ok((__lookbehind, __lookahead, __nt));
|
return Ok((__lookbehind, __lookahead, __nt));
|
||||||
@ -242,13 +242,13 @@ mod __parse__Items {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// State 3
|
// State 3
|
||||||
// Items = @< @> (*) [EOF]
|
// Items = @L @R (*) [EOF]
|
||||||
// Items = @< @> (*) ["+"]
|
// Items = @L @R (*) ["+"]
|
||||||
// Items = @< @> (*) ["-"]
|
// Items = @L @R (*) ["-"]
|
||||||
//
|
//
|
||||||
// "+" -> Reduce(Items = @<, @> => Call(ActionFn(1));)
|
// "+" -> Reduce(Items = @L, @R => Call(ActionFn(1));)
|
||||||
// EOF -> Reduce(Items = @<, @> => Call(ActionFn(1));)
|
// "-" -> Reduce(Items = @L, @R => Call(ActionFn(1));)
|
||||||
// "-" -> Reduce(Items = @<, @> => Call(ActionFn(1));)
|
// EOF -> Reduce(Items = @L, @R => Call(ActionFn(1));)
|
||||||
//
|
//
|
||||||
pub fn __state3<
|
pub fn __state3<
|
||||||
__ERROR,
|
__ERROR,
|
||||||
@ -269,13 +269,13 @@ mod __parse__Items {
|
|||||||
let __nt = super::__action1(__sym0, __sym1);
|
let __nt = super::__action1(__sym0, __sym1);
|
||||||
return Ok((__lookbehind, __lookahead, __Nonterminal::Items(__nt)));
|
return Ok((__lookbehind, __lookahead, __Nonterminal::Items(__nt)));
|
||||||
}
|
}
|
||||||
None => {
|
Some((_, Tok::Minus(..), _)) => {
|
||||||
let __sym0 = __sym0.take().unwrap();
|
let __sym0 = __sym0.take().unwrap();
|
||||||
let __sym1 = __sym1.take().unwrap();
|
let __sym1 = __sym1.take().unwrap();
|
||||||
let __nt = super::__action1(__sym0, __sym1);
|
let __nt = super::__action1(__sym0, __sym1);
|
||||||
return Ok((__lookbehind, __lookahead, __Nonterminal::Items(__nt)));
|
return Ok((__lookbehind, __lookahead, __Nonterminal::Items(__nt)));
|
||||||
}
|
}
|
||||||
Some((_, Tok::Minus(..), _)) => {
|
None => {
|
||||||
let __sym0 = __sym0.take().unwrap();
|
let __sym0 = __sym0.take().unwrap();
|
||||||
let __sym1 = __sym1.take().unwrap();
|
let __sym1 = __sym1.take().unwrap();
|
||||||
let __nt = super::__action1(__sym0, __sym1);
|
let __nt = super::__action1(__sym0, __sym1);
|
||||||
@ -295,9 +295,9 @@ mod __parse__Items {
|
|||||||
// Items = Items "-" (*) ["+"]
|
// Items = Items "-" (*) ["+"]
|
||||||
// Items = Items "-" (*) ["-"]
|
// Items = Items "-" (*) ["-"]
|
||||||
//
|
//
|
||||||
// EOF -> Reduce(Items = Items, "-" => Call(ActionFn(3));)
|
|
||||||
// "-" -> Reduce(Items = Items, "-" => Call(ActionFn(3));)
|
|
||||||
// "+" -> Reduce(Items = Items, "-" => Call(ActionFn(3));)
|
// "+" -> Reduce(Items = Items, "-" => Call(ActionFn(3));)
|
||||||
|
// "-" -> Reduce(Items = Items, "-" => Call(ActionFn(3));)
|
||||||
|
// EOF -> Reduce(Items = Items, "-" => Call(ActionFn(3));)
|
||||||
//
|
//
|
||||||
pub fn __state4<
|
pub fn __state4<
|
||||||
__ERROR,
|
__ERROR,
|
||||||
@ -312,7 +312,7 @@ mod __parse__Items {
|
|||||||
{
|
{
|
||||||
let mut __result: (Option<usize>, Option<(usize, Tok, usize)>, __Nonterminal<>);
|
let mut __result: (Option<usize>, Option<(usize, Tok, usize)>, __Nonterminal<>);
|
||||||
match __lookahead {
|
match __lookahead {
|
||||||
None => {
|
Some((_, Tok::Plus(..), _)) => {
|
||||||
let __sym0 = __sym0.take().unwrap();
|
let __sym0 = __sym0.take().unwrap();
|
||||||
let __sym1 = __sym1.take().unwrap();
|
let __sym1 = __sym1.take().unwrap();
|
||||||
let __nt = super::__action3(__sym0, __sym1);
|
let __nt = super::__action3(__sym0, __sym1);
|
||||||
@ -324,7 +324,7 @@ mod __parse__Items {
|
|||||||
let __nt = super::__action3(__sym0, __sym1);
|
let __nt = super::__action3(__sym0, __sym1);
|
||||||
return Ok((__lookbehind, __lookahead, __Nonterminal::Items(__nt)));
|
return Ok((__lookbehind, __lookahead, __Nonterminal::Items(__nt)));
|
||||||
}
|
}
|
||||||
Some((_, Tok::Plus(..), _)) => {
|
None => {
|
||||||
let __sym0 = __sym0.take().unwrap();
|
let __sym0 = __sym0.take().unwrap();
|
||||||
let __sym1 = __sym1.take().unwrap();
|
let __sym1 = __sym1.take().unwrap();
|
||||||
let __nt = super::__action3(__sym0, __sym1);
|
let __nt = super::__action3(__sym0, __sym1);
|
||||||
@ -340,13 +340,62 @@ mod __parse__Items {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// State 5
|
// State 5
|
||||||
// Spanned<"+"> = @< (*) "+" @> [EOF]
|
// Items = Items Spanned<"+"> (*) [EOF]
|
||||||
// Spanned<"+"> = @< (*) "+" @> ["+"]
|
// Items = Items Spanned<"+"> (*) ["+"]
|
||||||
// Spanned<"+"> = @< (*) "+" @> ["-"]
|
// Items = Items Spanned<"+"> (*) ["-"]
|
||||||
|
//
|
||||||
|
// "-" -> Reduce(Items = Items, Spanned<"+"> => Call(ActionFn(2));)
|
||||||
|
// "+" -> Reduce(Items = Items, Spanned<"+"> => Call(ActionFn(2));)
|
||||||
|
// EOF -> Reduce(Items = Items, Spanned<"+"> => Call(ActionFn(2));)
|
||||||
|
//
|
||||||
|
pub fn __state5<
|
||||||
|
__ERROR,
|
||||||
|
__TOKENS: Iterator<Item=Result<(usize, Tok, usize),__ERROR>>,
|
||||||
|
>(
|
||||||
|
__lookbehind: Option<usize>,
|
||||||
|
__lookahead: Option<(usize, Tok, usize)>,
|
||||||
|
__tokens: &mut __TOKENS,
|
||||||
|
__sym0: &mut Option<Vec<(usize, usize)>>,
|
||||||
|
__sym1: &mut Option<(usize, usize)>,
|
||||||
|
) -> Result<(Option<usize>, Option<(usize, Tok, usize)>, __Nonterminal<>), __ParseError<usize,Tok,__ERROR>>
|
||||||
|
{
|
||||||
|
let mut __result: (Option<usize>, Option<(usize, Tok, usize)>, __Nonterminal<>);
|
||||||
|
match __lookahead {
|
||||||
|
Some((_, Tok::Minus(..), _)) => {
|
||||||
|
let __sym0 = __sym0.take().unwrap();
|
||||||
|
let __sym1 = __sym1.take().unwrap();
|
||||||
|
let __nt = super::__action2(__sym0, __sym1);
|
||||||
|
return Ok((__lookbehind, __lookahead, __Nonterminal::Items(__nt)));
|
||||||
|
}
|
||||||
|
Some((_, Tok::Plus(..), _)) => {
|
||||||
|
let __sym0 = __sym0.take().unwrap();
|
||||||
|
let __sym1 = __sym1.take().unwrap();
|
||||||
|
let __nt = super::__action2(__sym0, __sym1);
|
||||||
|
return Ok((__lookbehind, __lookahead, __Nonterminal::Items(__nt)));
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
let __sym0 = __sym0.take().unwrap();
|
||||||
|
let __sym1 = __sym1.take().unwrap();
|
||||||
|
let __nt = super::__action2(__sym0, __sym1);
|
||||||
|
return Ok((__lookbehind, __lookahead, __Nonterminal::Items(__nt)));
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
return Err(__ParseError::UnrecognizedToken {
|
||||||
|
token: __lookahead,
|
||||||
|
expected: vec![],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// State 6
|
||||||
|
// Spanned<"+"> = @L (*) "+" @R [EOF]
|
||||||
|
// Spanned<"+"> = @L (*) "+" @R ["+"]
|
||||||
|
// Spanned<"+"> = @L (*) "+" @R ["-"]
|
||||||
//
|
//
|
||||||
// "+" -> Shift(S7)
|
// "+" -> Shift(S7)
|
||||||
//
|
//
|
||||||
pub fn __state5<
|
pub fn __state6<
|
||||||
__ERROR,
|
__ERROR,
|
||||||
__TOKENS: Iterator<Item=Result<(usize, Tok, usize),__ERROR>>,
|
__TOKENS: Iterator<Item=Result<(usize, Tok, usize),__ERROR>>,
|
||||||
>(
|
>(
|
||||||
@ -374,68 +423,19 @@ mod __parse__Items {
|
|||||||
return Ok(__result);
|
return Ok(__result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State 6
|
|
||||||
// Items = Items Spanned<"+"> (*) [EOF]
|
|
||||||
// Items = Items Spanned<"+"> (*) ["+"]
|
|
||||||
// Items = Items Spanned<"+"> (*) ["-"]
|
|
||||||
//
|
|
||||||
// "+" -> Reduce(Items = Items, Spanned<"+"> => Call(ActionFn(2));)
|
|
||||||
// "-" -> Reduce(Items = Items, Spanned<"+"> => Call(ActionFn(2));)
|
|
||||||
// EOF -> Reduce(Items = Items, Spanned<"+"> => Call(ActionFn(2));)
|
|
||||||
//
|
|
||||||
pub fn __state6<
|
|
||||||
__ERROR,
|
|
||||||
__TOKENS: Iterator<Item=Result<(usize, Tok, usize),__ERROR>>,
|
|
||||||
>(
|
|
||||||
__lookbehind: Option<usize>,
|
|
||||||
__lookahead: Option<(usize, Tok, usize)>,
|
|
||||||
__tokens: &mut __TOKENS,
|
|
||||||
__sym0: &mut Option<Vec<(usize, usize)>>,
|
|
||||||
__sym1: &mut Option<(usize, usize)>,
|
|
||||||
) -> Result<(Option<usize>, Option<(usize, Tok, usize)>, __Nonterminal<>), __ParseError<usize,Tok,__ERROR>>
|
|
||||||
{
|
|
||||||
let mut __result: (Option<usize>, Option<(usize, Tok, usize)>, __Nonterminal<>);
|
|
||||||
match __lookahead {
|
|
||||||
Some((_, Tok::Plus(..), _)) => {
|
|
||||||
let __sym0 = __sym0.take().unwrap();
|
|
||||||
let __sym1 = __sym1.take().unwrap();
|
|
||||||
let __nt = super::__action2(__sym0, __sym1);
|
|
||||||
return Ok((__lookbehind, __lookahead, __Nonterminal::Items(__nt)));
|
|
||||||
}
|
|
||||||
Some((_, Tok::Minus(..), _)) => {
|
|
||||||
let __sym0 = __sym0.take().unwrap();
|
|
||||||
let __sym1 = __sym1.take().unwrap();
|
|
||||||
let __nt = super::__action2(__sym0, __sym1);
|
|
||||||
return Ok((__lookbehind, __lookahead, __Nonterminal::Items(__nt)));
|
|
||||||
}
|
|
||||||
None => {
|
|
||||||
let __sym0 = __sym0.take().unwrap();
|
|
||||||
let __sym1 = __sym1.take().unwrap();
|
|
||||||
let __nt = super::__action2(__sym0, __sym1);
|
|
||||||
return Ok((__lookbehind, __lookahead, __Nonterminal::Items(__nt)));
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
return Err(__ParseError::UnrecognizedToken {
|
|
||||||
token: __lookahead,
|
|
||||||
expected: vec![],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// State 7
|
// State 7
|
||||||
// @> = (*) [EOF]
|
// @R = (*) [EOF]
|
||||||
// @> = (*) ["+"]
|
// @R = (*) ["+"]
|
||||||
// @> = (*) ["-"]
|
// @R = (*) ["-"]
|
||||||
// Spanned<"+"> = @< "+" (*) @> [EOF]
|
// Spanned<"+"> = @L "+" (*) @R [EOF]
|
||||||
// Spanned<"+"> = @< "+" (*) @> ["+"]
|
// Spanned<"+"> = @L "+" (*) @R ["+"]
|
||||||
// Spanned<"+"> = @< "+" (*) @> ["-"]
|
// Spanned<"+"> = @L "+" (*) @R ["-"]
|
||||||
//
|
//
|
||||||
// "+" -> Reduce(@> = => Lookbehind;)
|
// "-" -> Reduce(@R = => Lookbehind;)
|
||||||
// "-" -> Reduce(@> = => Lookbehind;)
|
// "+" -> Reduce(@R = => Lookbehind;)
|
||||||
// EOF -> Reduce(@> = => Lookbehind;)
|
// EOF -> Reduce(@R = => Lookbehind;)
|
||||||
//
|
//
|
||||||
// @> -> S8
|
// @R -> S8
|
||||||
pub fn __state7<
|
pub fn __state7<
|
||||||
__ERROR,
|
__ERROR,
|
||||||
__TOKENS: Iterator<Item=Result<(usize, Tok, usize),__ERROR>>,
|
__TOKENS: Iterator<Item=Result<(usize, Tok, usize),__ERROR>>,
|
||||||
@ -449,17 +449,17 @@ mod __parse__Items {
|
|||||||
{
|
{
|
||||||
let mut __result: (Option<usize>, Option<(usize, Tok, usize)>, __Nonterminal<>);
|
let mut __result: (Option<usize>, Option<(usize, Tok, usize)>, __Nonterminal<>);
|
||||||
match __lookahead {
|
match __lookahead {
|
||||||
Some((_, Tok::Plus(..), _)) => {
|
|
||||||
let __nt = ::std::clone::Clone::clone(&__lookbehind).unwrap_or_default();
|
|
||||||
__result = (__lookbehind, __lookahead, __Nonterminal::_40_3e(__nt));
|
|
||||||
}
|
|
||||||
Some((_, Tok::Minus(..), _)) => {
|
Some((_, Tok::Minus(..), _)) => {
|
||||||
let __nt = ::std::clone::Clone::clone(&__lookbehind).unwrap_or_default();
|
let __nt = ::std::clone::Clone::clone(&__lookbehind).unwrap_or_default();
|
||||||
__result = (__lookbehind, __lookahead, __Nonterminal::_40_3e(__nt));
|
__result = (__lookbehind, __lookahead, __Nonterminal::_40R(__nt));
|
||||||
|
}
|
||||||
|
Some((_, Tok::Plus(..), _)) => {
|
||||||
|
let __nt = ::std::clone::Clone::clone(&__lookbehind).unwrap_or_default();
|
||||||
|
__result = (__lookbehind, __lookahead, __Nonterminal::_40R(__nt));
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
let __nt = ::std::clone::Clone::clone(&__lookbehind).unwrap_or_default();
|
let __nt = ::std::clone::Clone::clone(&__lookbehind).unwrap_or_default();
|
||||||
__result = (__lookbehind, __lookahead, __Nonterminal::_40_3e(__nt));
|
__result = (__lookbehind, __lookahead, __Nonterminal::_40R(__nt));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Err(__ParseError::UnrecognizedToken {
|
return Err(__ParseError::UnrecognizedToken {
|
||||||
@ -471,7 +471,7 @@ mod __parse__Items {
|
|||||||
while __sym1.is_some() {
|
while __sym1.is_some() {
|
||||||
let (__lookbehind, __lookahead, __nt) = __result;
|
let (__lookbehind, __lookahead, __nt) = __result;
|
||||||
match __nt {
|
match __nt {
|
||||||
__Nonterminal::_40_3e(__nt) => {
|
__Nonterminal::_40R(__nt) => {
|
||||||
let __sym2 = &mut Some(__nt);
|
let __sym2 = &mut Some(__nt);
|
||||||
__result = try!(__state8(__lookbehind, __lookahead, __tokens, __sym0, __sym1, __sym2));
|
__result = try!(__state8(__lookbehind, __lookahead, __tokens, __sym0, __sym1, __sym2));
|
||||||
}
|
}
|
||||||
@ -484,13 +484,13 @@ mod __parse__Items {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// State 8
|
// State 8
|
||||||
// Spanned<"+"> = @< "+" @> (*) [EOF]
|
// Spanned<"+"> = @L "+" @R (*) [EOF]
|
||||||
// Spanned<"+"> = @< "+" @> (*) ["+"]
|
// Spanned<"+"> = @L "+" @R (*) ["+"]
|
||||||
// Spanned<"+"> = @< "+" @> (*) ["-"]
|
// Spanned<"+"> = @L "+" @R (*) ["-"]
|
||||||
//
|
//
|
||||||
// EOF -> Reduce(Spanned<"+"> = @<, "+", @> => Call(ActionFn(4));)
|
// "-" -> Reduce(Spanned<"+"> = @L, "+", @R => Call(ActionFn(4));)
|
||||||
// "+" -> Reduce(Spanned<"+"> = @<, "+", @> => Call(ActionFn(4));)
|
// "+" -> Reduce(Spanned<"+"> = @L, "+", @R => Call(ActionFn(4));)
|
||||||
// "-" -> Reduce(Spanned<"+"> = @<, "+", @> => Call(ActionFn(4));)
|
// EOF -> Reduce(Spanned<"+"> = @L, "+", @R => Call(ActionFn(4));)
|
||||||
//
|
//
|
||||||
pub fn __state8<
|
pub fn __state8<
|
||||||
__ERROR,
|
__ERROR,
|
||||||
@ -506,7 +506,7 @@ mod __parse__Items {
|
|||||||
{
|
{
|
||||||
let mut __result: (Option<usize>, Option<(usize, Tok, usize)>, __Nonterminal<>);
|
let mut __result: (Option<usize>, Option<(usize, Tok, usize)>, __Nonterminal<>);
|
||||||
match __lookahead {
|
match __lookahead {
|
||||||
None => {
|
Some((_, Tok::Minus(..), _)) => {
|
||||||
let __sym0 = __sym0.take().unwrap();
|
let __sym0 = __sym0.take().unwrap();
|
||||||
let __sym1 = __sym1.take().unwrap();
|
let __sym1 = __sym1.take().unwrap();
|
||||||
let __sym2 = __sym2.take().unwrap();
|
let __sym2 = __sym2.take().unwrap();
|
||||||
@ -520,7 +520,7 @@ mod __parse__Items {
|
|||||||
let __nt = super::__action4(__sym0, __sym1, __sym2);
|
let __nt = super::__action4(__sym0, __sym1, __sym2);
|
||||||
return Ok((__lookbehind, __lookahead, __Nonterminal::Spanned_3c_22_2b_22_3e(__nt)));
|
return Ok((__lookbehind, __lookahead, __Nonterminal::Spanned_3c_22_2b_22_3e(__nt)));
|
||||||
}
|
}
|
||||||
Some((_, Tok::Minus(..), _)) => {
|
None => {
|
||||||
let __sym0 = __sym0.take().unwrap();
|
let __sym0 = __sym0.take().unwrap();
|
||||||
let __sym1 = __sym1.take().unwrap();
|
let __sym1 = __sym1.take().unwrap();
|
||||||
let __sym2 = __sym2.take().unwrap();
|
let __sym2 = __sym2.take().unwrap();
|
||||||
|
@ -111,7 +111,7 @@ fn loc_test2() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn loc_empty() {
|
fn loc_empty() {
|
||||||
// test what happens when `@<` and `@>` are invoked on an empty input
|
// test what happens when `@L` and `@R` are invoked on an empty input
|
||||||
util::test_loc(|v| loc::parse_Items(v), "", vec![(0, 0)]);
|
util::test_loc(|v| loc::parse_Items(v), "", vec![(0, 0)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,10 +34,10 @@ mod __parse__S {
|
|||||||
use super::__ToTriple;
|
use super::__ToTriple;
|
||||||
|
|
||||||
pub enum __Nonterminal<> {
|
pub enum __Nonterminal<> {
|
||||||
S(i32),
|
|
||||||
____S(i32),
|
|
||||||
T(i32),
|
T(i32),
|
||||||
|
S(i32),
|
||||||
E(i32),
|
E(i32),
|
||||||
|
____S(i32),
|
||||||
}
|
}
|
||||||
|
|
||||||
// State 0
|
// State 0
|
||||||
@ -52,12 +52,12 @@ mod __parse__S {
|
|||||||
// T = (*) "Num" ["-"]
|
// T = (*) "Num" ["-"]
|
||||||
// __S = (*) S [EOF]
|
// __S = (*) S [EOF]
|
||||||
//
|
//
|
||||||
// "Num" -> Shift(S5)
|
// "(" -> Shift(S3)
|
||||||
// "(" -> Shift(S4)
|
// "Num" -> Shift(S1)
|
||||||
//
|
//
|
||||||
// T -> S1
|
// S -> S5
|
||||||
// S -> S2
|
// E -> S2
|
||||||
// E -> S3
|
// T -> S4
|
||||||
pub fn __state0<
|
pub fn __state0<
|
||||||
__ERROR,
|
__ERROR,
|
||||||
__TOKENS: Iterator<Item=Result<((), Tok, ()),__ERROR>>,
|
__TOKENS: Iterator<Item=Result<((), Tok, ()),__ERROR>>,
|
||||||
@ -69,17 +69,17 @@ mod __parse__S {
|
|||||||
{
|
{
|
||||||
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
||||||
match __lookahead {
|
match __lookahead {
|
||||||
Some((_, Tok::Num(__tok0), __loc)) => {
|
|
||||||
let mut __lookbehind = Some(__loc);
|
|
||||||
let mut __sym0 = &mut Some((__tok0));
|
|
||||||
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
|
||||||
__result = try!(__state5(__lookbehind, __lookahead, __tokens, __sym0));
|
|
||||||
}
|
|
||||||
Some((_, __tok @ Tok::LParen(..), __loc)) => {
|
Some((_, __tok @ Tok::LParen(..), __loc)) => {
|
||||||
let mut __lookbehind = Some(__loc);
|
let mut __lookbehind = Some(__loc);
|
||||||
let mut __sym0 = &mut Some((__tok));
|
let mut __sym0 = &mut Some((__tok));
|
||||||
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
||||||
__result = try!(__state4(__lookbehind, __lookahead, __tokens, __sym0));
|
__result = try!(__state3(__lookbehind, __lookahead, __tokens, __sym0));
|
||||||
|
}
|
||||||
|
Some((_, Tok::Num(__tok0), __loc)) => {
|
||||||
|
let mut __lookbehind = Some(__loc);
|
||||||
|
let mut __sym0 = &mut Some((__tok0));
|
||||||
|
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
||||||
|
__result = try!(__state1(__lookbehind, __lookahead, __tokens, __sym0));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Err(__ParseError::UnrecognizedToken {
|
return Err(__ParseError::UnrecognizedToken {
|
||||||
@ -91,17 +91,17 @@ mod __parse__S {
|
|||||||
loop {
|
loop {
|
||||||
let (__lookbehind, __lookahead, __nt) = __result;
|
let (__lookbehind, __lookahead, __nt) = __result;
|
||||||
match __nt {
|
match __nt {
|
||||||
__Nonterminal::T(__nt) => {
|
|
||||||
let __sym0 = &mut Some(__nt);
|
|
||||||
__result = try!(__state1(__lookbehind, __lookahead, __tokens, __sym0));
|
|
||||||
}
|
|
||||||
__Nonterminal::S(__nt) => {
|
__Nonterminal::S(__nt) => {
|
||||||
let __sym0 = &mut Some(__nt);
|
let __sym0 = &mut Some(__nt);
|
||||||
__result = try!(__state2(__lookbehind, __lookahead, __tokens, __sym0));
|
__result = try!(__state5(__lookbehind, __lookahead, __tokens, __sym0));
|
||||||
}
|
}
|
||||||
__Nonterminal::E(__nt) => {
|
__Nonterminal::E(__nt) => {
|
||||||
let __sym0 = &mut Some(__nt);
|
let __sym0 = &mut Some(__nt);
|
||||||
__result = try!(__state3(__lookbehind, __lookahead, __tokens, __sym0));
|
__result = try!(__state2(__lookbehind, __lookahead, __tokens, __sym0));
|
||||||
|
}
|
||||||
|
__Nonterminal::T(__nt) => {
|
||||||
|
let __sym0 = &mut Some(__nt);
|
||||||
|
__result = try!(__state4(__lookbehind, __lookahead, __tokens, __sym0));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Ok((__lookbehind, __lookahead, __nt));
|
return Ok((__lookbehind, __lookahead, __nt));
|
||||||
@ -111,11 +111,11 @@ mod __parse__S {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// State 1
|
// State 1
|
||||||
// E = T (*) [EOF]
|
// T = "Num" (*) [EOF]
|
||||||
// E = T (*) ["-"]
|
// T = "Num" (*) ["-"]
|
||||||
//
|
//
|
||||||
// "-" -> Reduce(E = T => Call(ActionFn(3));)
|
// EOF -> Reduce(T = "Num" => Call(ActionFn(4));)
|
||||||
// EOF -> Reduce(E = T => Call(ActionFn(3));)
|
// "-" -> Reduce(T = "Num" => Call(ActionFn(4));)
|
||||||
//
|
//
|
||||||
pub fn __state1<
|
pub fn __state1<
|
||||||
__ERROR,
|
__ERROR,
|
||||||
@ -129,15 +129,15 @@ mod __parse__S {
|
|||||||
{
|
{
|
||||||
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
||||||
match __lookahead {
|
match __lookahead {
|
||||||
Some((_, Tok::Minus(..), _)) => {
|
|
||||||
let __sym0 = __sym0.take().unwrap();
|
|
||||||
let __nt = super::__action3(__sym0);
|
|
||||||
return Ok((__lookbehind, __lookahead, __Nonterminal::E(__nt)));
|
|
||||||
}
|
|
||||||
None => {
|
None => {
|
||||||
let __sym0 = __sym0.take().unwrap();
|
let __sym0 = __sym0.take().unwrap();
|
||||||
let __nt = super::__action3(__sym0);
|
let __nt = super::__action4(__sym0);
|
||||||
return Ok((__lookbehind, __lookahead, __Nonterminal::E(__nt)));
|
return Ok((__lookbehind, __lookahead, __Nonterminal::T(__nt)));
|
||||||
|
}
|
||||||
|
Some((_, Tok::Minus(..), _)) => {
|
||||||
|
let __sym0 = __sym0.take().unwrap();
|
||||||
|
let __nt = super::__action4(__sym0);
|
||||||
|
return Ok((__lookbehind, __lookahead, __Nonterminal::T(__nt)));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Err(__ParseError::UnrecognizedToken {
|
return Err(__ParseError::UnrecognizedToken {
|
||||||
@ -149,37 +149,6 @@ mod __parse__S {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// State 2
|
// State 2
|
||||||
// __S = S (*) [EOF]
|
|
||||||
//
|
|
||||||
// EOF -> Reduce(__S = S => Call(ActionFn(0));)
|
|
||||||
//
|
|
||||||
pub fn __state2<
|
|
||||||
__ERROR,
|
|
||||||
__TOKENS: Iterator<Item=Result<((), Tok, ()),__ERROR>>,
|
|
||||||
>(
|
|
||||||
__lookbehind: Option<()>,
|
|
||||||
__lookahead: Option<((), Tok, ())>,
|
|
||||||
__tokens: &mut __TOKENS,
|
|
||||||
__sym0: &mut Option<i32>,
|
|
||||||
) -> Result<(Option<()>, Option<((), Tok, ())>, __Nonterminal<>), __ParseError<(),Tok,__ERROR>>
|
|
||||||
{
|
|
||||||
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
|
||||||
match __lookahead {
|
|
||||||
None => {
|
|
||||||
let __sym0 = __sym0.take().unwrap();
|
|
||||||
let __nt = super::__action0(__sym0);
|
|
||||||
return Ok((__lookbehind, __lookahead, __Nonterminal::____S(__nt)));
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
return Err(__ParseError::UnrecognizedToken {
|
|
||||||
token: __lookahead,
|
|
||||||
expected: vec![],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// State 3
|
|
||||||
// E = E (*) "-" T [EOF]
|
// E = E (*) "-" T [EOF]
|
||||||
// E = E (*) "-" T ["-"]
|
// E = E (*) "-" T ["-"]
|
||||||
// S = E (*) [EOF]
|
// S = E (*) [EOF]
|
||||||
@ -187,7 +156,7 @@ mod __parse__S {
|
|||||||
// "-" -> Shift(S6)
|
// "-" -> Shift(S6)
|
||||||
// EOF -> Reduce(S = E => Call(ActionFn(1));)
|
// EOF -> Reduce(S = E => Call(ActionFn(1));)
|
||||||
//
|
//
|
||||||
pub fn __state3<
|
pub fn __state2<
|
||||||
__ERROR,
|
__ERROR,
|
||||||
__TOKENS: Iterator<Item=Result<((), Tok, ()),__ERROR>>,
|
__TOKENS: Iterator<Item=Result<((), Tok, ()),__ERROR>>,
|
||||||
>(
|
>(
|
||||||
@ -220,7 +189,7 @@ mod __parse__S {
|
|||||||
return Ok(__result);
|
return Ok(__result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State 4
|
// State 3
|
||||||
// E = (*) E "-" T [")"]
|
// E = (*) E "-" T [")"]
|
||||||
// E = (*) E "-" T ["-"]
|
// E = (*) E "-" T ["-"]
|
||||||
// E = (*) T [")"]
|
// E = (*) T [")"]
|
||||||
@ -232,12 +201,12 @@ mod __parse__S {
|
|||||||
// T = (*) "Num" [")"]
|
// T = (*) "Num" [")"]
|
||||||
// T = (*) "Num" ["-"]
|
// T = (*) "Num" ["-"]
|
||||||
//
|
//
|
||||||
// "Num" -> Shift(S10)
|
// "(" -> Shift(S8)
|
||||||
// "(" -> Shift(S7)
|
// "Num" -> Shift(S7)
|
||||||
//
|
//
|
||||||
// T -> S8
|
// T -> S10
|
||||||
// E -> S9
|
// E -> S9
|
||||||
pub fn __state4<
|
pub fn __state3<
|
||||||
__ERROR,
|
__ERROR,
|
||||||
__TOKENS: Iterator<Item=Result<((), Tok, ()),__ERROR>>,
|
__TOKENS: Iterator<Item=Result<((), Tok, ()),__ERROR>>,
|
||||||
>(
|
>(
|
||||||
@ -249,16 +218,16 @@ mod __parse__S {
|
|||||||
{
|
{
|
||||||
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
||||||
match __lookahead {
|
match __lookahead {
|
||||||
Some((_, Tok::Num(__tok0), __loc)) => {
|
|
||||||
let mut __lookbehind = Some(__loc);
|
|
||||||
let mut __sym1 = &mut Some((__tok0));
|
|
||||||
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
|
||||||
__result = try!(__state10(__lookbehind, __lookahead, __tokens, __sym1));
|
|
||||||
}
|
|
||||||
Some((_, __tok @ Tok::LParen(..), __loc)) => {
|
Some((_, __tok @ Tok::LParen(..), __loc)) => {
|
||||||
let mut __lookbehind = Some(__loc);
|
let mut __lookbehind = Some(__loc);
|
||||||
let mut __sym1 = &mut Some((__tok));
|
let mut __sym1 = &mut Some((__tok));
|
||||||
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
||||||
|
__result = try!(__state8(__lookbehind, __lookahead, __tokens, __sym1));
|
||||||
|
}
|
||||||
|
Some((_, Tok::Num(__tok0), __loc)) => {
|
||||||
|
let mut __lookbehind = Some(__loc);
|
||||||
|
let mut __sym1 = &mut Some((__tok0));
|
||||||
|
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
||||||
__result = try!(__state7(__lookbehind, __lookahead, __tokens, __sym1));
|
__result = try!(__state7(__lookbehind, __lookahead, __tokens, __sym1));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
@ -273,7 +242,7 @@ mod __parse__S {
|
|||||||
match __nt {
|
match __nt {
|
||||||
__Nonterminal::T(__nt) => {
|
__Nonterminal::T(__nt) => {
|
||||||
let __sym1 = &mut Some(__nt);
|
let __sym1 = &mut Some(__nt);
|
||||||
__result = try!(__state8(__lookbehind, __lookahead, __tokens, __sym1));
|
__result = try!(__state10(__lookbehind, __lookahead, __tokens, __sym1));
|
||||||
}
|
}
|
||||||
__Nonterminal::E(__nt) => {
|
__Nonterminal::E(__nt) => {
|
||||||
let __sym1 = &mut Some(__nt);
|
let __sym1 = &mut Some(__nt);
|
||||||
@ -287,12 +256,48 @@ mod __parse__S {
|
|||||||
return Ok(__result);
|
return Ok(__result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State 5
|
// State 4
|
||||||
// T = "Num" (*) [EOF]
|
// E = T (*) [EOF]
|
||||||
// T = "Num" (*) ["-"]
|
// E = T (*) ["-"]
|
||||||
//
|
//
|
||||||
// EOF -> Reduce(T = "Num" => Call(ActionFn(4));)
|
// EOF -> Reduce(E = T => Call(ActionFn(3));)
|
||||||
// "-" -> Reduce(T = "Num" => Call(ActionFn(4));)
|
// "-" -> Reduce(E = T => Call(ActionFn(3));)
|
||||||
|
//
|
||||||
|
pub fn __state4<
|
||||||
|
__ERROR,
|
||||||
|
__TOKENS: Iterator<Item=Result<((), Tok, ()),__ERROR>>,
|
||||||
|
>(
|
||||||
|
__lookbehind: Option<()>,
|
||||||
|
__lookahead: Option<((), Tok, ())>,
|
||||||
|
__tokens: &mut __TOKENS,
|
||||||
|
__sym0: &mut Option<i32>,
|
||||||
|
) -> Result<(Option<()>, Option<((), Tok, ())>, __Nonterminal<>), __ParseError<(),Tok,__ERROR>>
|
||||||
|
{
|
||||||
|
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
||||||
|
match __lookahead {
|
||||||
|
None => {
|
||||||
|
let __sym0 = __sym0.take().unwrap();
|
||||||
|
let __nt = super::__action3(__sym0);
|
||||||
|
return Ok((__lookbehind, __lookahead, __Nonterminal::E(__nt)));
|
||||||
|
}
|
||||||
|
Some((_, Tok::Minus(..), _)) => {
|
||||||
|
let __sym0 = __sym0.take().unwrap();
|
||||||
|
let __nt = super::__action3(__sym0);
|
||||||
|
return Ok((__lookbehind, __lookahead, __Nonterminal::E(__nt)));
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
return Err(__ParseError::UnrecognizedToken {
|
||||||
|
token: __lookahead,
|
||||||
|
expected: vec![],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// State 5
|
||||||
|
// __S = S (*) [EOF]
|
||||||
|
//
|
||||||
|
// EOF -> Reduce(__S = S => Call(ActionFn(0));)
|
||||||
//
|
//
|
||||||
pub fn __state5<
|
pub fn __state5<
|
||||||
__ERROR,
|
__ERROR,
|
||||||
@ -308,13 +313,8 @@ mod __parse__S {
|
|||||||
match __lookahead {
|
match __lookahead {
|
||||||
None => {
|
None => {
|
||||||
let __sym0 = __sym0.take().unwrap();
|
let __sym0 = __sym0.take().unwrap();
|
||||||
let __nt = super::__action4(__sym0);
|
let __nt = super::__action0(__sym0);
|
||||||
return Ok((__lookbehind, __lookahead, __Nonterminal::T(__nt)));
|
return Ok((__lookbehind, __lookahead, __Nonterminal::____S(__nt)));
|
||||||
}
|
|
||||||
Some((_, Tok::Minus(..), _)) => {
|
|
||||||
let __sym0 = __sym0.take().unwrap();
|
|
||||||
let __nt = super::__action4(__sym0);
|
|
||||||
return Ok((__lookbehind, __lookahead, __Nonterminal::T(__nt)));
|
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Err(__ParseError::UnrecognizedToken {
|
return Err(__ParseError::UnrecognizedToken {
|
||||||
@ -333,8 +333,8 @@ mod __parse__S {
|
|||||||
// T = (*) "Num" [EOF]
|
// T = (*) "Num" [EOF]
|
||||||
// T = (*) "Num" ["-"]
|
// T = (*) "Num" ["-"]
|
||||||
//
|
//
|
||||||
// "Num" -> Shift(S5)
|
// "(" -> Shift(S3)
|
||||||
// "(" -> Shift(S4)
|
// "Num" -> Shift(S1)
|
||||||
//
|
//
|
||||||
// T -> S11
|
// T -> S11
|
||||||
pub fn __state6<
|
pub fn __state6<
|
||||||
@ -350,17 +350,17 @@ mod __parse__S {
|
|||||||
{
|
{
|
||||||
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
||||||
match __lookahead {
|
match __lookahead {
|
||||||
Some((_, Tok::Num(__tok0), __loc)) => {
|
|
||||||
let mut __lookbehind = Some(__loc);
|
|
||||||
let mut __sym2 = &mut Some((__tok0));
|
|
||||||
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
|
||||||
__result = try!(__state5(__lookbehind, __lookahead, __tokens, __sym2));
|
|
||||||
}
|
|
||||||
Some((_, __tok @ Tok::LParen(..), __loc)) => {
|
Some((_, __tok @ Tok::LParen(..), __loc)) => {
|
||||||
let mut __lookbehind = Some(__loc);
|
let mut __lookbehind = Some(__loc);
|
||||||
let mut __sym2 = &mut Some((__tok));
|
let mut __sym2 = &mut Some((__tok));
|
||||||
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
||||||
__result = try!(__state4(__lookbehind, __lookahead, __tokens, __sym2));
|
__result = try!(__state3(__lookbehind, __lookahead, __tokens, __sym2));
|
||||||
|
}
|
||||||
|
Some((_, Tok::Num(__tok0), __loc)) => {
|
||||||
|
let mut __lookbehind = Some(__loc);
|
||||||
|
let mut __sym2 = &mut Some((__tok0));
|
||||||
|
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
||||||
|
__result = try!(__state1(__lookbehind, __lookahead, __tokens, __sym2));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Err(__ParseError::UnrecognizedToken {
|
return Err(__ParseError::UnrecognizedToken {
|
||||||
@ -385,6 +385,44 @@ mod __parse__S {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// State 7
|
// State 7
|
||||||
|
// T = "Num" (*) [")"]
|
||||||
|
// T = "Num" (*) ["-"]
|
||||||
|
//
|
||||||
|
// "-" -> Reduce(T = "Num" => Call(ActionFn(4));)
|
||||||
|
// ")" -> Reduce(T = "Num" => Call(ActionFn(4));)
|
||||||
|
//
|
||||||
|
pub fn __state7<
|
||||||
|
__ERROR,
|
||||||
|
__TOKENS: Iterator<Item=Result<((), Tok, ()),__ERROR>>,
|
||||||
|
>(
|
||||||
|
__lookbehind: Option<()>,
|
||||||
|
__lookahead: Option<((), Tok, ())>,
|
||||||
|
__tokens: &mut __TOKENS,
|
||||||
|
__sym0: &mut Option<i32>,
|
||||||
|
) -> Result<(Option<()>, Option<((), Tok, ())>, __Nonterminal<>), __ParseError<(),Tok,__ERROR>>
|
||||||
|
{
|
||||||
|
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
||||||
|
match __lookahead {
|
||||||
|
Some((_, Tok::Minus(..), _)) => {
|
||||||
|
let __sym0 = __sym0.take().unwrap();
|
||||||
|
let __nt = super::__action4(__sym0);
|
||||||
|
return Ok((__lookbehind, __lookahead, __Nonterminal::T(__nt)));
|
||||||
|
}
|
||||||
|
Some((_, Tok::RParen(..), _)) => {
|
||||||
|
let __sym0 = __sym0.take().unwrap();
|
||||||
|
let __nt = super::__action4(__sym0);
|
||||||
|
return Ok((__lookbehind, __lookahead, __Nonterminal::T(__nt)));
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
return Err(__ParseError::UnrecognizedToken {
|
||||||
|
token: __lookahead,
|
||||||
|
expected: vec![],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// State 8
|
||||||
// E = (*) E "-" T [")"]
|
// E = (*) E "-" T [")"]
|
||||||
// E = (*) E "-" T ["-"]
|
// E = (*) E "-" T ["-"]
|
||||||
// E = (*) T [")"]
|
// E = (*) T [")"]
|
||||||
@ -396,12 +434,12 @@ mod __parse__S {
|
|||||||
// T = (*) "Num" [")"]
|
// T = (*) "Num" [")"]
|
||||||
// T = (*) "Num" ["-"]
|
// T = (*) "Num" ["-"]
|
||||||
//
|
//
|
||||||
// "(" -> Shift(S7)
|
// "(" -> Shift(S8)
|
||||||
// "Num" -> Shift(S10)
|
// "Num" -> Shift(S7)
|
||||||
//
|
//
|
||||||
// E -> S12
|
// E -> S12
|
||||||
// T -> S8
|
// T -> S10
|
||||||
pub fn __state7<
|
pub fn __state8<
|
||||||
__ERROR,
|
__ERROR,
|
||||||
__TOKENS: Iterator<Item=Result<((), Tok, ()),__ERROR>>,
|
__TOKENS: Iterator<Item=Result<((), Tok, ()),__ERROR>>,
|
||||||
>(
|
>(
|
||||||
@ -417,13 +455,13 @@ mod __parse__S {
|
|||||||
let mut __lookbehind = Some(__loc);
|
let mut __lookbehind = Some(__loc);
|
||||||
let mut __sym1 = &mut Some((__tok));
|
let mut __sym1 = &mut Some((__tok));
|
||||||
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
||||||
__result = try!(__state7(__lookbehind, __lookahead, __tokens, __sym1));
|
__result = try!(__state8(__lookbehind, __lookahead, __tokens, __sym1));
|
||||||
}
|
}
|
||||||
Some((_, Tok::Num(__tok0), __loc)) => {
|
Some((_, Tok::Num(__tok0), __loc)) => {
|
||||||
let mut __lookbehind = Some(__loc);
|
let mut __lookbehind = Some(__loc);
|
||||||
let mut __sym1 = &mut Some((__tok0));
|
let mut __sym1 = &mut Some((__tok0));
|
||||||
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
||||||
__result = try!(__state10(__lookbehind, __lookahead, __tokens, __sym1));
|
__result = try!(__state7(__lookbehind, __lookahead, __tokens, __sym1));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Err(__ParseError::UnrecognizedToken {
|
return Err(__ParseError::UnrecognizedToken {
|
||||||
@ -441,7 +479,7 @@ mod __parse__S {
|
|||||||
}
|
}
|
||||||
__Nonterminal::T(__nt) => {
|
__Nonterminal::T(__nt) => {
|
||||||
let __sym1 = &mut Some(__nt);
|
let __sym1 = &mut Some(__nt);
|
||||||
__result = try!(__state8(__lookbehind, __lookahead, __tokens, __sym1));
|
__result = try!(__state10(__lookbehind, __lookahead, __tokens, __sym1));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Ok((__lookbehind, __lookahead, __nt));
|
return Ok((__lookbehind, __lookahead, __nt));
|
||||||
@ -451,52 +489,14 @@ mod __parse__S {
|
|||||||
return Ok(__result);
|
return Ok(__result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State 8
|
|
||||||
// E = T (*) [")"]
|
|
||||||
// E = T (*) ["-"]
|
|
||||||
//
|
|
||||||
// "-" -> Reduce(E = T => Call(ActionFn(3));)
|
|
||||||
// ")" -> Reduce(E = T => Call(ActionFn(3));)
|
|
||||||
//
|
|
||||||
pub fn __state8<
|
|
||||||
__ERROR,
|
|
||||||
__TOKENS: Iterator<Item=Result<((), Tok, ()),__ERROR>>,
|
|
||||||
>(
|
|
||||||
__lookbehind: Option<()>,
|
|
||||||
__lookahead: Option<((), Tok, ())>,
|
|
||||||
__tokens: &mut __TOKENS,
|
|
||||||
__sym0: &mut Option<i32>,
|
|
||||||
) -> Result<(Option<()>, Option<((), Tok, ())>, __Nonterminal<>), __ParseError<(),Tok,__ERROR>>
|
|
||||||
{
|
|
||||||
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
|
||||||
match __lookahead {
|
|
||||||
Some((_, Tok::Minus(..), _)) => {
|
|
||||||
let __sym0 = __sym0.take().unwrap();
|
|
||||||
let __nt = super::__action3(__sym0);
|
|
||||||
return Ok((__lookbehind, __lookahead, __Nonterminal::E(__nt)));
|
|
||||||
}
|
|
||||||
Some((_, Tok::RParen(..), _)) => {
|
|
||||||
let __sym0 = __sym0.take().unwrap();
|
|
||||||
let __nt = super::__action3(__sym0);
|
|
||||||
return Ok((__lookbehind, __lookahead, __Nonterminal::E(__nt)));
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
return Err(__ParseError::UnrecognizedToken {
|
|
||||||
token: __lookahead,
|
|
||||||
expected: vec![],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// State 9
|
// State 9
|
||||||
// E = E (*) "-" T [")"]
|
// E = E (*) "-" T [")"]
|
||||||
// E = E (*) "-" T ["-"]
|
// E = E (*) "-" T ["-"]
|
||||||
// T = "(" E (*) ")" [EOF]
|
// T = "(" E (*) ")" [EOF]
|
||||||
// T = "(" E (*) ")" ["-"]
|
// T = "(" E (*) ")" ["-"]
|
||||||
//
|
//
|
||||||
// ")" -> Shift(S14)
|
|
||||||
// "-" -> Shift(S13)
|
// "-" -> Shift(S13)
|
||||||
|
// ")" -> Shift(S14)
|
||||||
//
|
//
|
||||||
pub fn __state9<
|
pub fn __state9<
|
||||||
__ERROR,
|
__ERROR,
|
||||||
@ -511,18 +511,18 @@ mod __parse__S {
|
|||||||
{
|
{
|
||||||
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
||||||
match __lookahead {
|
match __lookahead {
|
||||||
Some((_, __tok @ Tok::RParen(..), __loc)) => {
|
|
||||||
let mut __lookbehind = Some(__loc);
|
|
||||||
let mut __sym2 = &mut Some((__tok));
|
|
||||||
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
|
||||||
__result = try!(__state14(__lookbehind, __lookahead, __tokens, __sym0, __sym1, __sym2));
|
|
||||||
}
|
|
||||||
Some((_, __tok @ Tok::Minus(..), __loc)) => {
|
Some((_, __tok @ Tok::Minus(..), __loc)) => {
|
||||||
let mut __lookbehind = Some(__loc);
|
let mut __lookbehind = Some(__loc);
|
||||||
let mut __sym2 = &mut Some((__tok));
|
let mut __sym2 = &mut Some((__tok));
|
||||||
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
||||||
__result = try!(__state13(__lookbehind, __lookahead, __tokens, __sym1, __sym2));
|
__result = try!(__state13(__lookbehind, __lookahead, __tokens, __sym1, __sym2));
|
||||||
}
|
}
|
||||||
|
Some((_, __tok @ Tok::RParen(..), __loc)) => {
|
||||||
|
let mut __lookbehind = Some(__loc);
|
||||||
|
let mut __sym2 = &mut Some((__tok));
|
||||||
|
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
||||||
|
__result = try!(__state14(__lookbehind, __lookahead, __tokens, __sym0, __sym1, __sym2));
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Err(__ParseError::UnrecognizedToken {
|
return Err(__ParseError::UnrecognizedToken {
|
||||||
token: __lookahead,
|
token: __lookahead,
|
||||||
@ -534,11 +534,11 @@ mod __parse__S {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// State 10
|
// State 10
|
||||||
// T = "Num" (*) [")"]
|
// E = T (*) [")"]
|
||||||
// T = "Num" (*) ["-"]
|
// E = T (*) ["-"]
|
||||||
//
|
//
|
||||||
// "-" -> Reduce(T = "Num" => Call(ActionFn(4));)
|
// "-" -> Reduce(E = T => Call(ActionFn(3));)
|
||||||
// ")" -> Reduce(T = "Num" => Call(ActionFn(4));)
|
// ")" -> Reduce(E = T => Call(ActionFn(3));)
|
||||||
//
|
//
|
||||||
pub fn __state10<
|
pub fn __state10<
|
||||||
__ERROR,
|
__ERROR,
|
||||||
@ -554,13 +554,13 @@ mod __parse__S {
|
|||||||
match __lookahead {
|
match __lookahead {
|
||||||
Some((_, Tok::Minus(..), _)) => {
|
Some((_, Tok::Minus(..), _)) => {
|
||||||
let __sym0 = __sym0.take().unwrap();
|
let __sym0 = __sym0.take().unwrap();
|
||||||
let __nt = super::__action4(__sym0);
|
let __nt = super::__action3(__sym0);
|
||||||
return Ok((__lookbehind, __lookahead, __Nonterminal::T(__nt)));
|
return Ok((__lookbehind, __lookahead, __Nonterminal::E(__nt)));
|
||||||
}
|
}
|
||||||
Some((_, Tok::RParen(..), _)) => {
|
Some((_, Tok::RParen(..), _)) => {
|
||||||
let __sym0 = __sym0.take().unwrap();
|
let __sym0 = __sym0.take().unwrap();
|
||||||
let __nt = super::__action4(__sym0);
|
let __nt = super::__action3(__sym0);
|
||||||
return Ok((__lookbehind, __lookahead, __Nonterminal::T(__nt)));
|
return Ok((__lookbehind, __lookahead, __Nonterminal::E(__nt)));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Err(__ParseError::UnrecognizedToken {
|
return Err(__ParseError::UnrecognizedToken {
|
||||||
@ -575,8 +575,8 @@ mod __parse__S {
|
|||||||
// E = E "-" T (*) [EOF]
|
// E = E "-" T (*) [EOF]
|
||||||
// E = E "-" T (*) ["-"]
|
// E = E "-" T (*) ["-"]
|
||||||
//
|
//
|
||||||
// EOF -> Reduce(E = E, "-", T => Call(ActionFn(2));)
|
|
||||||
// "-" -> Reduce(E = E, "-", T => Call(ActionFn(2));)
|
// "-" -> Reduce(E = E, "-", T => Call(ActionFn(2));)
|
||||||
|
// EOF -> Reduce(E = E, "-", T => Call(ActionFn(2));)
|
||||||
//
|
//
|
||||||
pub fn __state11<
|
pub fn __state11<
|
||||||
__ERROR,
|
__ERROR,
|
||||||
@ -592,14 +592,14 @@ mod __parse__S {
|
|||||||
{
|
{
|
||||||
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
||||||
match __lookahead {
|
match __lookahead {
|
||||||
None => {
|
Some((_, Tok::Minus(..), _)) => {
|
||||||
let __sym0 = __sym0.take().unwrap();
|
let __sym0 = __sym0.take().unwrap();
|
||||||
let __sym1 = __sym1.take().unwrap();
|
let __sym1 = __sym1.take().unwrap();
|
||||||
let __sym2 = __sym2.take().unwrap();
|
let __sym2 = __sym2.take().unwrap();
|
||||||
let __nt = super::__action2(__sym0, __sym1, __sym2);
|
let __nt = super::__action2(__sym0, __sym1, __sym2);
|
||||||
return Ok((__lookbehind, __lookahead, __Nonterminal::E(__nt)));
|
return Ok((__lookbehind, __lookahead, __Nonterminal::E(__nt)));
|
||||||
}
|
}
|
||||||
Some((_, Tok::Minus(..), _)) => {
|
None => {
|
||||||
let __sym0 = __sym0.take().unwrap();
|
let __sym0 = __sym0.take().unwrap();
|
||||||
let __sym1 = __sym1.take().unwrap();
|
let __sym1 = __sym1.take().unwrap();
|
||||||
let __sym2 = __sym2.take().unwrap();
|
let __sym2 = __sym2.take().unwrap();
|
||||||
@ -667,8 +667,8 @@ mod __parse__S {
|
|||||||
// T = (*) "Num" [")"]
|
// T = (*) "Num" [")"]
|
||||||
// T = (*) "Num" ["-"]
|
// T = (*) "Num" ["-"]
|
||||||
//
|
//
|
||||||
// "(" -> Shift(S7)
|
// "Num" -> Shift(S7)
|
||||||
// "Num" -> Shift(S10)
|
// "(" -> Shift(S8)
|
||||||
//
|
//
|
||||||
// T -> S16
|
// T -> S16
|
||||||
pub fn __state13<
|
pub fn __state13<
|
||||||
@ -684,17 +684,17 @@ mod __parse__S {
|
|||||||
{
|
{
|
||||||
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
||||||
match __lookahead {
|
match __lookahead {
|
||||||
Some((_, __tok @ Tok::LParen(..), __loc)) => {
|
|
||||||
let mut __lookbehind = Some(__loc);
|
|
||||||
let mut __sym2 = &mut Some((__tok));
|
|
||||||
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
|
||||||
__result = try!(__state7(__lookbehind, __lookahead, __tokens, __sym2));
|
|
||||||
}
|
|
||||||
Some((_, Tok::Num(__tok0), __loc)) => {
|
Some((_, Tok::Num(__tok0), __loc)) => {
|
||||||
let mut __lookbehind = Some(__loc);
|
let mut __lookbehind = Some(__loc);
|
||||||
let mut __sym2 = &mut Some((__tok0));
|
let mut __sym2 = &mut Some((__tok0));
|
||||||
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
||||||
__result = try!(__state10(__lookbehind, __lookahead, __tokens, __sym2));
|
__result = try!(__state7(__lookbehind, __lookahead, __tokens, __sym2));
|
||||||
|
}
|
||||||
|
Some((_, __tok @ Tok::LParen(..), __loc)) => {
|
||||||
|
let mut __lookbehind = Some(__loc);
|
||||||
|
let mut __sym2 = &mut Some((__tok));
|
||||||
|
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
||||||
|
__result = try!(__state8(__lookbehind, __lookahead, __tokens, __sym2));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Err(__ParseError::UnrecognizedToken {
|
return Err(__ParseError::UnrecognizedToken {
|
||||||
|
@ -34,17 +34,17 @@ mod __parse__S {
|
|||||||
use super::__ToTriple;
|
use super::__ToTriple;
|
||||||
|
|
||||||
pub enum __Nonterminal<> {
|
pub enum __Nonterminal<> {
|
||||||
____S(i32),
|
|
||||||
S(i32),
|
S(i32),
|
||||||
|
____S(i32),
|
||||||
}
|
}
|
||||||
|
|
||||||
// State 0
|
// State 0
|
||||||
// S = (*) "(" ")" [EOF]
|
// S = (*) "(" ")" [EOF]
|
||||||
// __S = (*) S [EOF]
|
// __S = (*) S [EOF]
|
||||||
//
|
//
|
||||||
// "(" -> Shift(S1)
|
// "(" -> Shift(S2)
|
||||||
//
|
//
|
||||||
// S -> S2
|
// S -> S1
|
||||||
pub fn __state0<
|
pub fn __state0<
|
||||||
__ERROR,
|
__ERROR,
|
||||||
__TOKENS: Iterator<Item=Result<((), Tok, ()),__ERROR>>,
|
__TOKENS: Iterator<Item=Result<((), Tok, ()),__ERROR>>,
|
||||||
@ -60,7 +60,7 @@ mod __parse__S {
|
|||||||
let mut __lookbehind = Some(__loc);
|
let mut __lookbehind = Some(__loc);
|
||||||
let mut __sym0 = &mut Some((__tok));
|
let mut __sym0 = &mut Some((__tok));
|
||||||
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
let __lookahead = match __tokens.next() { Some(Ok(v)) => Some(v), None => None, Some(Err(e)) => return Err(__ParseError::User { error: e }) };
|
||||||
__result = try!(__state1(__lookbehind, __lookahead, __tokens, __sym0));
|
__result = try!(__state2(__lookbehind, __lookahead, __tokens, __sym0));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Err(__ParseError::UnrecognizedToken {
|
return Err(__ParseError::UnrecognizedToken {
|
||||||
@ -74,7 +74,7 @@ mod __parse__S {
|
|||||||
match __nt {
|
match __nt {
|
||||||
__Nonterminal::S(__nt) => {
|
__Nonterminal::S(__nt) => {
|
||||||
let __sym0 = &mut Some(__nt);
|
let __sym0 = &mut Some(__nt);
|
||||||
__result = try!(__state2(__lookbehind, __lookahead, __tokens, __sym0));
|
__result = try!(__state1(__lookbehind, __lookahead, __tokens, __sym0));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Ok((__lookbehind, __lookahead, __nt));
|
return Ok((__lookbehind, __lookahead, __nt));
|
||||||
@ -84,11 +84,42 @@ mod __parse__S {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// State 1
|
// State 1
|
||||||
|
// __S = S (*) [EOF]
|
||||||
|
//
|
||||||
|
// EOF -> Reduce(__S = S => Call(ActionFn(0));)
|
||||||
|
//
|
||||||
|
pub fn __state1<
|
||||||
|
__ERROR,
|
||||||
|
__TOKENS: Iterator<Item=Result<((), Tok, ()),__ERROR>>,
|
||||||
|
>(
|
||||||
|
__lookbehind: Option<()>,
|
||||||
|
__lookahead: Option<((), Tok, ())>,
|
||||||
|
__tokens: &mut __TOKENS,
|
||||||
|
__sym0: &mut Option<i32>,
|
||||||
|
) -> Result<(Option<()>, Option<((), Tok, ())>, __Nonterminal<>), __ParseError<(),Tok,__ERROR>>
|
||||||
|
{
|
||||||
|
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
||||||
|
match __lookahead {
|
||||||
|
None => {
|
||||||
|
let __sym0 = __sym0.take().unwrap();
|
||||||
|
let __nt = super::__action0(__sym0);
|
||||||
|
return Ok((__lookbehind, __lookahead, __Nonterminal::____S(__nt)));
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
return Err(__ParseError::UnrecognizedToken {
|
||||||
|
token: __lookahead,
|
||||||
|
expected: vec![],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// State 2
|
||||||
// S = "(" (*) ")" [EOF]
|
// S = "(" (*) ")" [EOF]
|
||||||
//
|
//
|
||||||
// ")" -> Shift(S3)
|
// ")" -> Shift(S3)
|
||||||
//
|
//
|
||||||
pub fn __state1<
|
pub fn __state2<
|
||||||
__ERROR,
|
__ERROR,
|
||||||
__TOKENS: Iterator<Item=Result<((), Tok, ()),__ERROR>>,
|
__TOKENS: Iterator<Item=Result<((), Tok, ()),__ERROR>>,
|
||||||
>(
|
>(
|
||||||
@ -116,37 +147,6 @@ mod __parse__S {
|
|||||||
return Ok(__result);
|
return Ok(__result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// State 2
|
|
||||||
// __S = S (*) [EOF]
|
|
||||||
//
|
|
||||||
// EOF -> Reduce(__S = S => Call(ActionFn(0));)
|
|
||||||
//
|
|
||||||
pub fn __state2<
|
|
||||||
__ERROR,
|
|
||||||
__TOKENS: Iterator<Item=Result<((), Tok, ()),__ERROR>>,
|
|
||||||
>(
|
|
||||||
__lookbehind: Option<()>,
|
|
||||||
__lookahead: Option<((), Tok, ())>,
|
|
||||||
__tokens: &mut __TOKENS,
|
|
||||||
__sym0: &mut Option<i32>,
|
|
||||||
) -> Result<(Option<()>, Option<((), Tok, ())>, __Nonterminal<>), __ParseError<(),Tok,__ERROR>>
|
|
||||||
{
|
|
||||||
let mut __result: (Option<()>, Option<((), Tok, ())>, __Nonterminal<>);
|
|
||||||
match __lookahead {
|
|
||||||
None => {
|
|
||||||
let __sym0 = __sym0.take().unwrap();
|
|
||||||
let __nt = super::__action0(__sym0);
|
|
||||||
return Ok((__lookbehind, __lookahead, __Nonterminal::____S(__nt)));
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
return Err(__ParseError::UnrecognizedToken {
|
|
||||||
token: __lookahead,
|
|
||||||
expected: vec![],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// State 3
|
// State 3
|
||||||
// S = "(" ")" (*) [EOF]
|
// S = "(" ")" (*) [EOF]
|
||||||
//
|
//
|
||||||
|
@ -190,10 +190,10 @@ pub enum SymbolKind {
|
|||||||
// x:X
|
// x:X
|
||||||
Name(InternedString, Box<Symbol>),
|
Name(InternedString, Box<Symbol>),
|
||||||
|
|
||||||
// @<
|
// @L
|
||||||
Lookahead,
|
Lookahead,
|
||||||
|
|
||||||
// @>
|
// @R
|
||||||
Lookbehind,
|
Lookbehind,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,9 +322,9 @@ impl Display for SymbolKind {
|
|||||||
SymbolKind::Name(n, ref s) =>
|
SymbolKind::Name(n, ref s) =>
|
||||||
write!(fmt, "{}:{}", n, s),
|
write!(fmt, "{}:{}", n, s),
|
||||||
SymbolKind::Lookahead =>
|
SymbolKind::Lookahead =>
|
||||||
write!(fmt, "@<"),
|
write!(fmt, "@L"),
|
||||||
SymbolKind::Lookbehind =>
|
SymbolKind::Lookbehind =>
|
||||||
write!(fmt, "@>"),
|
write!(fmt, "@R"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,10 +79,10 @@ impl MacroExpander {
|
|||||||
items.push(try!(self.expand_repeat_symbol(sym.span, *repeat))),
|
items.push(try!(self.expand_repeat_symbol(sym.span, *repeat))),
|
||||||
SymbolKind::Lookahead =>
|
SymbolKind::Lookahead =>
|
||||||
items.push(try!(self.expand_lookaround_symbol(
|
items.push(try!(self.expand_lookaround_symbol(
|
||||||
sym.span, "@<", ActionKind::Lookahead))),
|
sym.span, "@L", ActionKind::Lookahead))),
|
||||||
SymbolKind::Lookbehind =>
|
SymbolKind::Lookbehind =>
|
||||||
items.push(try!(self.expand_lookaround_symbol(
|
items.push(try!(self.expand_lookaround_symbol(
|
||||||
sym.span, "@>", ActionKind::Lookbehind))),
|
sym.span, "@R", ActionKind::Lookbehind))),
|
||||||
_ =>
|
_ =>
|
||||||
assert!(false, "don't know how to expand `{:?}`", sym)
|
assert!(false, "don't know how to expand `{:?}`", sym)
|
||||||
}
|
}
|
||||||
|
@ -76,15 +76,15 @@ grammar;
|
|||||||
fn test_lookahead() {
|
fn test_lookahead() {
|
||||||
let grammar = parser::parse_grammar(r#"
|
let grammar = parser::parse_grammar(r#"
|
||||||
grammar;
|
grammar;
|
||||||
Expr = @<;
|
Expr = @L;
|
||||||
"#).unwrap();
|
"#).unwrap();
|
||||||
|
|
||||||
let actual = expand_macros(grammar).unwrap();
|
let actual = expand_macros(grammar).unwrap();
|
||||||
|
|
||||||
let expected = parser::parse_grammar(r#"
|
let expected = parser::parse_grammar(r#"
|
||||||
grammar;
|
grammar;
|
||||||
Expr = `@<`;
|
Expr = `@L`;
|
||||||
`@<` = =>@<;
|
`@L` = =>@L;
|
||||||
"#).unwrap();
|
"#).unwrap();
|
||||||
|
|
||||||
compare(actual, expected);
|
compare(actual, expected);
|
||||||
|
@ -132,7 +132,7 @@ fn test_lookahead() {
|
|||||||
compare(r#"
|
compare(r#"
|
||||||
grammar;
|
grammar;
|
||||||
extern token { type Location = usize; enum Tok { } }
|
extern token { type Location = usize; enum Tok { } }
|
||||||
A = @<;
|
A = @L;
|
||||||
"#, vec![
|
"#, vec![
|
||||||
("A", "::std::option::Option<usize>"),
|
("A", "::std::option::Option<usize>"),
|
||||||
])
|
])
|
||||||
@ -145,7 +145,7 @@ fn test_spanned_macro() {
|
|||||||
extern token { type Location = usize; enum Tok { } }
|
extern token { type Location = usize; enum Tok { } }
|
||||||
A = Spanned<"Foo">;
|
A = Spanned<"Foo">;
|
||||||
Spanned<T>: (Option<usize>, Option<usize>) = {
|
Spanned<T>: (Option<usize>, Option<usize>) = {
|
||||||
<@<> T <@>> => (<>);
|
<@L> T <@R> => (<>);
|
||||||
};
|
};
|
||||||
"#, vec![
|
"#, vec![
|
||||||
("A", "(Option<usize>, Option<usize>)"),
|
("A", "(Option<usize>, Option<usize>)"),
|
||||||
|
@ -76,7 +76,7 @@ fn dup_assoc_type() {
|
|||||||
fn lookahead_without_loc_type() {
|
fn lookahead_without_loc_type() {
|
||||||
check_err(
|
check_err(
|
||||||
r#"lookahead/lookbehind require you to declare the type of a location"#,
|
r#"lookahead/lookbehind require you to declare the type of a location"#,
|
||||||
r#"grammar; extern token { enum Tok { } } Foo = >>>@<<<<;"#);
|
r#"grammar; extern token { enum Tok { } } Foo = >>>@L<<<;"#);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -116,10 +116,10 @@ rusty_peg! {
|
|||||||
("=>" <b:CODE>) => ActionKind::User(b);
|
("=>" <b:CODE>) => ActionKind::User(b);
|
||||||
|
|
||||||
LOOKAHEAD_ACTION: ActionKind =
|
LOOKAHEAD_ACTION: ActionKind =
|
||||||
("=>@<") => ActionKind::Lookahead;
|
("=>@L") => ActionKind::Lookahead;
|
||||||
|
|
||||||
LOOKBEHIND_ACTION: ActionKind =
|
LOOKBEHIND_ACTION: ActionKind =
|
||||||
("=>@>") => ActionKind::Lookbehind;
|
("=>@R") => ActionKind::Lookbehind;
|
||||||
|
|
||||||
// Conditions
|
// Conditions
|
||||||
|
|
||||||
@ -194,12 +194,12 @@ rusty_peg! {
|
|||||||
};
|
};
|
||||||
|
|
||||||
LOOKAHEAD_SYMBOL: Symbol =
|
LOOKAHEAD_SYMBOL: Symbol =
|
||||||
(<lo:POSL> "@<" <hi:POSR>) => {
|
(<lo:POSL> "@L" <hi:POSR>) => {
|
||||||
Symbol::new(Span(lo, hi), SymbolKind::Lookahead)
|
Symbol::new(Span(lo, hi), SymbolKind::Lookahead)
|
||||||
};
|
};
|
||||||
|
|
||||||
LOOKBEHIND_SYMBOL: Symbol =
|
LOOKBEHIND_SYMBOL: Symbol =
|
||||||
(<lo:POSL> "@>" <hi:POSR>) => {
|
(<lo:POSL> "@R" <hi:POSR>) => {
|
||||||
Symbol::new(Span(lo, hi), SymbolKind::Lookbehind)
|
Symbol::new(Span(lo, hi), SymbolKind::Lookbehind)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -126,8 +126,8 @@ fn macro_symbols() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn lookaround() {
|
fn lookaround() {
|
||||||
super::parse_symbol(r#"@<"#).unwrap();
|
super::parse_symbol(r#"@L"#).unwrap();
|
||||||
super::parse_symbol(r#"@>"#).unwrap();
|
super::parse_symbol(r#"@R"#).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -54,8 +54,8 @@ pub enum Tok<'input> {
|
|||||||
LeftBracket,
|
LeftBracket,
|
||||||
LeftParen,
|
LeftParen,
|
||||||
LessThan,
|
LessThan,
|
||||||
Lookahead, // @<
|
Lookahead, // @L
|
||||||
Lookbehind, // @>
|
Lookbehind, // @R
|
||||||
Plus,
|
Plus,
|
||||||
Question,
|
Question,
|
||||||
RightBrace,
|
RightBrace,
|
||||||
@ -113,17 +113,17 @@ impl<'input> Tokenizer<'input> {
|
|||||||
// we've seen =>, now we have to choose between:
|
// we've seen =>, now we have to choose between:
|
||||||
//
|
//
|
||||||
// => code
|
// => code
|
||||||
// =>@<
|
// =>@L
|
||||||
// =>@>
|
// =>@R
|
||||||
|
|
||||||
let idx1 = match self.lookahead {
|
let idx1 = match self.lookahead {
|
||||||
Some((_, '@')) => {
|
Some((_, '@')) => {
|
||||||
match self.bump() {
|
match self.bump() {
|
||||||
Some((idx2, '<')) => {
|
Some((idx2, 'L')) => {
|
||||||
self.bump();
|
self.bump();
|
||||||
return Ok((idx0, EqualsGreaterThanLookahead, idx2+1));
|
return Ok((idx0, EqualsGreaterThanLookahead, idx2+1));
|
||||||
}
|
}
|
||||||
Some((idx2, '>')) => {
|
Some((idx2, 'R')) => {
|
||||||
self.bump();
|
self.bump();
|
||||||
return Ok((idx0, EqualsGreaterThanLookbehind, idx2+1));
|
return Ok((idx0, EqualsGreaterThanLookbehind, idx2+1));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user