Struct rustlr::generic_absyn::LBox [−][src]
Expand description
custom smart pointer that encapsulates line number, column and other information for warnings and error messages after the parsing stage. Implements Deref and DerefMut so the encapsulated expression can be accessed as in a standard Box. For example, an abstract syntax type can be defined by
enum Expr {
Val(i64),
PlusExpr(LBox<Expr>,LBox<Expr>),
...
}
fn check(e:&Expr) {
match e {
PlusExpr(a,b) => {
println!("checking subexpressions on line {} and {}",a.line,b.line);
check(a); check(b); // Deref coercion used here
},
...
The RuntimeParser::lb function can be called from the semantic actions
of a grammar
to create LBoxed-values that include line/column information. LBox
Fields
exp: Box<T>
line: usize
column: usize
src_id: usize
Implementations
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for LBox<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for LBox<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more