@@ -83,7 +83,7 @@ func (l *Lexer) EatDelim(d rune) error {
8383
8484func (l * Lexer ) EatIntConstant () (int32 , error ) {
8585 if ok := l .MatchIntConstant (); ! ok {
86- return 0 , fmt .Errorf ("tried to eat int token(%v), but got other token type(%v)" , tokenInt , l .currentTokenType )
86+ return 0 , fmt .Errorf ("tried to eat int token(%v), but got other token type(%v) with input '%v' " , tokenInt , l .currentTokenType , l . input )
8787 }
8888 retval , err := strconv .Atoi (l .currentToken )
8989 if err != nil {
@@ -100,7 +100,7 @@ func (l *Lexer) EatIntConstant() (int32, error) {
100100
101101func (l * Lexer ) EatStringConstant () (string , error ) {
102102 if ok := l .MatchStringConstant (); ! ok {
103- return "" , fmt .Errorf ("tried to eat string token(%v), but got other token type(%v)" , tokenString , l .currentTokenType )
103+ return "" , fmt .Errorf ("tried to eat string token(%v), but got other token type(%v) with input '%v' " , tokenString , l .currentTokenType , l . input )
104104 }
105105 retval := l .currentToken
106106 err := l .extractToken ()
@@ -116,7 +116,7 @@ func (l *Lexer) EatStringConstant() (string, error) {
116116func (l * Lexer ) EatKeyword (keyword string ) error {
117117 keyword = strings .ToLower (keyword )
118118 if ok := l .MatchKeyword (keyword ); ! ok {
119- return fmt .Errorf ("tried to eat string token(%v), but got other token type(%v)" , tokenKeyword , l .currentTokenType )
119+ return fmt .Errorf ("tried to eat string token(%v), but got other token type(%v) with input '%v' " , tokenKeyword , l .currentTokenType , l . input )
120120 }
121121 if keyword != strings .ToLower (l .currentToken ) {
122122 return fmt .Errorf ("expected keyword is %v, but got %v" , keyword , l .currentToken )
@@ -132,7 +132,7 @@ func (l *Lexer) EatKeyword(keyword string) error {
132132
133133func (l * Lexer ) EatId () (string , error ) {
134134 if ok := l .MatchId (); ! ok {
135- return "" , fmt .Errorf ("tried to eat string token(%v), but got other token type(%v)" , tokenIdentifier , l .currentTokenType )
135+ return "" , fmt .Errorf ("tried to eat string token(%v), but got other token type(%v) with input '%v' " , tokenIdentifier , l .currentTokenType , l . input )
136136 }
137137 retval := l .currentToken
138138 err := l .extractToken ()
@@ -291,7 +291,7 @@ func isAllowedSymbol(ch rune) bool {
291291func isIdentChar (ch rune ) bool {
292292 isDigit := isDigitChar (ch )
293293 isChar := isChar (ch )
294- return isDigit || isChar
294+ return isDigit || isChar || ch == '_'
295295}
296296
297297func isIdentStart (ch rune ) bool {
0 commit comments