lexariel 0.1.0

Lexical analyzer for Asmodeus language
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::position::InputReader;

/// alphanumeric identifiers with underscores
pub(crate) fn read_identifier(reader: &mut InputReader) -> String {
    let mut identifier = String::new();

    while let Some(ch) = reader.peek() {
        if ch.is_alphanumeric() || ch == '_' {
            identifier.push(ch);
            reader.advance();
        } else {
            break;
        }
    }

    identifier
}