syn_grammar_model/model/backend.rs
1/// Describes a built-in grammar rule.
2#[derive(Debug, Clone, PartialEq, Eq)]
3pub struct BuiltIn {
4 /// The name of the built-in rule (e.g., "ident", "string").
5 pub name: &'static str,
6 /// The Rust return type of the built-in rule as a string.
7 /// This allows backends to declare portable types (e.g., "syn_grammar_model::model::types::Identifier")
8 /// or backend-specific types (e.g., "syn::Ident").
9 pub return_type: &'static str,
10}
11
12/// A trait that backends must implement to declare their capabilities.
13pub trait Backend {
14 /// Returns the list of built-in rules supported by this backend.
15 fn get_builtins() -> &'static [BuiltIn];
16}