Skip to main content

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}
19
20impl Default for LexerSettings {
21    fn default() -> Self {
22        Self { enable_short_tags: true }
23    }
24}