pub enum Literal {
Integer(LitInt),
Float(LitFloat),
Radix(LitRadix),
Boolean(LitBool),
Symbol(LitSym),
Unit(LitUnit),
List(LitList),
ListRepeat(LitListRepeat),
}Expand description
Represents a literal value in CalcScript.
A literal is any value that can is written directly into the source code. For example, the
number 1 is a literal (it is currently the only literal type supported by CalcScript).
Variants§
Integer(LitInt)
An integer literal.
Float(LitFloat)
A floating-point literal.
Radix(LitRadix)
A number written in radix notation. Radix notation allows users to express integers in a base other than base 10.
Boolean(LitBool)
A boolean literal, either true or false.
Symbol(LitSym)
A symbol / identifier literal. Symbols are used to represent variables and functions.
Unit(LitUnit)
The unit type, written as (). The unit type is by-default returned by functions that do
not return a value.
List(LitList)
The list type, consisting of a list of expressions surrounded by square brackets and
delimited by commas: [expr1, expr2, ...].
ListRepeat(LitListRepeat)
The list type, formed by repeating the given expression n times: [expr; n].
Implementations§
Trait Implementations§
Source§impl Latex for Literal
impl Latex for Literal
Source§fn as_display(&self) -> LatexFormatter<'_, Self>
fn as_display(&self) -> LatexFormatter<'_, Self>
LatexFormatter, which implements Display.