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