enum CatspeakToken
enum CatspeakToken {
PAREN_LEFT,
PAREN_RIGHT,
BOX_LEFT,
BOX_RIGHT,
BRACE_LEFT,
BRACE_RIGHT,
COLON,
SEMICOLON,
COMMA,
DOT,
ARROW,
ASSIGN,
ASSIGN_MULTIPLY,
ASSIGN_DIVIDE,
ASSIGN_SUBTRACT,
ASSIGN_PLUS,
REMAINDER,
MULTIPLY,
DIVIDE,
DIVIDE_INT,
SUBTRACT,
PLUS,
EQUAL,
NOT_EQUAL,
GREATER,
GREATER_EQUAL,
LESS,
LESS_EQUAL,
NOT,
BITWISE_NOT,
SHIFT_RIGHT,
SHIFT_LEFT,
BITWISE_AND,
BITWISE_XOR,
BITWISE_OR,
AND,
OR,
XOR,
PIPE_RIGHT,
PIPE_LEFT,
DO,
IF,
ELSE,
WHILE,
FOR,
LOOP,
WITH,
MATCH,
LET,
FUN,
BREAK,
CONTINUE,
RETURN,
NEW,
IMPL,
SELF,
PARAMS,
IDENT,
VALUE,
WHITESPACE,
COMMENT,
EOF,
OTHER,
// 3 fields omitted
}
A token in Catspeak is a series of characters with meaning, usually
separated by whitespace. These meanings are represented by unique
elements of the CatspeakToken
enum.
Example
Some examples of tokens in Catspeak, and their meanings:
if
(is aCatspeakToken.IF
)else
(is aCatspeakToken.ELSE
)12.3
(is aCatspeakToken.VALUE
)+
(is aCatspeakToken.PLUS
)
§ PAREN_LEFT
PAREN_LEFT
The (
character.
§ PAREN_RIGHT
PAREN_RIGHT
The )
character.
§ BOX_LEFT
BOX_LEFT
The [
character.
§ BOX_RIGHT
BOX_RIGHT
The ]
character.
§ BRACE_LEFT
BRACE_LEFT
The {
character.
§ BRACE_RIGHT
BRACE_RIGHT
The }
character.
§ COLON
COLON
The :
character.
§ SEMICOLON
SEMICOLON
The ;
character.
§ COMMA
COMMA
The ,
character.
§ DOT
DOT
The .
operator.
§ ARROW
ARROW
The =>
operator.
§ ASSIGN
ASSIGN
The =
operator.
§ ASSIGN_MULTIPLY
ASSIGN_MULTIPLY
The *=
operator.
§ ASSIGN_DIVIDE
ASSIGN_DIVIDE
The /=
operator.
§ ASSIGN_SUBTRACT
ASSIGN_SUBTRACT
The -=
operator.
§ ASSIGN_PLUS
ASSIGN_PLUS
The +=
operator.
§ REMAINDER
REMAINDER
The remainder %
operator.
§ MULTIPLY
MULTIPLY
The *
operator.
§ DIVIDE
DIVIDE
The /
operator.
§ DIVIDE_INT
DIVIDE_INT
The integer division //
operator.
§ SUBTRACT
SUBTRACT
The -
operator.
§ PLUS
PLUS
The +
operator.
§ EQUAL
EQUAL
The relational ==
operator.
§ NOT_EQUAL
NOT_EQUAL
The relational !=
operator.
§ GREATER
GREATER
The relational >
operator.
§ GREATER_EQUAL
GREATER_EQUAL
The relational >=
operator.
§ LESS
LESS
The relational <
operator.
§ LESS_EQUAL
LESS_EQUAL
The relational <=
operator.
§ NOT
NOT
The logical negation !
operator.
§ BITWISE_NOT
BITWISE_NOT
The bitwise negation ~
operator.
§ SHIFT_RIGHT
SHIFT_RIGHT
The bitwise right shift >>
operator.
§ SHIFT_LEFT
SHIFT_LEFT
The bitwise left shift <<
operator.
§ BITWISE_AND
BITWISE_AND
The bitwise and &
operator.
§ BITWISE_XOR
BITWISE_XOR
The bitwise xor ^
operator.
§ BITWISE_OR
BITWISE_OR
The bitwise or |
operator.
§ AND
AND
The logical and
operator.
§ OR
OR
The logical or
operator.
§ XOR
XOR
The logical xor
operator.
§ PIPE_RIGHT
PIPE_RIGHT
The functional pipe right |>
operator.
§ PIPE_LEFT
PIPE_LEFT
The functional pipe left <|
operator.
§ DO
DO
The do
keyword.
§ IF
IF
The if
keyword.
§ ELSE
ELSE
The else
keyword.
§ WHILE
WHILE
The while
keyword.
§ FOR
FOR
🔬 This is an experimental feature. It may change at any moment.
The for
keyword.
§ LOOP
LOOP
🔬 This is an experimental feature. It may change at any moment.
The loop
keyword.
§ WITH
WITH
🔬 This is an experimental feature. It may change at any moment.
The with
keyword.
§ MATCH
MATCH
🔬 This is an experimental feature. It may change at any moment.
The match
keyword.
§ LET
LET
The let
keyword.
§ FUN
FUN
The fun
keyword.
§ BREAK
BREAK
The break
keyword.
§ CONTINUE
CONTINUE
The continue
keyword.
§ RETURN
RETURN
The return
keyword.
§ NEW
NEW
The new
keyword.
§ IMPL
IMPL
🔬 This is an experimental feature. It may change at any moment.
The impl
keyword.
§ SELF
SELF
🔬 This is an experimental feature. It may change at any moment.
The self
keyword.
§ PARAMS
PARAMS
🔬 This is an experimental feature. It may change at any moment.
The params
keyword.
§ IDENT
IDENT
Represents a variable name.
§ VALUE
VALUE
Represents a GML value. This could be one of:
string literal:
"hello world"
verbatim literal:
@"\(0_0)/ no escapes!"
integer:
1
,2
,5
float:
1.25
,0.5
character:
'A'
,'0'
,'\n'
boolean:
true
orfalse
undefined
§ WHITESPACE
WHITESPACE
Represents a sequence of non-breaking whitespace characters.
§ COMMENT
COMMENT
Represents a comment.
§ EOF
EOF
Represents the end of the file.
§ OTHER
OTHER
Represents any other unrecognised character.
📝 NoteIf the compiler encounters a token of this type, it will typical raise an exception. This likely indicates that a Catspeak script has a syntax error somewhere.