1#![doc = include_str!("readme.md")]
2use oak_core::{Language, LanguageCategory};
3#[cfg(feature = "serde")]
4use serde::{Deserialize, Serialize};
5
6pub type TypedRoot = crate::ast::PhpRoot;
8
9#[derive(Debug, Clone, PartialEq, Eq, Hash)]
13#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
14pub struct PhpLanguage {
15 pub tag_start: String,
17 pub tag_end: String,
19 pub short_tag_start: String,
21 pub echo_tag_start: String,
23}
24
25impl Default for PhpLanguage {
26 fn default() -> Self {
27 Self { tag_start: "<?php".to_string(), tag_end: "?>".to_string(), short_tag_start: "<?".to_string(), echo_tag_start: "<?=".to_string() }
28 }
29}
30
31impl PhpLanguage {
32 pub fn new() -> Self {
34 Self::default()
35 }
36}
37
38impl Language for PhpLanguage {
39 const NAME: &'static str = "php";
40 const CATEGORY: LanguageCategory = LanguageCategory::Programming;
41
42 type TokenType = crate::lexer::token_type::PhpTokenType;
43 type ElementType = crate::parser::element_type::PhpElementType;
44 type TypedRoot = crate::ast::PhpRoot;
45}