init + lexer
This commit is contained in:
commit
9bebc6e307
5 changed files with 493 additions and 0 deletions
61
tokentype_string.go
Normal file
61
tokentype_string.go
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
// Code generated by "stringer -type tokenType -linecomment -trimprefix tokenType"; DO NOT EDIT.
|
||||
|
||||
package main
|
||||
|
||||
import "strconv"
|
||||
|
||||
func _() {
|
||||
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||
// Re-run the stringer command to generate them again.
|
||||
var x [1]struct{}
|
||||
_ = x[tokenTypeLeftParen-0]
|
||||
_ = x[tokenTypeRightParen-1]
|
||||
_ = x[tokenTypeLeftBrace-2]
|
||||
_ = x[tokenTypeRightBrace-3]
|
||||
_ = x[tokenTypeComma-4]
|
||||
_ = x[tokenTypeDot-5]
|
||||
_ = x[tokenTypeMinus-6]
|
||||
_ = x[tokenTypePlus-7]
|
||||
_ = x[tokenTypeSemicolon-8]
|
||||
_ = x[tokenTypeSlash-9]
|
||||
_ = x[tokenTypeStar-10]
|
||||
_ = x[tokenTypeBang-11]
|
||||
_ = x[tokenTypeBangEq-12]
|
||||
_ = x[tokenTypeEqual-13]
|
||||
_ = x[tokenTypeEqualEqual-14]
|
||||
_ = x[tokenTypeGreater-15]
|
||||
_ = x[tokenTypeGreaterEq-16]
|
||||
_ = x[tokenTypeLess-17]
|
||||
_ = x[tokenTypeLessEq-18]
|
||||
_ = x[tokenTypeIdentifier-19]
|
||||
_ = x[tokenTypeString-20]
|
||||
_ = x[tokenTypeNumber-21]
|
||||
_ = x[tokenTypeAnd-22]
|
||||
_ = x[tokenTypeClass-23]
|
||||
_ = x[tokenTypeElse-24]
|
||||
_ = x[tokenTypeFalse-25]
|
||||
_ = x[tokenTypeFun-26]
|
||||
_ = x[tokenTypeFor-27]
|
||||
_ = x[tokenTypeIf-28]
|
||||
_ = x[tokenTypeNil-29]
|
||||
_ = x[tokenTypeOr-30]
|
||||
_ = x[tokenTypePrint-31]
|
||||
_ = x[tokenTypeReturn-32]
|
||||
_ = x[tokenTypeSuper-33]
|
||||
_ = x[tokenTypeThis-34]
|
||||
_ = x[tokenTypeTrue-35]
|
||||
_ = x[tokenTypeVar-36]
|
||||
_ = x[tokenTypeWhile-37]
|
||||
_ = x[tokenTypeEOF-38]
|
||||
}
|
||||
|
||||
const _tokenType_name = "LeftParenRightParenLeftBraceRightBraceCommaDotMinusPlusSemicolonSlashStarBangBangEqEqualEqualEqualGreaterGreaterEqLessLessEqIdentifierStringNumberAndClassElseFalseFunForIfNilOrPrintReturnSuperThisTrueVarWhileEOF"
|
||||
|
||||
var _tokenType_index = [...]uint8{0, 9, 19, 28, 38, 43, 46, 51, 55, 64, 69, 73, 77, 83, 88, 98, 105, 114, 118, 124, 134, 140, 146, 149, 154, 158, 163, 166, 169, 171, 174, 176, 181, 187, 192, 196, 200, 203, 208, 211}
|
||||
|
||||
func (i tokenType) String() string {
|
||||
if i < 0 || i >= tokenType(len(_tokenType_index)-1) {
|
||||
return "tokenType(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
return _tokenType_name[_tokenType_index[i]:_tokenType_index[i+1]]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue