oak_nginx/language/
mod.rs

1use crate::{ast::NginxRoot, kind::NginxSyntaxKind};
2use oak_core::Language;
3
4#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub struct NginxLanguage {
6    /// 是否允许扩展指令
7    pub allow_extensions: bool,
8    /// 是否严格模式
9    pub strict_mode: bool,
10}
11
12impl Default for NginxLanguage {
13    fn default() -> Self {
14        Self { allow_extensions: false, strict_mode: false }
15    }
16}
17
18impl Language for NginxLanguage {
19    type SyntaxKind = NginxSyntaxKind;
20    type TypedRoot = NginxRoot;
21}
22
23impl NginxLanguage {
24    pub fn new() -> Self {
25        Self::default()
26    }
27
28    pub fn standard() -> Self {
29        Self { allow_extensions: false, strict_mode: true }
30    }
31
32    pub fn extended() -> Self {
33        Self { allow_extensions: true, strict_mode: false }
34    }
35}