pub enum AtomicKind {
Int,
UInt,
Float,
Byte,
Char,
Digit,
Word,
Identifier,
Text,
Rest,
}Expand description
One of the atomic parsers (§7.4).
§7.4’s list is closed, and this is all ten of it. A name the design document requires but this enum omits gets “unknown atomic parser”.
Variants§
Int
Signed decimal integer → Int.
UInt
Non-negative decimal integer → Int.
Int, not ScalarType::UInt. UInt is reserved and has no runtime
object at all: praxis-repr answers NoRuntimeRepr for it, and a JIT
compile fails when a descriptor is missing — so a uint capture typed
UInt would make every program containing one fail to compile. The
non-negativity is enforced by the parse rule (a leading - is
refused), which is what §7.4 asks for.
Float
Decimal floating-point number → Float.
Byte
A decimal integer in 0..=255 → Byte.
A decimal integer and not a raw input byte: a raw byte cannot be
re-sliced as Text without breaking the UTF-8 invariant every
source-slice Text relies on.
Char
One Unicode scalar value → Char.
Digit
One decimal digit → Int.
Word
Non-empty run excluding whitespace and parser-delimiter punctuation → Text.
Identifier
An identifier run → Text.
§7.4 says “ASCII-like identifier syntax by default”; this uses §4.1’s
one identifier class (praxis_syntax::ident), which is a deliberate
widening. A parser that accepted a narrower set of names than the
language itself does would refuse identifiers a Praxis program can
declare, and the workspace keeps exactly one copy of that rule.
Text
Minimally consumes text until the following template literal can match → Text.
Rest
The remainder of the current region → Text.
Implementations§
Source§impl AtomicKind
impl AtomicKind
Sourcepub const ALL: &'static [AtomicKind]
pub const ALL: &'static [AtomicKind]
Every atomic, in §7.4’s order. The list is closed: a test sweeps it, so a new atomic cannot be added without a type and a runtime rule.
Sourcepub fn keyword(self) -> &'static str
pub fn keyword(self) -> &'static str
The source keyword for this atomic.
The only place these ten strings are spelled. Completion labels,
hover, and the runtime’s expected … parse-fault names all read them
from here, so a second copy cannot drift into naming two atomics the
same.
Sourcepub fn doc(self) -> &'static str
pub fn doc(self) -> &'static str
One line per atomic, for hover. Exhaustive, for the reason
Constructor::doc is.
Sourcepub fn from_keyword(name: &str) -> Option<Self>
pub fn from_keyword(name: &str) -> Option<Self>
Parse an atomic name into its kind, or None if unknown.
Trait Implementations§
Source§impl Clone for AtomicKind
impl Clone for AtomicKind
Source§fn clone(&self) -> AtomicKind
fn clone(&self) -> AtomicKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more