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