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