const TokenType = {
kEOF: "end of file",
kError: "error",
kIdentifier: "identifier",
kIntegerLiteral: "integer_literal",
kFloatLiteral: "float_literal",
kStringLiteral: "string_literal",
kResultId: "result_id",
kOp: "Op",
kEqual: "=",
kPipe: "|",
};
class Token {
* @param {TokenType} type The type of token
* @param {Integer} line The line number this token was on
* @param {Any} data Data attached to the token
* @param {Integer} bits If the type is a float or integer the bit width
*/
constructor(type, line, data) {
this.type_ = type;
this.line_ = line;
this.data_ = data;
this.bits_ = 0;
}
get type() { return this.type_; }
get line() { return this.line_; }
get data() { return this.data_; }
set data(val) { this.data_ = val; }
get bits() { return this.bits_; }
set bits(val) { this.bits_ = val; }
}
export {Token, TokenType};