pub enum SyntaxKind {
Show 210 variants
ERROR = 0,
EOF,
WHITESPACE,
LINEBREAK,
COMMENT_LINE,
COMMENT_BLOCK,
INTEGER,
STRING,
ADDRESS_LIT,
IDENT_LIT,
IDENT,
KW_TRUE,
KW_FALSE,
KW_NONE,
KW_ADDRESS,
KW_BOOL,
KW_FIELD,
KW_GROUP,
KW_SCALAR,
KW_SIGNATURE,
KW_STRING,
KW_RECORD,
KW_DYN,
KW_IDENTIFIER,
KW_FINAL_UPPER,
KW_I8,
KW_I16,
KW_I32,
KW_I64,
KW_I128,
KW_U8,
KW_U16,
KW_U32,
KW_U64,
KW_U128,
KW_IF,
KW_ELSE,
KW_FOR,
KW_IN,
KW_RETURN,
KW_LET,
KW_CONST,
KW_CONSTANT,
KW_FINAL,
KW_FN,
KW_FN_UPPER,
KW_STRUCT,
KW_CONSTRUCTOR,
KW_INTERFACE,
KW_PROGRAM,
KW_IMPORT,
KW_MAPPING,
KW_STORAGE,
KW_NETWORK,
KW_ALEO,
KW_SCRIPT,
KW_BLOCK,
KW_PUBLIC,
KW_PRIVATE,
KW_AS,
KW_SELF,
KW_ASSERT,
KW_ASSERT_EQ,
KW_ASSERT_NEQ,
L_PAREN,
R_PAREN,
L_BRACKET,
R_BRACKET,
L_BRACE,
R_BRACE,
COMMA,
DOT,
DOT_DOT,
DOT_DOT_EQ,
SEMICOLON,
COLON,
COLON_COLON,
QUESTION,
ARROW,
FAT_ARROW,
UNDERSCORE,
AT,
EQ,
PLUS_EQ,
MINUS_EQ,
STAR_EQ,
SLASH_EQ,
PERCENT_EQ,
STAR2_EQ,
AMP2_EQ,
PIPE2_EQ,
AMP_EQ,
PIPE_EQ,
CARET_EQ,
SHL_EQ,
SHR_EQ,
PLUS,
MINUS,
STAR,
SLASH,
PERCENT,
STAR2,
EQ2,
BANG_EQ,
LT,
LT_EQ,
GT,
GT_EQ,
AMP2,
PIPE2,
BANG,
AMP,
PIPE,
CARET,
SHL,
SHR,
ROOT,
PROGRAM_DECL,
IMPORT,
MAIN_CONTENTS,
MODULE_CONTENTS,
FUNCTION_DEF,
FINAL_FN_DEF,
CONSTRUCTOR_DEF,
STRUCT_DEF,
RECORD_DEF,
STRUCT_MEMBER,
STRUCT_MEMBER_PUBLIC,
STRUCT_MEMBER_PRIVATE,
STRUCT_MEMBER_CONSTANT,
MAPPING_DEF,
STORAGE_DEF,
GLOBAL_CONST,
INTERFACE_DEF,
FN_PROTOTYPE_DEF,
RECORD_PROTOTYPE_DEF,
ANNOTATION,
ANNOTATION_PAIR,
PARAM,
PARAM_PUBLIC,
PARAM_PRIVATE,
PARAM_CONSTANT,
PARAM_LIST,
RETURN_TYPE,
CONST_PARAM,
CONST_PARAM_LIST,
CONST_ARG_LIST,
DYNAMIC_CALL_RETURN_TYPE,
ARRAY_LENGTH,
LET_STMT,
CONST_STMT,
RETURN_STMT,
EXPR_STMT,
ASSIGN_STMT,
COMPOUND_ASSIGN_STMT,
IF_STMT,
FOR_STMT,
FOR_INCLUSIVE_STMT,
BLOCK,
ASSERT_STMT,
ASSERT_EQ_STMT,
ASSERT_NEQ_STMT,
IDENT_PATTERN,
TUPLE_PATTERN,
WILDCARD_PATTERN,
BINARY_EXPR,
UNARY_EXPR,
CALL_EXPR,
METHOD_CALL_EXPR,
FIELD_EXPR,
INDEX_EXPR,
CAST_EXPR,
TERNARY_EXPR,
ARRAY_EXPR,
TUPLE_EXPR,
STRUCT_EXPR,
STRUCT_LOCATOR_EXPR,
STRUCT_FIELD_INIT,
STRUCT_FIELD_SHORTHAND,
PATH_EXPR,
PATH_LOCATOR_EXPR,
PROGRAM_REF_EXPR,
SELF_EXPR,
BLOCK_KW_EXPR,
NETWORK_KW_EXPR,
PAREN_EXPR,
LITERAL_FIELD,
LITERAL_GROUP,
LITERAL_SCALAR,
LITERAL_INT,
LITERAL_STRING,
LITERAL_ADDRESS,
LITERAL_BOOL,
LITERAL_NONE,
LITERAL_IDENT,
REPEAT_EXPR,
FINAL_EXPR,
TUPLE_ACCESS_EXPR,
DYNAMIC_CALL_EXPR,
TYPE_PATH,
TYPE_PRIMITIVE,
TYPE_LOCATOR,
TYPE_ARRAY,
TYPE_VECTOR,
TYPE_TUPLE,
TYPE_OPTIONAL,
TYPE_FINAL,
TYPE_MAPPING,
TYPE_DYN_RECORD,
PARENT_LIST,
// some variants omitted
}Expand description
All syntax kinds for Leo tokens and nodes.
This enum is intentionally flat (not nested) to satisfy rowan’s requirement
for a #[repr(u16)] type. Categories are indicated by comments and helper
methods like is_trivia() and is_keyword().
Variants§
ERROR = 0
Error node for wrapping parse errors and invalid tokens.
EOF
End of file marker.
WHITESPACE
Horizontal whitespace: spaces, tabs, form feeds.
LINEBREAK
Line breaks: \n or \r\n.
COMMENT_LINE
Line comment: // …
COMMENT_BLOCK
Block comment: /* … */
INTEGER
Integer literal: 123, 0xFF, 0b101, 0o77
STRING
String literal: “…”
ADDRESS_LIT
Address literal: aleo1…
IDENT_LIT
Identifier literal: ‘foo’
IDENT
Identifier: foo, Bar, _baz Note: Complex identifiers (paths, program IDs, locators) are deferred to Phase 2. The lexer produces simple IDENT tokens; the parser handles disambiguation of foo::bar, foo.aleo, foo.aleo::bar patterns.
KW_TRUE
true
KW_FALSE
false
KW_NONE
none
KW_ADDRESS
address
KW_BOOL
bool
KW_FIELD
field
KW_GROUP
group
KW_SCALAR
scalar
KW_SIGNATURE
signature
KW_STRING
string
KW_RECORD
record
KW_DYN
dyn
KW_IDENTIFIER
identifier
KW_FINAL_UPPER
Final
KW_I8
i8
KW_I16
i16
KW_I32
i32
KW_I64
i64
KW_I128
i128
KW_U8
u8
KW_U16
u16
KW_U32
u32
KW_U64
u64
KW_U128
u128
KW_IF
if
KW_ELSE
else
KW_FOR
for
KW_IN
in
KW_RETURN
return
KW_LET
let
KW_CONST
const
KW_CONSTANT
constant
KW_FINAL
final
KW_FN
fn
KW_FN_UPPER
Fn
KW_STRUCT
struct
KW_CONSTRUCTOR
constructor
KW_INTERFACE
interface
KW_PROGRAM
program
KW_IMPORT
import
KW_MAPPING
mapping
KW_STORAGE
storage
KW_NETWORK
network
KW_ALEO
aleo
KW_SCRIPT
script
KW_BLOCK
block
KW_PUBLIC
public
KW_PRIVATE
private
KW_AS
as
KW_SELF
self
KW_ASSERT
assert
KW_ASSERT_EQ
assert_eq
KW_ASSERT_NEQ
assert_neq
L_PAREN
(
R_PAREN
)
L_BRACKET
[
R_BRACKET
]
L_BRACE
{
R_BRACE
}
COMMA
,
DOT
.
DOT_DOT
..
DOT_DOT_EQ
..=
SEMICOLON
;
COLON
:
COLON_COLON
::
QUESTION
?
ARROW
->
FAT_ARROW
=>
UNDERSCORE
_
AT
@
EQ
=
PLUS_EQ
+=
MINUS_EQ
-=
STAR_EQ
*=
SLASH_EQ
/=
PERCENT_EQ
%=
STAR2_EQ
**=
AMP2_EQ
&&=
PIPE2_EQ
||=
AMP_EQ
&=
PIPE_EQ
|=
CARET_EQ
^=
SHL_EQ
<<=
SHR_EQ
>>=
PLUS
+
MINUS
-
STAR
*
SLASH
/
PERCENT
%
STAR2
**
EQ2
==
BANG_EQ
!=
LT
<
LT_EQ
<=
GT
>
GT_EQ
>=
AMP2
&&
PIPE2
||
BANG
!
AMP
&
PIPE
|
CARET
^
SHL
<<
SHR
>>
ROOT
Root node of the syntax tree.
PROGRAM_DECL
Program declaration: program foo.aleo { ... }
IMPORT
Import statement: import foo.aleo;
MAIN_CONTENTS
Main file contents.
MODULE_CONTENTS
Module file contents.
FUNCTION_DEF
Function definition.
FINAL_FN_DEF
Final function definition: final fn ...
CONSTRUCTOR_DEF
Constructor definition.
STRUCT_DEF
Struct definition.
RECORD_DEF
Record definition.
STRUCT_MEMBER
Struct member declaration.
STRUCT_MEMBER_PUBLIC
Public struct member: public name: Type
STRUCT_MEMBER_PRIVATE
Private struct member: private name: Type
STRUCT_MEMBER_CONSTANT
Constant struct member: constant name: Type
MAPPING_DEF
Mapping definition.
STORAGE_DEF
Storage definition.
GLOBAL_CONST
Global constant definition.
INTERFACE_DEF
Interface declaration.
FN_PROTOTYPE_DEF
Function prototype (in interface).
RECORD_PROTOTYPE_DEF
Record prototype (in interface).
ANNOTATION
Annotation: @foo
ANNOTATION_PAIR
Annotation key-value pair: key = "value"
PARAM
Parameter in a function signature.
PARAM_PUBLIC
Public parameter: public name: Type
PARAM_PRIVATE
Private parameter: private name: Type
PARAM_CONSTANT
Constant parameter: constant name: Type
PARAM_LIST
Parameter list: (a: u32, b: u32)
RETURN_TYPE
Function output type.
CONST_PARAM
Const generic parameter.
CONST_PARAM_LIST
Const generic parameter list.
CONST_ARG_LIST
Const generic argument list.
DYNAMIC_CALL_RETURN_TYPE
Visibility-annotated return type for _dynamic_call (e.g. public u64).
ARRAY_LENGTH
Array length expression wrapper in [T; N].
LET_STMT
Let statement: let x = ...;
CONST_STMT
Const statement: const x = ...;
RETURN_STMT
Return statement: return ...;
EXPR_STMT
Expression statement: foo();
ASSIGN_STMT
Assignment statement: x = ...;
COMPOUND_ASSIGN_STMT
Compound assignment statement: x += ...;, x -= ...;, etc.
IF_STMT
If statement: if ... { } else { }
FOR_STMT
For loop: for i in 0..10 { }
FOR_INCLUSIVE_STMT
Inclusive for loop: for i in 0..=10 { }
BLOCK
Block: { ... }
ASSERT_STMT
Assert statement: assert(...);
ASSERT_EQ_STMT
Assert equals statement: assert_eq(...);
ASSERT_NEQ_STMT
Assert not equals statement: assert_neq(...);
IDENT_PATTERN
Identifier pattern: x
TUPLE_PATTERN
Tuple pattern: (a, b, c)
WILDCARD_PATTERN
Wildcard pattern: _
BINARY_EXPR
Binary expression: a + b
UNARY_EXPR
Unary expression: !a, -a
CALL_EXPR
Function call: foo(a, b)
METHOD_CALL_EXPR
Method call: a.foo(b)
FIELD_EXPR
Member access: a.b
INDEX_EXPR
Array/tuple index: a[0]
CAST_EXPR
Cast expression: a as u32
TERNARY_EXPR
Ternary expression: a ? b : c
ARRAY_EXPR
Array literal: [1, 2, 3]
TUPLE_EXPR
Tuple literal: (1, 2, 3)
STRUCT_EXPR
Struct literal: Foo { a: 1, b: 2 }
STRUCT_LOCATOR_EXPR
Struct locator literal: program.aleo::Type { a: 1, b: 2 }
STRUCT_FIELD_INIT
Struct field initializer: a: 1
STRUCT_FIELD_SHORTHAND
Struct field shorthand: { x } (equivalent to { x: x })
PATH_EXPR
Path expression: foo::bar
PATH_LOCATOR_EXPR
Path locator expression: program.aleo::function
PROGRAM_REF_EXPR
Program reference expression: name.aleo (without ::Type suffix).
SELF_EXPR
Self expression: self
BLOCK_KW_EXPR
Block keyword expression: block
NETWORK_KW_EXPR
Network keyword expression: network
PAREN_EXPR
Parenthesized expression: (a + b)
LITERAL_FIELD
Field literal: 42field
LITERAL_GROUP
Group literal: 42group
LITERAL_SCALAR
Scalar literal: 42scalar
LITERAL_INT
Integer literal: 42u32, 42 (unsuffixed)
LITERAL_STRING
String literal: "hello"
LITERAL_ADDRESS
Address literal: aleo1...
LITERAL_BOOL
Boolean literal: true, false
LITERAL_NONE
None literal: none
LITERAL_IDENT
Identifier literal: 'foo'
REPEAT_EXPR
Repeat expression: [0u8; 32]
FINAL_EXPR
Async expression: async foo()
TUPLE_ACCESS_EXPR
Tuple access: a.0
DYNAMIC_CALL_EXPR
Dynamic call: Interface @ (target) :: function(args)
TYPE_PATH
Named/path type: Foo, foo::Bar
TYPE_PRIMITIVE
Primitive type: u32, bool, field, etc.
TYPE_LOCATOR
Locator type: program.aleo::Type
TYPE_ARRAY
Array type: [u32; 10]
TYPE_VECTOR
Vector type: [u32]
TYPE_TUPLE
Tuple type: (u32, u32)
TYPE_OPTIONAL
Optional type: u32? (Future feature)
TYPE_FINAL
Final type: Final<Foo>
TYPE_MAPPING
Mapping type in storage.
TYPE_DYN_RECORD
Dynamic record type: dyn record
PARENT_LIST
Parent list: Foo + Bar
Implementations§
Source§impl SyntaxKind
impl SyntaxKind
Sourcepub fn is_keyword(self) -> bool
pub fn is_keyword(self) -> bool
Check if this is a keyword.
Sourcepub fn is_type_keyword(self) -> bool
pub fn is_type_keyword(self) -> bool
Check if this is a type keyword.
Sourcepub fn is_literal(self) -> bool
pub fn is_literal(self) -> bool
Check if this is a literal token.
Sourcepub fn is_literal_node(self) -> bool
pub fn is_literal_node(self) -> bool
Check if this is a literal node kind.
Sourcepub fn is_expression(self) -> bool
pub fn is_expression(self) -> bool
Check if this is an expression node kind.
Sourcepub fn is_statement(self) -> bool
pub fn is_statement(self) -> bool
Check if this is a statement node kind.
Sourcepub fn is_punctuation(self) -> bool
pub fn is_punctuation(self) -> bool
Check if this is a punctuation token.
Sourcepub fn is_operator(self) -> bool
pub fn is_operator(self) -> bool
Check if this is an operator token.
Sourcepub fn user_friendly_name(self) -> &'static str
pub fn user_friendly_name(self) -> &'static str
Returns a user-friendly name for this token kind, suitable for error messages.
Trait Implementations§
Source§impl Clone for SyntaxKind
impl Clone for SyntaxKind
Source§fn clone(&self) -> SyntaxKind
fn clone(&self) -> SyntaxKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SyntaxKind
impl Debug for SyntaxKind
Source§impl From<SyntaxKind> for SyntaxKind
impl From<SyntaxKind> for SyntaxKind
Source§fn from(kind: SyntaxKind) -> Self
fn from(kind: SyntaxKind) -> Self
Source§impl Hash for SyntaxKind
impl Hash for SyntaxKind
Source§impl Ord for SyntaxKind
impl Ord for SyntaxKind
Source§fn cmp(&self, other: &SyntaxKind) -> Ordering
fn cmp(&self, other: &SyntaxKind) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for SyntaxKind
impl PartialEq for SyntaxKind
Source§impl PartialOrd for SyntaxKind
impl PartialOrd for SyntaxKind
impl Copy for SyntaxKind
impl Eq for SyntaxKind
impl StructuralPartialEq for SyntaxKind
Auto Trait Implementations§
impl Freeze for SyntaxKind
impl RefUnwindSafe for SyntaxKind
impl Send for SyntaxKind
impl Sync for SyntaxKind
impl Unpin for SyntaxKind
impl UnsafeUnpin for SyntaxKind
impl UnwindSafe for SyntaxKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more