wrote dsl for ast boiler plate generation
This commit is contained in:
parent
b244f7e3b2
commit
e0dd8ff9d5
16 changed files with 915 additions and 60 deletions
61
lexer/tokentype_string.go
Normal file
61
lexer/tokentype_string.go
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
// Code generated by "stringer -type TokenType -linecomment -trimprefix TokenType"; DO NOT EDIT.
|
||||
|
||||
package lexer
|
||||
|
||||
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