rusty_lr_parser 4.0.0

grammar line parser for rusty_lr
Documentation
// constants and utility functions for macro-generation

use crate::parser::location::Location;
use proc_macro2::Ident;

pub static AUGMENTED_NAME: &str = "Augmented";
pub static EOF_NAME: &str = "eof";
pub static ERROR_NAME: &str = "error";
pub static USER_DATA_PARAMETER_NAME: &str = "data";
pub static TERMINAL_STACK_NAME: &str = "__rustylr_generated_terminal_stack";
pub static OTHERS_TERMINAL_NAME: &str = "__rustylr_other_terminals";
pub static LOOKAHEAD_PARAMETER_NAME: &str = "lookahead";

pub(crate) fn location_variable_name(varname: &str) -> String {
    format!("__rustylr_location_{}", varname)
}

/// Build an Ident from a string and Location using the SpanManager.
pub(crate) fn ident_from_located(
    name: &str,
    location: &Location,
    span_manager: &crate::parser::location::SpanManager,
) -> Ident {
    let span = span_manager.get_span_in_location(location);
    Ident::new(name, span)
}