fn can_be_global<'a, 'b>(
            is_global: bool,
            ctx: &'a ParseContext,
            subs: &'a mut SubstitutionTable,
            input: IndexStr<'b>,
        ) -> Result<(Expression, IndexStr<'b>)> {
            match input.try_split_at(2) {
                None => Err(error::Error::UnexpectedEnd),
                Some((head, tail)) => match head.as_ref() {
                    b"nw" => {
                        let (exprs, tail) = zero_or_more::<Expression>(ctx, subs, tail)?;
                        let tail = consume(b"_", tail)?;
                        let (ty, tail) = TypeHandle::parse(ctx, subs, tail)?;
                        if let Ok(tail) = consume(b"E", tail) {
                            let expr = if is_global {
                                Expression::GlobalNew(exprs, ty, None)
                            } else {
                                Expression::New(exprs, ty, None)
                            };
                            Ok((expr, tail))
                        } else {
                            let (init, tail) = Initializer::parse(ctx, subs, tail)?;
                            let expr = if is_global {
                                Expression::GlobalNew(exprs, ty, Some(init))
                            } else {
                                Expression::New(exprs, ty, Some(init))
                            };
                            Ok((expr, tail))
                        }
                    }
                    b"na" => {
                        let (exprs, tail) = zero_or_more::<Expression>(ctx, subs, tail)?;
                        let tail = consume(b"_", tail)?;
                        let (ty, tail) = TypeHandle::parse(ctx, subs, tail)?;
                        if let Ok(tail) = consume(b"E", tail) {
                            let expr = if is_global {
                                Expression::GlobalNewArray(exprs, ty, None)
                            } else {
                                Expression::NewArray(exprs, ty, None)
                            };
                            Ok((expr, tail))
                        } else {
                            let (init, tail) = Initializer::parse(ctx, subs, tail)?;
                            let expr = if is_global {
                                Expression::GlobalNewArray(exprs, ty, Some(init))
                            } else {
                                Expression::NewArray(exprs, ty, Some(init))
                            };
                            Ok((expr, tail))
                        }
                    }
                    b"dl" => {
                        let (expr, tail) = Expression::parse(ctx, subs, tail)?;
                        let expr = if is_global {
                            Expression::GlobalDelete(Box::new(expr))
                        } else {
                            Expression::Delete(Box::new(expr))
                        };
                        Ok((expr, tail))
                    }
                    b"da" => {
                        let (expr, tail) = Expression::parse(ctx, subs, tail)?;
                        let expr = if is_global {
                            Expression::GlobalDeleteArray(Box::new(expr))
                        } else {
                            Expression::DeleteArray(Box::new(expr))
                        };
                        Ok((expr, tail))
                    }
                    _ => Err(error::Error::UnexpectedText),
                },
            }
        }
// Parse the various expressions that can optionally have a leading "gs"
// to indicate that they are in the global namespace. The input is after
// we have already detected consumed the optional "gs" and if we did
// find it, then `is_global` should be true.
Parse the various expressions that can optionally have a leading "gs"
to indicate that they are in the global namespace. The input is after
we have already detected consumed the optional "gs" and if we did
find it, then `is_global` should be true.
Parse the various expressions that can optionally have a leading " gs " to indicate that they are in the global namespace . The input is after we have already detected consumed the optional " gs " and if we did find it then ` is_global ` should be true .
fn can_be_global<'a, 'b>(
            is_global: bool,
            ctx: &'a ParseContext,
            subs: &'a mut SubstitutionTable,
            input: IndexStr<'b>,
        ) -> Result<(Expression, IndexStr<'b>)> {
            match input.try_split_at(2) {
                None => Err(error::Error::UnexpectedEnd),
                Some((head, tail)) => match head.as_ref() {
                    b"nw" => {
                        let (exprs, tail) = zero_or_more::<Expression>(ctx, subs, tail)?;
                        let tail = consume(b"_", tail)?;
                        let (ty, tail) = TypeHandle::parse(ctx, subs, tail)?;
                        if let Ok(tail) = consume(b"E", tail) {
                            let expr = if is_global {
                                Expression::GlobalNew(exprs, ty, None)
                            } else {
                                Expression::New(exprs, ty, None)
                            };
                            Ok((expr, tail))
                        } else {
                            let (init, tail) = Initializer::parse(ctx, subs, tail)?;
                            let expr = if is_global {
                                Expression::GlobalNew(exprs, ty, Some(init))
                            } else {
                                Expression::New(exprs, ty, Some(init))
                            };
                            Ok((expr, tail))
                        }
                    }
                    b"na" => {
                        let (exprs, tail) = zero_or_more::<Expression>(ctx, subs, tail)?;
                        let tail = consume(b"_", tail)?;
                        let (ty, tail) = TypeHandle::parse(ctx, subs, tail)?;
                        if let Ok(tail) = consume(b"E", tail) {
                            let expr = if is_global {
                                Expression::GlobalNewArray(exprs, ty, None)
                            } else {
                                Expression::NewArray(exprs, ty, None)
                            };
                            Ok((expr, tail))
                        } else {
                            let (init, tail) = Initializer::parse(ctx, subs, tail)?;
                            let expr = if is_global {
                                Expression::GlobalNewArray(exprs, ty, Some(init))
                            } else {
                                Expression::NewArray(exprs, ty, Some(init))
                            };
                            Ok((expr, tail))
                        }
                    }
                    b"dl" => {
                        let (expr, tail) = Expression::parse(ctx, subs, tail)?;
                        let expr = if is_global {
                            Expression::GlobalDelete(Box::new(expr))
                        } else {
                            Expression::Delete(Box::new(expr))
                        };
                        Ok((expr, tail))
                    }
                    b"da" => {
                        let (expr, tail) = Expression::parse(ctx, subs, tail)?;
                        let expr = if is_global {
                            Expression::GlobalDeleteArray(Box::new(expr))
                        } else {
                            Expression::DeleteArray(Box::new(expr))
                        };
                        Ok((expr, tail))
                    }
                    _ => Err(error::Error::UnexpectedText),
                },
            }
        }
