use crate::*;

pub enum SyntacticTokenType {
    Reference(String),

    LabelDefinition(String),
    MacroDefinition(String),
    MacroDefinitionTerminator,

    Padding(u16),
    ByteLiteral(u8),
    ShortLiteral(u16),
    Instruction(u8),

    Comment,
}



pub struct SyntacticToken {
    pub r#type: SyntacticTokenType,
    pub source_location: SourceLocation,
    pub error: Option<Error>,
}

impl SyntacticToken {
    // Call when this token is found inside a macro definition.
    pub fn use_in_macro_body(&mut self) {
        match self.r#type {
            SyntacticTokenType::LabelDefinition(..) |
            SyntacticTokenType::MacroDefinition(..) => {
                self.set_error(Error::InvalidTypeInMacroDefinition)
            }
            _ => (),
        };
    }
    pub fn set_error(&mut self, error: Error) {
        self.error = Some(error);
    }
    pub fn is_macro_terminator(&self) -> bool {
        if let SyntacticTokenType::MacroDefinitionTerminator = self.r#type {true} else {false}
    }
}