1pub mod element_type;
2
3use crate::{language::DotLanguage, lexer::DotLexer};
4use oak_core::{
5 parser::{ParseOutput, Parser, ParserState, parse_with_lexer},
6 source::{Source, TextEdit},
7};
8
9mod parse_top_level;
10
11pub(crate) type State<'a, S> = ParserState<'a, DotLanguage, S>;
12
13pub struct DotParser<'config> {
14 pub(crate) _config: &'config DotLanguage,
15}
16
17impl<'config> DotParser<'config> {
18 pub fn new(config: &'config DotLanguage) -> Self {
19 Self { _config: config }
20 }
21}
22
23impl<'config> Parser<DotLanguage> for DotParser<'config> {
24 fn parse<'a, S: Source + ?Sized>(&self, text: &'a S, edits: &[TextEdit], cache: &'a mut impl oak_core::ParseCache<DotLanguage>) -> ParseOutput<'a, DotLanguage> {
25 let lexer = DotLexer::new(self._config);
26 parse_with_lexer(&lexer, text, edits, cache, |state| self.parse_root_internal(state))
27 }
28}