mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-30 04:44:44 +00:00
Updated to remove field
With this, try_reduce_tuple were changed from self.lpop() to self.skip()
This commit is contained in:
parent
1902ad5a15
commit
e3135778d5
2 changed files with 7 additions and 15 deletions
|
@ -493,8 +493,6 @@ impl_locational_for_enum!(Array; Normal, WithLength, Comprehension);
|
|||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct NormalTuple {
|
||||
pub l_paren: Token,
|
||||
pub r_paren: Token,
|
||||
pub elems: Args,
|
||||
}
|
||||
|
||||
|
@ -505,13 +503,11 @@ impl NestedDisplay for NormalTuple {
|
|||
}
|
||||
|
||||
impl_display_from_nested!(NormalTuple);
|
||||
impl_locational!(NormalTuple, l_paren, r_paren);
|
||||
impl_locational!(NormalTuple, elems, elems);
|
||||
|
||||
impl NormalTuple {
|
||||
pub fn new(l_paren: Token, r_paren: Token, elems: Args) -> Self {
|
||||
pub fn new(elems: Args) -> Self {
|
||||
Self {
|
||||
l_paren,
|
||||
r_paren,
|
||||
elems,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1854,17 +1854,13 @@ impl Parser {
|
|||
#[inline]
|
||||
fn try_reduce_tuple(&mut self) -> ParseResult<Tuple> {
|
||||
debug_call_info!(self);
|
||||
let l_paren = self.lpop();
|
||||
self.skip();
|
||||
let inner = self.try_reduce_elems().map_err(|_| self.stack_dec())?;
|
||||
let r_paren = self.lpop();
|
||||
if !r_paren.is(RParen) {
|
||||
self.level -= 1;
|
||||
self.errs
|
||||
.push(ParseError::simple_syntax_error(0, r_paren.loc()));
|
||||
return Err(());
|
||||
}
|
||||
self.skip();
|
||||
let tpl = match inner {
|
||||
ArrayInner::Normal(elems) => Tuple::Normal(NormalTuple::new(l_paren, r_paren, elems)),
|
||||
ArrayInner::Normal(elems) => {
|
||||
Tuple::Normal(NormalTuple::new(elems))
|
||||
},
|
||||
ArrayInner::Comprehension {
|
||||
elem: _,
|
||||
generators: _,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue