rename lastToken to currentToken
This commit is contained in:
parent
435dc5c706
commit
a28fd2e8ec
@ -18,7 +18,7 @@ func (lval *yySymType) Token(t *scanner.Token) {
|
||||
type Parser struct {
|
||||
*scanner.Lexer
|
||||
path string
|
||||
lastToken *scanner.Token
|
||||
currentToken *scanner.Token
|
||||
positionBuilder *parser.PositionBuilder
|
||||
errors []*errors.Error
|
||||
rootNode node.Node
|
||||
@ -45,12 +45,12 @@ func NewParser(src io.Reader, path string) *Parser {
|
||||
// Lex proxy to lexer Lex
|
||||
func (l *Parser) Lex(lval *yySymType) int {
|
||||
t := l.Lexer.Lex(lval)
|
||||
l.lastToken = lval.token
|
||||
l.currentToken = lval.token
|
||||
return t
|
||||
}
|
||||
|
||||
func (l *Parser) Error(msg string) {
|
||||
l.errors = append(l.errors, errors.NewError(msg, l.lastToken))
|
||||
l.errors = append(l.errors, errors.NewError(msg, l.currentToken))
|
||||
}
|
||||
|
||||
// Parse the php7 Parser entrypoint
|
||||
|
@ -18,7 +18,7 @@ func (lval *yySymType) Token(t *scanner.Token) {
|
||||
type Parser struct {
|
||||
*scanner.Lexer
|
||||
path string
|
||||
lastToken *scanner.Token
|
||||
currentToken *scanner.Token
|
||||
positionBuilder *parser.PositionBuilder
|
||||
errors []*errors.Error
|
||||
rootNode node.Node
|
||||
@ -45,12 +45,12 @@ func NewParser(src io.Reader, path string) *Parser {
|
||||
// Lex proxy to lexer Lex
|
||||
func (l *Parser) Lex(lval *yySymType) int {
|
||||
t := l.Lexer.Lex(lval)
|
||||
l.lastToken = lval.token
|
||||
l.currentToken = lval.token
|
||||
return t
|
||||
}
|
||||
|
||||
func (l *Parser) Error(msg string) {
|
||||
l.errors = append(l.errors, errors.NewError(msg, l.lastToken))
|
||||
l.errors = append(l.errors, errors.NewError(msg, l.currentToken))
|
||||
}
|
||||
|
||||
// Parse the php7 Parser entrypoint
|
||||
|
Loading…
Reference in New Issue
Block a user