//// Generic Abstract Syntax suport module
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
use std::ops::{Deref,DerefMut};
use std::collections::{HashMap,HashSet};
use crate::GenAbsyn::*;
/// custom smart pointer that encapsulates line number and column 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
///```ignore
/// enum Expr {
/// Val(i64),
/// Plus(LBox<Expr>,LBox<Expr>),
/// ...
/// }
///```
/// The [RuntimeParser.lb] function can be called from the semantic actions
/// to create LBoxed-values that include line/column information.
pub struct LBox<T>
{
pub exp:Box<T>,
pub line:usize,
pub column:usize,
}
impl<T> LBox<T>
{
pub fn new(e:T,ln:usize,col:usize) -> LBox<T>
{ LBox { exp:Box::new(e), line:ln, column:col } }
}
impl<T> Deref for LBox<T>
{
type Target = T;
fn deref(&self) -> &Self::Target {
&self.exp
}
}
impl<T> DerefMut for LBox<T>
{
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.exp
}
}