refactor!: drop php5 support
This commit is contained in:
@@ -3,10 +3,8 @@ package parser
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/VKCOM/php-parser/internal/php5"
|
||||
"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/ast"
|
||||
"github.com/VKCOM/php-parser/pkg/conf"
|
||||
"github.com/VKCOM/php-parser/pkg/version"
|
||||
@@ -16,9 +14,6 @@ var (
|
||||
// ErrVersionOutOfRange is returned if the version is not supported
|
||||
ErrVersionOutOfRange = errors.New("the version is out of supported range")
|
||||
|
||||
php5RangeStart = &version.Version{Major: 5}
|
||||
php5RangeEnd = &version.Version{Major: 5, Minor: 6}
|
||||
|
||||
php7RangeStart = &version.Version{Major: 7}
|
||||
php7RangeEnd = &version.Version{Major: 7, Minor: 4}
|
||||
|
||||
@@ -39,15 +34,8 @@ func Parse(src []byte, config conf.Config) (ast.Vertex, error) {
|
||||
config.Version = php7RangeEnd
|
||||
}
|
||||
|
||||
if config.Version.InRange(php5RangeStart, php5RangeEnd) {
|
||||
lexer := scanner.NewLexer(src, config)
|
||||
parser = php5.NewParser(lexer, config)
|
||||
parser.Parse()
|
||||
return parser.GetRootNode(), nil
|
||||
}
|
||||
|
||||
if config.Version.InRange(php7RangeStart, php7RangeEnd) {
|
||||
lexer := scanner.NewLexer(src, config)
|
||||
lexer := php7.NewLexer(src, config)
|
||||
parser = php7.NewParser(lexer, config)
|
||||
parser.Parse()
|
||||
return parser.GetRootNode(), nil
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user