Enum hematita::ast::lexer::Token[][src]

pub enum Token {
Show 57 variants Comment(String), Identifier(String), Integer(i64), String(String), LiteralTrue, LiteralFalse, LiteralNil, Add, Minus, Multiply, Divide, FloorDivide, Modulo, Exponent, BitwiseAnd, BitwiseOr, BitwiseNotOrXOr, ShiftLeft, ShiftRight, Equal, NotEqual, LessThan, LessThanOrEqual, GreaterThan, GreaterThanOrEqual, Assign, Colon, Comma, Period, SemiColon, Concat, Length, OpenParen, CloseParen, OpenCurly, CloseCurly, OpenBracket, CloseBracket, KeywordAnd, KeywordBreak, KeywordDo, KeywordElse, KeywordElseIf, KeywordEnd, KeywordFor, KeywordFunction, KeywordGoto, KeywordIf, KeywordIn, KeywordLocal, KeywordNot, KeywordOr, KeywordRepeat, KeywordReturn, KeywordThen, KeywordUntil, KeywordWhile,
}
Expand description

A single syntactical unit of Lua code.

Represents identifiers, punctuation, and everythign in between.

Variants

Comment

A Lua comment. May or may not include new lines.

Example

-- Hello world!
--[[
	I am a multiline comment,
	and you are a cutie.
]]

Tuple Fields of Comment

0: String
Identifier

An identifier, excluding keywords.

Example

Valid Identifiers

  • whatLanguageDo
  • you_like_better
  • __luaOr_rust12345

Invalid Identifiers

  • 69imMatureIPromise - Cannot start with a digit
  • what_am!i_supposed - Includes a non word character
  • toWriteHere我不知道 - Includes non latin characters

Tuple Fields of Identifier

0: String
Integer

An integer.

Tuple Fields of Integer

0: i64
String

A string.

Example

Valid Strings

  • "\tPerhaps, I should reference a song?\n"
  • 'All my life I\'ve drowned in adrenaline\nNow my blood runs slow like a seditive'
  • [[Good song? No? Damn. :( \t\y\e\x\\stuff\vr"""')]]
  • [===[[[ ]] ]=====] OH BTW THOSE LYRICS ARE NOT LICENSED]===]

Invalid Strings

  • "I could just write what the error is in here' - Mismatched quotation
  • 'but instead i choose to write this \y' - Invalid escape sequence
  • [===[everybody asks what the coder doin
    but nobody asks how is the coder doin]] - Mismatched braces

Tuple Fields of String

0: String
LiteralTrue

The true keyword.

LiteralFalse

The false keyword.

LiteralNil

The nil keyword.

Add

The + symbol.

Minus

The - symbol.

Multiply

The * symbol.

Divide

The / symbol.

FloorDivide

The // symbol.

Modulo

The % symbol.

Exponent

The ^ symbol.

BitwiseAnd

The & symbol.

BitwiseOr

The | symbol.

BitwiseNotOrXOr

The ~ symbol.

ShiftLeft

The << symbol.

ShiftRight

The >> symbol.

Equal

The == symbol.

NotEqual

The ~= symbol.

LessThan

The < symbol.

LessThanOrEqual

The <= symbol.

GreaterThan

The > symbol.

GreaterThanOrEqual

The >= symbol.

Assign

The = symbol.

Colon

The : symbol.

Comma

The , symbol.

Period

The . symbol.

SemiColon

The ; symbol.

Concat

The .. symbol.

Length

The # symbol.

OpenParen

The ( symbol.

CloseParen

The ) symbol.

OpenCurly

The { symbol.

CloseCurly

The } symbol.

OpenBracket

The [ symbol.

CloseBracket

The ] symbol.

KeywordAnd

The and keyword.

KeywordBreak

The break keyword.

KeywordDo

The do keyword.

KeywordElse

The else keyword.

KeywordElseIf

The elseif keyword.

KeywordEnd

The end keyword.

KeywordFor

The for keyword.

KeywordFunction

The function keyword.

KeywordGoto

The goto keyword.

KeywordIf

The if keyword.

KeywordIn

The in keyword.

KeywordLocal

The local keyword.

KeywordNot

The not keyword.

KeywordOr

The or keyword.

KeywordRepeat

The repeat keyword.

KeywordReturn

The return keyword.

KeywordThen

The then keyword.

KeywordUntil

The until keyword.

KeywordWhile

The while keyword.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.