fn can_be_global < ' a , ' b > ( is_global : bool , ctx : & ' a ParseContext , subs : & ' a mut SubstitutionTable , input : IndexStr < ' b > , ) -> Result < ( Expression , IndexStr < ' b > ) > { match input . try_split_at ( 2 ) { None => Err ( error :: Error :: UnexpectedEnd ) , Some ( ( head , tail ) ) => match head . as_ref ( ) { b" " => { let ( exprs , tail ) = zero_or_more :: < Expression > ( ctx , subs , tail ) ? ; let tail = consume ( b" " , tail ) ? ; let ( ty , tail ) = TypeHandle :: parse ( ctx , subs , tail ) ? ; if let Ok ( tail ) = consume ( b" " , tail ) { let expr = if is_global { Expression :: GlobalNew ( exprs , ty , None ) } else { Expression :: New ( exprs , ty , None ) } ; Ok ( ( expr , tail ) ) } else { let ( init , tail ) = Initializer :: parse ( ctx , subs , tail ) ? ; let expr = if is_global { Expression :: GlobalNew ( exprs , ty , Some ( init ) ) } else { Expression :: New ( exprs , ty , Some ( init ) ) } ; Ok ( ( expr , tail ) ) } } b" " => { let ( exprs , tail ) = zero_or_more :: < Expression > ( ctx , subs , tail ) ? ; let tail = consume ( b" " , tail ) ? ; let ( ty , tail ) = TypeHandle :: parse ( ctx , subs , tail ) ? ; if let Ok ( tail ) = consume ( b" " , tail ) { let expr = if is_global { Expression :: GlobalNewArray ( exprs , ty , None ) } else { Expression :: NewArray ( exprs , ty , None ) } ; Ok ( ( expr , tail ) ) } else { let ( init , tail ) = Initializer :: parse ( ctx , subs , tail ) ? ; let expr = if is_global { Expression :: GlobalNewArray ( exprs , ty , Some ( init ) ) } else { Expression :: NewArray ( exprs , ty , Some ( init ) ) } ; Ok ( ( expr , tail ) ) } } b" " => { let ( expr , tail ) = Expression :: parse ( ctx , subs , tail ) ? ; let expr = if is_global { Expression :: GlobalDelete ( Box :: new ( expr ) ) } else { Expression :: Delete ( Box :: new ( expr ) ) } ; Ok ( ( expr , tail ) ) } b" " => { let ( expr , tail ) = Expression :: parse ( ctx , subs , tail ) ? ; let expr = if is_global { Expression :: GlobalDeleteArray ( Box :: new ( expr ) ) } else { Expression :: DeleteArray ( Box :: new ( expr ) ) } ; Ok ( ( expr , tail ) ) } _ => Err ( error :: Error :: UnexpectedText ) , } , } }
Parse the various expressions that can optionally have a leading "gs"
to indicate that they are in the global namespace.
Parse the various expressions that can optionally have a leading " gs " to indicate that they are in the global namespace .
is_global
bool
ctx
&'a ParseContext
subs
&'a mut SubstitutionTable
input
IndexStr<'b>
is_global
bool
ctx
&'a ParseContext
subs
&'a mut SubstitutionTable
input
IndexStr<'b>