rename package cfg to conf
This commit is contained in:
parent
9d12f1d162
commit
367eff9de6
@ -18,7 +18,7 @@ import (
|
|||||||
"github.com/yookoala/realpath"
|
"github.com/yookoala/realpath"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/pkg/ast"
|
"github.com/z7zmey/php-parser/pkg/ast"
|
||||||
"github.com/z7zmey/php-parser/pkg/cfg"
|
"github.com/z7zmey/php-parser/pkg/conf"
|
||||||
"github.com/z7zmey/php-parser/pkg/errors"
|
"github.com/z7zmey/php-parser/pkg/errors"
|
||||||
"github.com/z7zmey/php-parser/pkg/parser"
|
"github.com/z7zmey/php-parser/pkg/parser"
|
||||||
"github.com/z7zmey/php-parser/pkg/version"
|
"github.com/z7zmey/php-parser/pkg/version"
|
||||||
@ -138,7 +138,7 @@ func parserWorker(fileCh <-chan *file, r chan<- result) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var parserErrors []*errors.Error
|
var parserErrors []*errors.Error
|
||||||
rootNode, err := parser.Parse(f.content, cfg.Config{
|
rootNode, err := parser.Parse(f.content, conf.Config{
|
||||||
Version: phpVersion,
|
Version: phpVersion,
|
||||||
ErrorHandlerFunc: func(e *errors.Error) {
|
ErrorHandlerFunc: func(e *errors.Error) {
|
||||||
parserErrors = append(parserErrors, e)
|
parserErrors = append(parserErrors, e)
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"github.com/z7zmey/php-parser/internal/position"
|
"github.com/z7zmey/php-parser/internal/position"
|
||||||
"github.com/z7zmey/php-parser/internal/scanner"
|
"github.com/z7zmey/php-parser/internal/scanner"
|
||||||
"github.com/z7zmey/php-parser/pkg/ast"
|
"github.com/z7zmey/php-parser/pkg/ast"
|
||||||
"github.com/z7zmey/php-parser/pkg/cfg"
|
"github.com/z7zmey/php-parser/pkg/conf"
|
||||||
"github.com/z7zmey/php-parser/pkg/errors"
|
"github.com/z7zmey/php-parser/pkg/errors"
|
||||||
"github.com/z7zmey/php-parser/pkg/token"
|
"github.com/z7zmey/php-parser/pkg/token"
|
||||||
)
|
)
|
||||||
@ -19,7 +19,7 @@ type Parser struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewParser creates and returns new Parser
|
// NewParser creates and returns new Parser
|
||||||
func NewParser(lexer *scanner.Lexer, config cfg.Config) *Parser {
|
func NewParser(lexer *scanner.Lexer, config conf.Config) *Parser {
|
||||||
return &Parser{
|
return &Parser{
|
||||||
Lexer: lexer,
|
Lexer: lexer,
|
||||||
errHandlerFunc: config.ErrorHandlerFunc,
|
errHandlerFunc: config.ErrorHandlerFunc,
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/z7zmey/php-parser/internal/php5"
|
"github.com/z7zmey/php-parser/internal/php5"
|
||||||
"github.com/z7zmey/php-parser/internal/scanner"
|
"github.com/z7zmey/php-parser/internal/scanner"
|
||||||
"github.com/z7zmey/php-parser/pkg/cfg"
|
"github.com/z7zmey/php-parser/pkg/conf"
|
||||||
"github.com/z7zmey/php-parser/pkg/version"
|
"github.com/z7zmey/php-parser/pkg/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ func BenchmarkPhp5(b *testing.B) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 5,
|
Major: 5,
|
||||||
Minor: 6,
|
Minor: 6,
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"github.com/z7zmey/php-parser/internal/position"
|
"github.com/z7zmey/php-parser/internal/position"
|
||||||
"github.com/z7zmey/php-parser/internal/scanner"
|
"github.com/z7zmey/php-parser/internal/scanner"
|
||||||
"github.com/z7zmey/php-parser/pkg/ast"
|
"github.com/z7zmey/php-parser/pkg/ast"
|
||||||
"github.com/z7zmey/php-parser/pkg/cfg"
|
"github.com/z7zmey/php-parser/pkg/conf"
|
||||||
"github.com/z7zmey/php-parser/pkg/errors"
|
"github.com/z7zmey/php-parser/pkg/errors"
|
||||||
"github.com/z7zmey/php-parser/pkg/token"
|
"github.com/z7zmey/php-parser/pkg/token"
|
||||||
)
|
)
|
||||||
@ -19,7 +19,7 @@ type Parser struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewParser creates and returns new Parser
|
// NewParser creates and returns new Parser
|
||||||
func NewParser(lexer *scanner.Lexer, config cfg.Config) *Parser {
|
func NewParser(lexer *scanner.Lexer, config conf.Config) *Parser {
|
||||||
return &Parser{
|
return &Parser{
|
||||||
Lexer: lexer,
|
Lexer: lexer,
|
||||||
errHandlerFunc: config.ErrorHandlerFunc,
|
errHandlerFunc: config.ErrorHandlerFunc,
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/z7zmey/php-parser/internal/php7"
|
"github.com/z7zmey/php-parser/internal/php7"
|
||||||
"github.com/z7zmey/php-parser/internal/scanner"
|
"github.com/z7zmey/php-parser/internal/scanner"
|
||||||
"github.com/z7zmey/php-parser/pkg/cfg"
|
"github.com/z7zmey/php-parser/pkg/conf"
|
||||||
"github.com/z7zmey/php-parser/pkg/version"
|
"github.com/z7zmey/php-parser/pkg/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ func BenchmarkPhp7(b *testing.B) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/pkg/cfg"
|
"github.com/z7zmey/php-parser/pkg/conf"
|
||||||
"github.com/z7zmey/php-parser/pkg/errors"
|
"github.com/z7zmey/php-parser/pkg/errors"
|
||||||
"github.com/z7zmey/php-parser/pkg/position"
|
"github.com/z7zmey/php-parser/pkg/position"
|
||||||
"github.com/z7zmey/php-parser/pkg/token"
|
"github.com/z7zmey/php-parser/pkg/token"
|
||||||
@ -27,7 +27,7 @@ type Lexer struct {
|
|||||||
newLines NewLines
|
newLines NewLines
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewLexer(data []byte, config cfg.Config) *Lexer {
|
func NewLexer(data []byte, config conf.Config) *Lexer {
|
||||||
lex := &Lexer{
|
lex := &Lexer{
|
||||||
data: data,
|
data: data,
|
||||||
phpVersion: config.Version,
|
phpVersion: config.Version,
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"gotest.tools/assert"
|
"gotest.tools/assert"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/pkg/cfg"
|
"github.com/z7zmey/php-parser/pkg/conf"
|
||||||
"github.com/z7zmey/php-parser/pkg/errors"
|
"github.com/z7zmey/php-parser/pkg/errors"
|
||||||
"github.com/z7zmey/php-parser/pkg/position"
|
"github.com/z7zmey/php-parser/pkg/position"
|
||||||
"github.com/z7zmey/php-parser/pkg/token"
|
"github.com/z7zmey/php-parser/pkg/token"
|
||||||
@ -355,7 +355,7 @@ func TestTokens(t *testing.T) {
|
|||||||
token.T_UNSET_CAST.String(),
|
token.T_UNSET_CAST.String(),
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -388,7 +388,7 @@ func TestShebang(t *testing.T) {
|
|||||||
"\n",
|
"\n",
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -413,7 +413,7 @@ func TestShebangHtml(t *testing.T) {
|
|||||||
0.1
|
0.1
|
||||||
`
|
`
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -468,7 +468,7 @@ func TestNumberTokens(t *testing.T) {
|
|||||||
token.T_DNUMBER.String(),
|
token.T_DNUMBER.String(),
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -530,7 +530,7 @@ func TestConstantStrings(t *testing.T) {
|
|||||||
token.T_CONSTANT_ENCAPSED_STRING.String(),
|
token.T_CONSTANT_ENCAPSED_STRING.String(),
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -582,7 +582,7 @@ func TestSingleQuoteStringTokens(t *testing.T) {
|
|||||||
token.T_CONSTANT_ENCAPSED_STRING.String(),
|
token.T_CONSTANT_ENCAPSED_STRING.String(),
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -682,7 +682,7 @@ func TestTeplateStringTokens(t *testing.T) {
|
|||||||
token.ID(int('"')).String(),
|
token.ID(int('"')).String(),
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -778,7 +778,7 @@ func TestBackquoteStringTokens(t *testing.T) {
|
|||||||
token.ID(int('`')).String(),
|
token.ID(int('`')).String(),
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -877,7 +877,7 @@ CAT;
|
|||||||
token.ID(int(';')).String(),
|
token.ID(int(';')).String(),
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -955,7 +955,7 @@ CAT
|
|||||||
token.T_END_HEREDOC.String(),
|
token.T_END_HEREDOC.String(),
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -999,7 +999,7 @@ CAT;
|
|||||||
token.ID(int(';')).String(),
|
token.ID(int(';')).String(),
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1035,7 +1035,7 @@ func TestHereDocTokens73(t *testing.T) {
|
|||||||
token.T_VARIABLE.String(),
|
token.T_VARIABLE.String(),
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1070,7 +1070,7 @@ CAT;`
|
|||||||
token.ID(int(';')).String(),
|
token.ID(int(';')).String(),
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 2,
|
Minor: 2,
|
||||||
@ -1098,7 +1098,7 @@ func TestHereDocUnclosed(t *testing.T) {
|
|||||||
token.T_START_HEREDOC.String(),
|
token.T_START_HEREDOC.String(),
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1135,7 +1135,7 @@ func TestInlineHtmlNopTokens(t *testing.T) {
|
|||||||
token.T_INLINE_HTML.String(),
|
token.T_INLINE_HTML.String(),
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1175,7 +1175,7 @@ func TestStringTokensAfterVariable(t *testing.T) {
|
|||||||
"\"",
|
"\"",
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1214,7 +1214,7 @@ func TestSlashAfterVariable(t *testing.T) {
|
|||||||
"3",
|
"3",
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1257,7 +1257,7 @@ func TestCommentEnd(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1294,7 +1294,7 @@ func TestCommentNewLine(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1331,7 +1331,7 @@ func TestCommentNewLine1(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1368,7 +1368,7 @@ func TestCommentNewLine2(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1406,7 +1406,7 @@ func TestCommentWithPhpEndTag(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1444,7 +1444,7 @@ func TestInlineComment(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1482,7 +1482,7 @@ func TestInlineComment2(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1524,7 +1524,7 @@ func TestEmptyInlineComment(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1562,7 +1562,7 @@ func TestEmptyInlineComment2(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1584,7 +1584,7 @@ func TestMethodCallTokens(t *testing.T) {
|
|||||||
src := `<?php
|
src := `<?php
|
||||||
$a -> bar ( '' ) ;`
|
$a -> bar ( '' ) ;`
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1692,7 +1692,7 @@ func TestYieldFromTokens(t *testing.T) {
|
|||||||
src := `<?php
|
src := `<?php
|
||||||
yield from $a`
|
yield from $a`
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1734,7 +1734,7 @@ func TestYieldFromTokens(t *testing.T) {
|
|||||||
func TestVarNameByteChars(t *testing.T) {
|
func TestVarNameByteChars(t *testing.T) {
|
||||||
src := "<?php $\x80 $\xff"
|
src := "<?php $\x80 $\xff"
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1752,7 +1752,7 @@ func TestVarNameByteChars(t *testing.T) {
|
|||||||
func TestStringVarNameByteChars(t *testing.T) {
|
func TestStringVarNameByteChars(t *testing.T) {
|
||||||
src := "<?php \"$\x80 $\xff\""
|
src := "<?php \"$\x80 $\xff\""
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1780,7 +1780,7 @@ func TestIgnoreControllCharacters(t *testing.T) {
|
|||||||
src := "<?php \004 echo $b;"
|
src := "<?php \004 echo $b;"
|
||||||
|
|
||||||
var actualErr *errors.Error
|
var actualErr *errors.Error
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1811,7 +1811,7 @@ func TestIgnoreControllCharacters(t *testing.T) {
|
|||||||
func TestIgnoreControllCharactersAtStringVarOffset(t *testing.T) {
|
func TestIgnoreControllCharactersAtStringVarOffset(t *testing.T) {
|
||||||
src := "<?php \"$a[test\004]\";"
|
src := "<?php \"$a[test\004]\";"
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1848,7 +1848,7 @@ func TestIgnoreControllCharactersAtStringVarOffset(t *testing.T) {
|
|||||||
func TestDoubleDollar(t *testing.T) {
|
func TestDoubleDollar(t *testing.T) {
|
||||||
src := `<?php "$$a";`
|
src := `<?php "$$a";`
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -1875,7 +1875,7 @@ func TestDoubleDollar(t *testing.T) {
|
|||||||
func TestTripleDollar(t *testing.T) {
|
func TestTripleDollar(t *testing.T) {
|
||||||
src := `<?php "$$$a";`
|
src := `<?php "$$$a";`
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package cfg
|
package conf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/pkg/errors"
|
"github.com/z7zmey/php-parser/pkg/errors"
|
@ -10,7 +10,7 @@ Package usage example:
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/pkg/cfg"
|
"github.com/z7zmey/php-parser/pkg/conf"
|
||||||
"github.com/z7zmey/php-parser/pkg/errors"
|
"github.com/z7zmey/php-parser/pkg/errors"
|
||||||
"github.com/z7zmey/php-parser/pkg/parser"
|
"github.com/z7zmey/php-parser/pkg/parser"
|
||||||
"github.com/z7zmey/php-parser/pkg/version"
|
"github.com/z7zmey/php-parser/pkg/version"
|
||||||
@ -24,12 +24,12 @@ Package usage example:
|
|||||||
|
|
||||||
var parserErrors []*errors.Error
|
var parserErrors []*errors.Error
|
||||||
errorHandler := func(e *errors.Error) {
|
errorHandler := func(e *errors.Error) {
|
||||||
parserErrors = append(parserErrors, e)
|
parsmakeerErrors = append(parserErrors, e)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse
|
// Parse
|
||||||
|
|
||||||
rootNode, err := parser.Parse(src, cfg.Config{
|
rootNode, err := parser.Parse(src, conf.Config{
|
||||||
Version: &version.Version{Major: 5, Minor: 6},
|
Version: &version.Version{Major: 5, Minor: 6},
|
||||||
ErrorHandlerFunc: errorHandler,
|
ErrorHandlerFunc: errorHandler,
|
||||||
})
|
})
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/z7zmey/php-parser/internal/php7"
|
"github.com/z7zmey/php-parser/internal/php7"
|
||||||
"github.com/z7zmey/php-parser/internal/scanner"
|
"github.com/z7zmey/php-parser/internal/scanner"
|
||||||
"github.com/z7zmey/php-parser/pkg/ast"
|
"github.com/z7zmey/php-parser/pkg/ast"
|
||||||
"github.com/z7zmey/php-parser/pkg/cfg"
|
"github.com/z7zmey/php-parser/pkg/conf"
|
||||||
"github.com/z7zmey/php-parser/pkg/version"
|
"github.com/z7zmey/php-parser/pkg/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ type Parser interface {
|
|||||||
GetRootNode() ast.Vertex
|
GetRootNode() ast.Vertex
|
||||||
}
|
}
|
||||||
|
|
||||||
func Parse(src []byte, config cfg.Config) (ast.Vertex, error) {
|
func Parse(src []byte, config conf.Config) (ast.Vertex, error) {
|
||||||
var parser Parser
|
var parser Parser
|
||||||
|
|
||||||
if config.Version == nil {
|
if config.Version == nil {
|
||||||
|
@ -7,13 +7,13 @@ import (
|
|||||||
"github.com/z7zmey/php-parser/internal/php5"
|
"github.com/z7zmey/php-parser/internal/php5"
|
||||||
"github.com/z7zmey/php-parser/internal/scanner"
|
"github.com/z7zmey/php-parser/internal/scanner"
|
||||||
"github.com/z7zmey/php-parser/pkg/ast"
|
"github.com/z7zmey/php-parser/pkg/ast"
|
||||||
"github.com/z7zmey/php-parser/pkg/cfg"
|
"github.com/z7zmey/php-parser/pkg/conf"
|
||||||
"github.com/z7zmey/php-parser/pkg/version"
|
"github.com/z7zmey/php-parser/pkg/version"
|
||||||
"github.com/z7zmey/php-parser/pkg/visitor/printer"
|
"github.com/z7zmey/php-parser/pkg/visitor/printer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func parsePhp5(src string) ast.Vertex {
|
func parsePhp5(src string) ast.Vertex {
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 5,
|
Major: 5,
|
||||||
Minor: 6,
|
Minor: 6,
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
"github.com/z7zmey/php-parser/internal/php7"
|
"github.com/z7zmey/php-parser/internal/php7"
|
||||||
"github.com/z7zmey/php-parser/internal/scanner"
|
"github.com/z7zmey/php-parser/internal/scanner"
|
||||||
"github.com/z7zmey/php-parser/pkg/ast"
|
"github.com/z7zmey/php-parser/pkg/ast"
|
||||||
"github.com/z7zmey/php-parser/pkg/cfg"
|
"github.com/z7zmey/php-parser/pkg/conf"
|
||||||
"github.com/z7zmey/php-parser/pkg/version"
|
"github.com/z7zmey/php-parser/pkg/version"
|
||||||
"github.com/z7zmey/php-parser/pkg/visitor/printer"
|
"github.com/z7zmey/php-parser/pkg/visitor/printer"
|
||||||
)
|
)
|
||||||
@ -30,7 +30,7 @@ abstract class Bar extends Baz
|
|||||||
|
|
||||||
// parse
|
// parse
|
||||||
|
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
@ -68,7 +68,7 @@ abstract class Bar extends Baz
|
|||||||
}
|
}
|
||||||
|
|
||||||
func parse(src string) ast.Vertex {
|
func parse(src string) ast.Vertex {
|
||||||
config := cfg.Config{
|
config := conf.Config{
|
||||||
Version: &version.Version{
|
Version: &version.Version{
|
||||||
Major: 7,
|
Major: 7,
|
||||||
Minor: 4,
|
Minor: 4,
|
||||||
|
Loading…
Reference in New Issue
Block a user