oak-crystal 0.0.2

Crystal language parser with support for modern Crystal syntax and Ruby-like features.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::parser::{CrystalParser, State};
use oak_core::{GreenNode, OakError, source::Source};

impl<'config> CrystalParser<'config> {
    pub(crate) fn parse_root_internal<'a, S: Source + ?Sized>(&self, state: &mut State<'a, S>) -> Result<&'a GreenNode<'a, crate::language::CrystalLanguage>, OakError> {
        use crate::parser::CrystalElementType::*;
        let checkpoint = state.checkpoint();

        while state.not_at_end() {
            state.bump();
        }

        Ok(state.finish_at(checkpoint, SourceFile))
    }
}