oak_nginx/language/
mod.rs1#![doc = include_str!("readme.md")]
2use oak_core::{Language, LanguageCategory};
3
4#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
7pub struct NginxLanguage {
8 pub allow_extensions: bool,
10 pub strict_mode: bool,
12}
13
14impl Default for NginxLanguage {
15 fn default() -> Self {
16 Self { allow_extensions: false, strict_mode: false }
17 }
18}
19
20impl Language for NginxLanguage {
21 const NAME: &'static str = "nginx";
22 const CATEGORY: LanguageCategory = LanguageCategory::Programming;
23
24 type TokenType = crate::lexer::token_type::NginxTokenType;
25 type ElementType = crate::parser::element_type::NginxElementType;
26 type TypedRoot = crate::ast::NginxRoot;
27}
28
29impl NginxLanguage {
30 pub fn new() -> Self {
32 Self::default()
33 }
34
35 pub fn standard() -> Self {
37 Self { allow_extensions: false, strict_mode: true }
38 }
39
40 pub fn extended() -> Self {
42 Self { allow_extensions: true, strict_mode: false }
43 }
44}