refactor: move php7 scanner into php7 package

This commit is contained in:
Laytan Laats
2023-03-25 15:02:34 +01:00
parent a97686125d
commit 74a8771740
17 changed files with 261 additions and 267 deletions

View File

@@ -3,8 +3,8 @@ package tester
import (
"testing"
"github.com/VKCOM/php-parser/internal/php7"
"github.com/VKCOM/php-parser/internal/php8"
"github.com/VKCOM/php-parser/internal/scanner"
"github.com/VKCOM/php-parser/pkg/conf"
"github.com/VKCOM/php-parser/pkg/token"
"github.com/VKCOM/php-parser/pkg/version"
@@ -46,7 +46,7 @@ func (l *LexerTokenFreeFloatingTestSuite) Run() {
var lexer Lexer
if l.Version.Less(&version.Version{Major: 8, Minor: 0}) {
lexer = scanner.NewLexer([]byte(l.Code), config)
lexer = php7.NewLexer([]byte(l.Code), config)
} else {
lexer = php8.NewLexer([]byte(l.Code), config)
}

View File

@@ -4,7 +4,7 @@ import (
"testing"
"github.com/VKCOM/php-parser/internal/php8"
"github.com/VKCOM/php-parser/internal/scanner"
"github.com/VKCOM/php-parser/internal/php7"
"github.com/VKCOM/php-parser/pkg/conf"
"github.com/VKCOM/php-parser/pkg/version"
"gotest.tools/assert"
@@ -41,7 +41,7 @@ func (l *LexerTokenStringTestSuite) Run() {
var lexer Lexer
if l.Version.Less(&version.Version{Major: 8, Minor: 0}) {
lexer = scanner.NewLexer([]byte(l.Code), config)
lexer = php7.NewLexer([]byte(l.Code), config)
} else {
lexer = php8.NewLexer([]byte(l.Code), config)
}

View File

@@ -4,7 +4,7 @@ import (
"testing"
"github.com/VKCOM/php-parser/internal/php8"
"github.com/VKCOM/php-parser/internal/scanner"
"github.com/VKCOM/php-parser/internal/php7"
"github.com/VKCOM/php-parser/pkg/conf"
"github.com/VKCOM/php-parser/pkg/token"
"github.com/VKCOM/php-parser/pkg/version"
@@ -53,7 +53,7 @@ func (l *LexerTokenStructTestSuite) Run() {
var lexer Lexer
if l.Version.Less(&version.Version{Major: 8, Minor: 0}) {
lexer = scanner.NewLexer([]byte(l.Code), config)
lexer = php7.NewLexer([]byte(l.Code), config)
} else {
lexer = php8.NewLexer([]byte(l.Code), config)
}

View File

@@ -49,6 +49,8 @@ func (p *ParserDumpTestSuite) UsePHP8() {
}
func (p *ParserDumpTestSuite) Run() {
p.t.Helper()
config := conf.Config{
Version: &p.Version,
}