b2285ce0e0
Just's first parser performed both parsing, i.e the transformation of a token stream according to the language grammar, and a number of consistency checks and analysis passes. This made parsing and analysis quite complex, so this diff introduces a new, much cleaner `Parser`, and moves existing analysis into a dedicated `Analyzer`.
19 lines
467 B
Rust
19 lines
467 B
Rust
use crate::common::*;
|
|
|
|
/// An assignment, e.g `foo := bar`
|
|
#[derive(Debug, PartialEq)]
|
|
pub(crate) struct Assignment<'src> {
|
|
/// Assignment was prefixed by the `export` keyword
|
|
pub(crate) export: bool,
|
|
/// Left-hand side of the assignment
|
|
pub(crate) name: Name<'src>,
|
|
/// Right-hand side of the assignment
|
|
pub(crate) expression: Expression<'src>,
|
|
}
|
|
|
|
impl<'src> Keyed<'src> for Assignment<'src> {
|
|
fn key(&self) -> &'src str {
|
|
self.name.lexeme()
|
|
}
|
|
}
|