Skip to main content

oak_python/language/
mod.rs

1#![doc = include_str!("readme.md")]
2use oak_core::{Language, LanguageCategory};
3#[cfg(feature = "serde")]
4use serde::{Deserialize, Serialize};
5
6/// Python language definition.
7#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
8#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
9pub struct PythonLanguage {}
10
11impl PythonLanguage {
12    /// Creates a new Python language configuration.
13    pub fn new() -> Self {
14        Self {}
15    }
16}
17
18impl Language for PythonLanguage {
19    const NAME: &'static str = "python";
20    const CATEGORY: LanguageCategory = LanguageCategory::Programming;
21
22    type TokenType = crate::lexer::token_type::PythonTokenType;
23    type ElementType = crate::parser::PythonElementType;
24    type TypedRoot = crate::ast::PythonRoot;
25}