pub use ast::*;
pub use visitor::*;
pub use front::ast::FExpressionInfo;
use std::default::Default;
pub type AGrammar = Grammar<FExpressionInfo>;
impl AGrammar
{
pub fn merge_print_typing(&mut self, level: PrintLevel) {
self.attributes.print_typing = self.attributes.print_typing.merge(level);
}
}
pub struct GrammarAttributes
{
pub print_typing: PrintLevel
}
impl Default for GrammarAttributes {
fn default() -> Self {
GrammarAttributes {
print_typing: PrintLevel::default()
}
}
}
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum PrintLevel
{
Debug,
Show,
Nothing
}
impl PrintLevel
{
pub fn merge(self, other: PrintLevel) -> PrintLevel {
use self::PrintLevel::*;
match (self, other) {
(Nothing, Debug)
| (Show, Debug) => Debug,
(Nothing, Show) => Show,
_ => Nothing
}
}
pub fn debug(self) -> bool {
self == PrintLevel::Debug
}
}
impl Default for PrintLevel
{
fn default() -> PrintLevel {
PrintLevel::Nothing
}
}