[refactoring] use position.Position to store token position

This commit is contained in:
Vadym Slizov
2020-05-17 23:50:23 +03:00
parent f4c15f4671
commit e98607f5d0
7 changed files with 646 additions and 634 deletions

View File

@@ -7,7 +7,6 @@ import (
"github.com/z7zmey/php-parser/internal/scanner"
"github.com/z7zmey/php-parser/pkg/ast"
"github.com/z7zmey/php-parser/pkg/errors"
"github.com/z7zmey/php-parser/pkg/position"
"github.com/z7zmey/php-parser/pkg/token"
)
@@ -43,14 +42,9 @@ func (l *Parser) Lex(lval *yySymType) int {
}
func (l *Parser) Error(msg string) {
pos := &position.Position{
StartLine: l.currentToken.StartLine,
EndLine: l.currentToken.EndLine,
StartPos: l.currentToken.StartPos,
EndPos: l.currentToken.EndPos,
}
var pos = l.currentToken.Position
l.Lexer.AddError(errors.NewError(msg, pos))
l.Lexer.AddError(errors.NewError(msg, &pos))
}
func (l *Parser) WithTokens() {