pub enum TokenKind {
Show 38 variants
Datasource,
Generator,
Model,
Enum,
Type,
True,
False,
Ident(String),
String(String),
Number(String),
At,
AtAt,
LBrace,
RBrace,
LBracket,
RBracket,
LParen,
RParen,
Comma,
Colon,
Equal,
Question,
Bang,
Dot,
Star,
Plus,
Minus,
Slash,
Pipe,
DoublePipe,
LAngle,
RAngle,
Percent,
LessEqual,
GreaterEqual,
BangEqual,
Newline,
Eof,
}Expand description
Token kinds for the schema language.
Variants§
Datasource
datasource keyword.
Generator
generator keyword.
Model
model keyword.
Enum
enum keyword.
Type
type keyword.
True
true keyword.
False
false keyword.
Ident(String)
Identifier (e.g., User, email, autoincrement).
String(String)
String literal (e.g., "postgresql").
Number(String)
Number literal (e.g., 42, 3.14).
At
@ symbol (field attribute).
AtAt
@@ symbol (model attribute).
LBrace
{ symbol.
RBrace
} symbol.
LBracket
[ symbol.
RBracket
] symbol.
LParen
( symbol.
RParen
) symbol.
Comma
, symbol.
Colon
: symbol.
Equal
= symbol.
Question
? symbol (optional field).
Bang
! symbol (not-null field).
Dot
. symbol (for method calls).
Star
* operator.
Plus
+ operator.
Minus
- operator.
Slash
/ operator.
Pipe
| operator.
DoublePipe
|| operator (SQL string concatenation).
LAngle
< operator.
RAngle
> operator.
Percent
% operator.
LessEqual
<= operator.
GreaterEqual
>= operator.
BangEqual
!= operator.
Newline
Newline (significant for statement termination).
Eof
End of file.
Implementations§
Source§impl TokenKind
impl TokenKind
Sourcepub fn is_keyword(&self) -> bool
pub fn is_keyword(&self) -> bool
Check if this token is a keyword.
Sourcepub fn from_ident(ident: &str) -> Self
pub fn from_ident(ident: &str) -> Self
Try to convert an identifier string to a keyword.