pub enum SyntaxKind {
Show 180 variants
ERROR = 0,
EOF,
WHITESPACE,
LINEBREAK,
COMMENT_LINE,
COMMENT_BLOCK,
INTEGER,
STRING,
ADDRESS_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_FUTURE,
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_FUNCTION,
KW_TRANSITION,
KW_INLINE,
KW_ASYNC,
KW_FN,
KW_STRUCT,
KW_CONSTRUCTOR,
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,
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,
CONSTRUCTOR_DEF,
STRUCT_DEF,
RECORD_DEF,
STRUCT_MEMBER,
MAPPING_DEF,
STORAGE_DEF,
GLOBAL_CONST,
ANNOTATION,
PARAM,
PARAM_LIST,
RETURN_TYPE,
CONST_PARAM,
CONST_PARAM_LIST,
CONST_ARG_LIST,
LET_STMT,
CONST_STMT,
RETURN_STMT,
EXPR_STMT,
ASSIGN_STMT,
IF_STMT,
FOR_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_FIELD_INIT,
PATH_EXPR,
PAREN_EXPR,
LITERAL,
REPEAT_EXPR,
ASYNC_EXPR,
ASSOC_FN_EXPR,
ASSOC_CONST_EXPR,
LOCATOR_EXPR,
TUPLE_ACCESS_EXPR,
INTRINSIC_EXPR,
UNIT_EXPR,
TYPE_PATH,
TYPE_ARRAY,
TYPE_TUPLE,
TYPE_OPTIONAL,
TYPE_FUTURE,
TYPE_MAPPING,
ARG_LIST,
NAME_REF,
NAME,
VISIBILITY,
// 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
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_FUTURE
Future
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_FUNCTION
function
KW_TRANSITION
transition
KW_INLINE
inline
KW_ASYNC
async
KW_FN
Fn
KW_STRUCT
struct
KW_CONSTRUCTOR
constructor
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
..
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.
CONSTRUCTOR_DEF
Constructor definition.
STRUCT_DEF
Struct definition.
RECORD_DEF
Record definition.
STRUCT_MEMBER
Struct member declaration.
MAPPING_DEF
Mapping definition.
STORAGE_DEF
Storage definition.
GLOBAL_CONST
Global constant definition.
ANNOTATION
Annotation: @foo
PARAM
Parameter in a function signature.
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.
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 = ...;
IF_STMT
If statement: if ... { } else { }
FOR_STMT
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_FIELD_INIT
Struct field initializer: a: 1
PATH_EXPR
Path expression: foo::bar
PAREN_EXPR
Parenthesized expression: (a + b)
LITERAL
Literal expression (wraps INTEGER, STRING, ADDRESS_LIT, or keywords).
REPEAT_EXPR
Repeat expression: [0u8; 32]
ASYNC_EXPR
Async expression: async foo()
ASSOC_FN_EXPR
Associated function call: Foo::bar()
ASSOC_CONST_EXPR
Associated constant: Foo::BAR
LOCATOR_EXPR
Locator expression: foo.aleo/bar
TUPLE_ACCESS_EXPR
Tuple access: a.0
INTRINSIC_EXPR
Intrinsic expression: _foo()
UNIT_EXPR
Unit expression: ()
TYPE_PATH
Named/path type: u32, Foo, foo::Bar
TYPE_ARRAY
Array type: [u32; 10]
TYPE_TUPLE
Tuple type: (u32, u32)
TYPE_OPTIONAL
Optional type: u32? (Future feature)
TYPE_FUTURE
Future type: Future<Foo>
TYPE_MAPPING
Mapping type in storage.
ARG_LIST
Argument list: (a, b, c)
NAME_REF
Name reference (identifier in expression context).
NAME
Name definition (identifier in binding context).
VISIBILITY
Visibility modifier: public, private
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_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.
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