mago_syntax/settings.rs
1/// Settings for the lexer.
2#[derive(Debug, Clone, Copy)]
3pub struct LexerSettings {
4 /// Whether to enable short open tags (`<?`).
5 ///
6 /// When enabled (default), `<?` is treated as a short open tag that switches to PHP scripting mode.
7 /// When disabled, only `<?php` and `<?=` are recognized as valid PHP open tags.
8 ///
9 /// This corresponds to PHP's `short_open_tag` ini directive.
10 pub enable_short_tags: bool,
11}
12
13/// Settings for the parser.
14#[derive(Debug, Clone, Copy, Default)]
15pub struct ParserSettings {
16 /// Settings for the lexer.
17 pub lexer: LexerSettings,
18 /// Keep unfinished bodies and lists at EOF for editor queries.
19 /// Missing delimiters still produce parse errors.
20 pub recover_incomplete: bool,
21}
22
23impl Default for LexerSettings {
24 fn default() -> Self {
25 Self { enable_short_tags: true }
26 }
27}