pub enum TokenKind {
Show 48 variants
Ident(String),
Const,
Input,
Extern,
Shared,
Volatile,
Cursor,
Over,
Pragma,
For(String),
Tile,
TileBody(String, TileBodyKind),
Dot,
IntLit(u64),
FloatLit(f64),
StringLit(String),
ColonEq,
Eq,
LParen,
RParen,
LBracket,
RBracket,
LBrace,
RBrace,
Comma,
Colon,
Arrow,
Plus,
Minus,
Star,
Slash,
Percent,
Caret,
StarStar,
ShiftLeft,
ShiftRight,
Ampersand,
AmpAmp,
Pipe,
PipePipe,
Bang,
Lt,
Gt,
EqEq,
BangEq,
LtEq,
GtEq,
Eof,
}Expand description
The kinds of token the lexer produces.
Variants§
Ident(String)
A bare identifier: cycle, hash, temp_lut
Const
const keyword — declares an effectively-const binding.
Replaces the former final / init distinction; both
surfaces collapsed into one. The value is materialized at
the earliest opportunity (compile-time fold if possible,
scope-init pull otherwise) and is then immutable for the
scope’s lifetime. Independent of provenance: a const
binding’s RHS may reference workload params, iter-vars
bound by an enclosing comprehension, or other in-scope
names — whatever the Polydat compiler can resolve.
Input
input keyword — declares one per-cycle kernel input slot.
Surface: input <name>[: <type>] (single) or
input (<name>[: <type>], ...) (tuple sugar). Mirrors the
module-signature param-list shape.
Extern
extern keyword
shared keyword
Volatile
volatile keyword. Wire-coloring modifier excluding the
binding’s value from hash_const.
Cursor
cursor keyword
Over
over keyword — SRD 71 partition-source binding on
cursor declarations: cursor q = range(0, N) over p.
Soft keyword: only recognised at statement level after
a cursor decl’s constructor expression; in expression
position it’s a plain identifier.
Pragma
pragma keyword (module-level directive opening, SRD 15
§“Module-Level Pragmas”). Followed by an Ident naming the
pragma. Distinct from line comments so the parser sees
pragmas as first-class statements rather than scraping them
out of // @pragma: text.
For(String)
for followed by its raw comprehension text (SRD 113). The
lexer captures everything after the keyword up to a { at
nesting depth zero or the end of the line, whichever comes
first, so the comprehension grammar stays owned by the
comprehension parser rather than being re-tokenized here.
Tile
tile keyword (SRD 114). The body after := is captured raw
into a TokenKind::TileBody when it is a block or heredoc.
TileBody(String, TileBodyKind)
A raw tile body and how it was written.
Dot
. (field access: base.ordinal)
IntLit(u64)
Integer literal: 1000, 0xFF
FloatLit(f64)
Float literal: 72.0, 3.14
StringLit(String)
String literal (contents only, no quotes): "hello {name}"
ColonEq
:= (binding operator, used by every binding shape:
cycle bindings, const, shared, volatile)
Eq
= — the extern default (extern name: type = default)
and the cursor declaration (cursor name = expr); bindings
use :=.
LParen
(
RParen
)
LBracket
[
RBracket
]
LBrace
{
RBrace
}
Comma
,
Colon
:
Arrow
->
Plus
+
Minus
- (both binary subtract and unary negate)
Star
*
Slash
/
Percent
%
Caret
^ (bitwise XOR)
StarStar
** (power)
ShiftLeft
<< (shift left)
ShiftRight
>> (shift right)
Ampersand
& (bitwise AND)
AmpAmp
&& (logical AND — SRD-84 Part 1)
Pipe
| (bitwise OR)
PipePipe
|| (logical OR — SRD-84 Part 1)
Bang
! (unary bitwise NOT)
Lt
< (less-than comparison)
Gt
> (greater-than comparison)
EqEq
== (equal-to comparison)
BangEq
!= (not-equal-to comparison)
LtEq
<= (less-than-or-equal comparison)
GtEq
>= (greater-than-or-equal comparison)
Eof
End of input
Trait Implementations§
impl StructuralPartialEq for TokenKind
Auto Trait Implementations§
impl Freeze for TokenKind
impl RefUnwindSafe for TokenKind
impl Send for TokenKind
impl Sync for TokenKind
impl Unpin for TokenKind
impl UnsafeUnpin for TokenKind
impl UnwindSafe for TokenKind
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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