Skip to main content

oak_php/language/
mod.rs

1#![doc = include_str!("readme.md")]
2use oak_core::{Language, LanguageCategory};
3#[cfg(feature = "serde")]
4use serde::{Deserialize, Serialize};
5
6/// The type of the root node for PHP AST.
7pub type TypedRoot = crate::ast::PhpRoot;
8
9/// PHP language implementation.
10///
11/// This struct implements the [`Language`] trait for the PHP language.
12#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
13#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
14pub struct PhpLanguage {}
15
16impl PhpLanguage {
17    /// Creates a new `PhpLanguage` instance.
18    pub fn new() -> Self {
19        Self {}
20    }
21}
22
23impl Language for PhpLanguage {
24    const NAME: &'static str = "php";
25    const CATEGORY: LanguageCategory = LanguageCategory::Programming;
26
27    type TokenType = crate::lexer::token_type::PhpTokenType;
28    type ElementType = crate::parser::element_type::PhpElementType;
29    type TypedRoot = crate::ast::PhpRoot;
30}