rename meta to freefloating; refactoring
This commit is contained in:
parent
a7082117d9
commit
b3800a2595
16
freefloating/position_string.go
Normal file
16
freefloating/position_string.go
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// Code generated by "stringer -type=Position -output ./position_string.go"; DO NOT EDIT.
|
||||||
|
|
||||||
|
package freefloating
|
||||||
|
|
||||||
|
import "strconv"
|
||||||
|
|
||||||
|
const _Position_name = "StartEndSlashColonSemiColonAltEndDollarAmpersandNamePrefixKeyVarUseTypeReturnTypeOptionalTypeCaseSeparatorLexicalVarsParamsRefCastExprInitExprCondExprIncExprTrueCondHaltCompillerNamespaceStaticClassUseWhileForSwitchBreakForeachDeclareLabelFinallyListDefaultIfElseIfElseVariadicFunctionAliasAsEqualExitArrayIssetEmptyEvalEchoTryCatchUnsetStmtsVarListConstListNameListParamListModifierListArrayPairListCaseListStartCaseListEndArgumentListPropertyListParameterListAdaptationListLexicalVarListUseDeclarationListOpenParenthesisTokenCloseParenthesisToken"
|
||||||
|
|
||||||
|
var _Position_index = [...]uint16{0, 5, 8, 13, 18, 27, 33, 39, 48, 52, 58, 61, 64, 71, 81, 93, 106, 117, 123, 126, 130, 134, 142, 150, 157, 161, 165, 178, 187, 193, 198, 201, 206, 209, 215, 220, 227, 234, 239, 246, 250, 257, 259, 265, 269, 277, 285, 290, 292, 297, 301, 306, 311, 316, 320, 324, 327, 332, 337, 342, 349, 358, 366, 375, 387, 400, 413, 424, 436, 448, 461, 475, 489, 507, 527, 548}
|
||||||
|
|
||||||
|
func (i Position) String() string {
|
||||||
|
if i < 0 || i >= Position(len(_Position_index)-1) {
|
||||||
|
return "Position(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||||
|
}
|
||||||
|
return _Position_name[_Position_index[i]:_Position_index[i+1]]
|
||||||
|
}
|
112
freefloating/string.go
Normal file
112
freefloating/string.go
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
package freefloating
|
||||||
|
|
||||||
|
import "github.com/z7zmey/php-parser/position"
|
||||||
|
|
||||||
|
type StringType int
|
||||||
|
|
||||||
|
const (
|
||||||
|
WhiteSpaceType StringType = iota
|
||||||
|
CommentType
|
||||||
|
TokenType
|
||||||
|
)
|
||||||
|
|
||||||
|
type Position int
|
||||||
|
|
||||||
|
//go:generate stringer -type=Position -output ./position_string.go
|
||||||
|
const (
|
||||||
|
Start Position = iota
|
||||||
|
End
|
||||||
|
Slash
|
||||||
|
Colon
|
||||||
|
SemiColon
|
||||||
|
AltEnd
|
||||||
|
Dollar
|
||||||
|
Ampersand
|
||||||
|
Name
|
||||||
|
Prefix
|
||||||
|
Key
|
||||||
|
Var
|
||||||
|
UseType
|
||||||
|
ReturnType
|
||||||
|
OptionalType
|
||||||
|
CaseSeparator
|
||||||
|
LexicalVars
|
||||||
|
Params
|
||||||
|
Ref
|
||||||
|
Cast
|
||||||
|
Expr
|
||||||
|
InitExpr
|
||||||
|
CondExpr
|
||||||
|
IncExpr
|
||||||
|
True
|
||||||
|
Cond
|
||||||
|
|
||||||
|
HaltCompiller
|
||||||
|
Namespace
|
||||||
|
Static
|
||||||
|
Class
|
||||||
|
Use
|
||||||
|
While
|
||||||
|
For
|
||||||
|
Switch
|
||||||
|
Break
|
||||||
|
Foreach
|
||||||
|
Declare
|
||||||
|
Label
|
||||||
|
Finally
|
||||||
|
List
|
||||||
|
Default
|
||||||
|
If
|
||||||
|
ElseIf
|
||||||
|
Else
|
||||||
|
Variadic
|
||||||
|
Function
|
||||||
|
Alias
|
||||||
|
As
|
||||||
|
Equal
|
||||||
|
Exit
|
||||||
|
Array
|
||||||
|
Isset
|
||||||
|
Empty
|
||||||
|
Eval
|
||||||
|
Echo
|
||||||
|
Try
|
||||||
|
Catch
|
||||||
|
Unset
|
||||||
|
|
||||||
|
Stmts
|
||||||
|
VarList
|
||||||
|
ConstList
|
||||||
|
NameList
|
||||||
|
ParamList
|
||||||
|
ModifierList
|
||||||
|
ArrayPairList
|
||||||
|
CaseListStart
|
||||||
|
CaseListEnd
|
||||||
|
ArgumentList
|
||||||
|
PropertyList
|
||||||
|
ParameterList
|
||||||
|
AdaptationList
|
||||||
|
LexicalVarList
|
||||||
|
UseDeclarationList
|
||||||
|
|
||||||
|
OpenParenthesisToken
|
||||||
|
CloseParenthesisToken
|
||||||
|
)
|
||||||
|
|
||||||
|
type String struct {
|
||||||
|
StringType StringType
|
||||||
|
Value string
|
||||||
|
Position *position.Position
|
||||||
|
}
|
||||||
|
|
||||||
|
type Collection map[Position][]String
|
||||||
|
|
||||||
|
func (c Collection) IsEmpty() bool {
|
||||||
|
for _, v := range c {
|
||||||
|
if len(v) > 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
@ -1,168 +0,0 @@
|
|||||||
package meta
|
|
||||||
|
|
||||||
// Collection of Meta objects
|
|
||||||
type Collection []*Data
|
|
||||||
|
|
||||||
// SetTokenName sets TokenName for the all elements in the collection
|
|
||||||
func (mc *Collection) SetTokenName(tn TokenName) *Collection {
|
|
||||||
for _, m := range *mc {
|
|
||||||
m.TokenName = tn
|
|
||||||
}
|
|
||||||
|
|
||||||
return mc
|
|
||||||
}
|
|
||||||
|
|
||||||
// Push adds elements to the end of an Collection
|
|
||||||
func (mc *Collection) Push(mm ...*Data) *Collection {
|
|
||||||
*mc = append(*mc, mm...)
|
|
||||||
return mc
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unshift prepends elements to the beginning of an Collection
|
|
||||||
func (mc *Collection) Unshift(mm ...*Data) *Collection {
|
|
||||||
*mc = append(mm, *mc...)
|
|
||||||
return mc
|
|
||||||
}
|
|
||||||
|
|
||||||
// AppendTo - appends elements of the collection to the end of the target collection
|
|
||||||
func (mc *Collection) AppendTo(target *Collection) *Collection {
|
|
||||||
if len(*mc) == 0 {
|
|
||||||
return mc
|
|
||||||
}
|
|
||||||
*target = append(*target, *mc...)
|
|
||||||
return mc
|
|
||||||
}
|
|
||||||
|
|
||||||
// PrependTo - prepends elements of the collection to the start of the target collection
|
|
||||||
func (mc *Collection) PrependTo(target *Collection) *Collection {
|
|
||||||
if len(*mc) == 0 {
|
|
||||||
return mc
|
|
||||||
}
|
|
||||||
*target = append(*mc, *target...)
|
|
||||||
return mc
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cut elements by TokenName
|
|
||||||
func (mc *Collection) Cut(f Filter) *Collection {
|
|
||||||
collection := (*mc)[:0]
|
|
||||||
cutted := Collection{}
|
|
||||||
|
|
||||||
for _, m := range *mc {
|
|
||||||
if fr := f(m); fr {
|
|
||||||
cutted = append(cutted, m)
|
|
||||||
} else {
|
|
||||||
collection = append(collection, m)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*mc = collection
|
|
||||||
|
|
||||||
return &cutted
|
|
||||||
}
|
|
||||||
|
|
||||||
// FindBy filter
|
|
||||||
func (mc *Collection) FindBy(f Filter) Collection {
|
|
||||||
found := Collection{}
|
|
||||||
|
|
||||||
for _, m := range *mc {
|
|
||||||
if fr := f(m); fr {
|
|
||||||
found = append(found, m)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return found
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filter function signature
|
|
||||||
type Filter func(d *Data) bool
|
|
||||||
|
|
||||||
// TokenNameFilter generates filter function that returns true
|
|
||||||
// if data.TokenName has in the arguments list
|
|
||||||
func TokenNameFilter(tokenNames ...TokenName) Filter {
|
|
||||||
return func(d *Data) bool {
|
|
||||||
for _, tn := range tokenNames {
|
|
||||||
if d.TokenName == tn {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TypeFilter generates filter function that returns true
|
|
||||||
// if data.Type has in the arguments list
|
|
||||||
func TypeFilter(types ...Type) Filter {
|
|
||||||
return func(d *Data) bool {
|
|
||||||
for _, t := range types {
|
|
||||||
if d.Type == t {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValueFilter generates filter function that returns true
|
|
||||||
// if data.Value has in the arguments list
|
|
||||||
func ValueFilter(values ...string) Filter {
|
|
||||||
return func(d *Data) bool {
|
|
||||||
for _, v := range values {
|
|
||||||
if d.Value == v {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// AndFilter generates filter function that returns true
|
|
||||||
// if all given filters return true
|
|
||||||
func AndFilter(filters ...Filter) Filter {
|
|
||||||
return func(d *Data) bool {
|
|
||||||
for _, filter := range filters {
|
|
||||||
if result := filter(d); !result {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// OrFilter generates filter function that returns true
|
|
||||||
// if one of given filters return true
|
|
||||||
func OrFilter(filters ...Filter) Filter {
|
|
||||||
return func(d *Data) bool {
|
|
||||||
for _, filter := range filters {
|
|
||||||
if result := filter(d); result {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NotFilter negates given filter
|
|
||||||
func NotFilter(f Filter) Filter {
|
|
||||||
return func(d *Data) bool {
|
|
||||||
return !f(d)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// StopOnFailureFilter always returns false after first failure
|
|
||||||
func StopOnFailureFilter(f Filter) Filter {
|
|
||||||
stopFlag := false
|
|
||||||
return func(d *Data) bool {
|
|
||||||
if stopFlag == true {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if !f(d) {
|
|
||||||
stopFlag = true
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,648 +0,0 @@
|
|||||||
package meta_test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"reflect"
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/kylelemons/godebug/pretty"
|
|
||||||
"github.com/z7zmey/php-parser/meta"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestCollectionSetTokenName(t *testing.T) {
|
|
||||||
|
|
||||||
// prepare
|
|
||||||
|
|
||||||
whiteSpace := &meta.Data{
|
|
||||||
Type: meta.WhiteSpaceType,
|
|
||||||
Value: "\n",
|
|
||||||
}
|
|
||||||
comment := &meta.Data{
|
|
||||||
Type: meta.CommentType,
|
|
||||||
Value: "// some comment",
|
|
||||||
}
|
|
||||||
|
|
||||||
baseCollection := meta.Collection{whiteSpace, comment}
|
|
||||||
|
|
||||||
// action
|
|
||||||
|
|
||||||
baseCollection.SetTokenName(meta.OpenParenthesisToken)
|
|
||||||
|
|
||||||
// check
|
|
||||||
|
|
||||||
for _, m := range baseCollection {
|
|
||||||
if m.TokenName != meta.OpenParenthesisToken {
|
|
||||||
t.Error("The TokenName must be set for all Meta objects")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCollectionPush(t *testing.T) {
|
|
||||||
|
|
||||||
// prepare
|
|
||||||
|
|
||||||
whiteSpace := &meta.Data{
|
|
||||||
Type: meta.WhiteSpaceType,
|
|
||||||
Value: "\n",
|
|
||||||
}
|
|
||||||
comment := &meta.Data{
|
|
||||||
Type: meta.CommentType,
|
|
||||||
Value: "// some comment",
|
|
||||||
}
|
|
||||||
|
|
||||||
actualCollection := meta.Collection{whiteSpace}
|
|
||||||
expectedCollection := meta.Collection{whiteSpace, comment}
|
|
||||||
|
|
||||||
// action
|
|
||||||
|
|
||||||
actualCollection.Push(comment)
|
|
||||||
|
|
||||||
// check
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expectedCollection, actualCollection) {
|
|
||||||
diff := pretty.Compare(expectedCollection, actualCollection)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\ndiff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCollectionUnshift(t *testing.T) {
|
|
||||||
|
|
||||||
// prepare
|
|
||||||
|
|
||||||
whiteSpace := &meta.Data{
|
|
||||||
Type: meta.WhiteSpaceType,
|
|
||||||
Value: "\n",
|
|
||||||
}
|
|
||||||
comment := &meta.Data{
|
|
||||||
Type: meta.CommentType,
|
|
||||||
Value: "// some comment",
|
|
||||||
}
|
|
||||||
|
|
||||||
actualCollection := meta.Collection{comment}
|
|
||||||
expectedCollection := meta.Collection{whiteSpace, comment}
|
|
||||||
|
|
||||||
// action
|
|
||||||
|
|
||||||
actualCollection.Unshift(whiteSpace)
|
|
||||||
|
|
||||||
// check
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expectedCollection, actualCollection) {
|
|
||||||
diff := pretty.Compare(expectedCollection, actualCollection)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\ndiff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCollectionAppendTo(t *testing.T) {
|
|
||||||
|
|
||||||
// prepare
|
|
||||||
|
|
||||||
whiteSpace := &meta.Data{
|
|
||||||
Type: meta.WhiteSpaceType,
|
|
||||||
Value: "\n",
|
|
||||||
}
|
|
||||||
comment := &meta.Data{
|
|
||||||
Type: meta.CommentType,
|
|
||||||
Value: "// some comment",
|
|
||||||
}
|
|
||||||
|
|
||||||
actualCollection := meta.Collection{whiteSpace}
|
|
||||||
expectedCollection := meta.Collection{whiteSpace, comment}
|
|
||||||
|
|
||||||
baseCollection := meta.Collection{comment}
|
|
||||||
|
|
||||||
// action
|
|
||||||
|
|
||||||
baseCollection.AppendTo(&actualCollection)
|
|
||||||
|
|
||||||
// check
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expectedCollection, actualCollection) {
|
|
||||||
diff := pretty.Compare(expectedCollection, actualCollection)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\ndiff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestEmptyCollectionAppendTo(t *testing.T) {
|
|
||||||
|
|
||||||
// prepare
|
|
||||||
|
|
||||||
whiteSpace := &meta.Data{
|
|
||||||
Type: meta.WhiteSpaceType,
|
|
||||||
Value: "\n",
|
|
||||||
}
|
|
||||||
|
|
||||||
actualCollection := meta.Collection{whiteSpace}
|
|
||||||
expectedCollection := meta.Collection{whiteSpace}
|
|
||||||
|
|
||||||
var baseCollection meta.Collection = nil
|
|
||||||
|
|
||||||
// action
|
|
||||||
|
|
||||||
baseCollection.AppendTo(&actualCollection)
|
|
||||||
|
|
||||||
// check
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expectedCollection, actualCollection) {
|
|
||||||
diff := pretty.Compare(expectedCollection, actualCollection)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\ndiff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCollectionPrependTo(t *testing.T) {
|
|
||||||
|
|
||||||
// prepare
|
|
||||||
|
|
||||||
whiteSpace := &meta.Data{
|
|
||||||
Type: meta.WhiteSpaceType,
|
|
||||||
Value: "\n",
|
|
||||||
}
|
|
||||||
comment := &meta.Data{
|
|
||||||
Type: meta.CommentType,
|
|
||||||
Value: "// some comment",
|
|
||||||
}
|
|
||||||
|
|
||||||
actualCollection := meta.Collection{comment}
|
|
||||||
expectedCollection := meta.Collection{whiteSpace, comment}
|
|
||||||
|
|
||||||
baseCollection := meta.Collection{whiteSpace}
|
|
||||||
|
|
||||||
// action
|
|
||||||
|
|
||||||
baseCollection.PrependTo(&actualCollection)
|
|
||||||
|
|
||||||
// check
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expectedCollection, actualCollection) {
|
|
||||||
diff := pretty.Compare(expectedCollection, actualCollection)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\ndiff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestEmptyCollectionPrependTo(t *testing.T) {
|
|
||||||
|
|
||||||
// prepare
|
|
||||||
|
|
||||||
comment := &meta.Data{
|
|
||||||
Type: meta.CommentType,
|
|
||||||
Value: "// some comment",
|
|
||||||
}
|
|
||||||
|
|
||||||
actualCollection := meta.Collection{comment}
|
|
||||||
expectedCollection := meta.Collection{comment}
|
|
||||||
|
|
||||||
baseCollection := meta.Collection{}
|
|
||||||
|
|
||||||
// action
|
|
||||||
|
|
||||||
baseCollection.PrependTo(&actualCollection)
|
|
||||||
|
|
||||||
// check
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expectedCollection, actualCollection) {
|
|
||||||
diff := pretty.Compare(expectedCollection, actualCollection)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\ndiff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCollectionCutByTokenName(t *testing.T) {
|
|
||||||
|
|
||||||
// prepare
|
|
||||||
|
|
||||||
whiteSpace := &meta.Data{
|
|
||||||
Type: meta.WhiteSpaceType,
|
|
||||||
Value: "\n",
|
|
||||||
}
|
|
||||||
OpenParenthesisComment := &meta.Data{
|
|
||||||
Type: meta.CommentType,
|
|
||||||
Value: "// some comment",
|
|
||||||
TokenName: meta.OpenParenthesisToken,
|
|
||||||
}
|
|
||||||
OpenParenthesisToken := &meta.Data{
|
|
||||||
Type: meta.TokenType,
|
|
||||||
Value: "(",
|
|
||||||
TokenName: meta.OpenParenthesisToken,
|
|
||||||
}
|
|
||||||
CloseParenthesisToken := &meta.Data{
|
|
||||||
Type: meta.TokenType,
|
|
||||||
Value: ")",
|
|
||||||
TokenName: meta.CloseParenthesisToken,
|
|
||||||
}
|
|
||||||
|
|
||||||
actualCollection := meta.Collection{whiteSpace, OpenParenthesisComment, OpenParenthesisToken, CloseParenthesisToken}
|
|
||||||
|
|
||||||
expectedCollection := meta.Collection{whiteSpace, CloseParenthesisToken}
|
|
||||||
expectedCutCollection := &meta.Collection{OpenParenthesisComment, OpenParenthesisToken}
|
|
||||||
|
|
||||||
// action
|
|
||||||
|
|
||||||
actualCutCollection := actualCollection.Cut(
|
|
||||||
meta.TokenNameFilter(meta.OpenParenthesisToken),
|
|
||||||
)
|
|
||||||
|
|
||||||
// check
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expectedCollection, actualCollection) {
|
|
||||||
diff := pretty.Compare(expectedCollection, actualCollection)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\ndiff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expectedCutCollection, actualCutCollection) {
|
|
||||||
diff := pretty.Compare(expectedCutCollection, actualCutCollection)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("\nexpected and actual Cut collections are not equal\ndiff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("\nexpected and actual Cut collections are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCollectionCutByTokenTypes(t *testing.T) {
|
|
||||||
|
|
||||||
// prepare
|
|
||||||
|
|
||||||
whiteSpace := &meta.Data{
|
|
||||||
Type: meta.WhiteSpaceType,
|
|
||||||
Value: "\n",
|
|
||||||
}
|
|
||||||
OpenParenthesisComment := &meta.Data{
|
|
||||||
Type: meta.CommentType,
|
|
||||||
Value: "// some comment",
|
|
||||||
TokenName: meta.OpenParenthesisToken,
|
|
||||||
}
|
|
||||||
OpenParenthesisToken := &meta.Data{
|
|
||||||
Type: meta.TokenType,
|
|
||||||
Value: "(",
|
|
||||||
TokenName: meta.OpenParenthesisToken,
|
|
||||||
}
|
|
||||||
CloseParenthesisToken := &meta.Data{
|
|
||||||
Type: meta.TokenType,
|
|
||||||
Value: ")",
|
|
||||||
TokenName: meta.CloseParenthesisToken,
|
|
||||||
}
|
|
||||||
|
|
||||||
actualCollection := meta.Collection{whiteSpace, OpenParenthesisComment, OpenParenthesisToken, CloseParenthesisToken}
|
|
||||||
|
|
||||||
expectedCollection := meta.Collection{OpenParenthesisToken, CloseParenthesisToken}
|
|
||||||
expectedCutCollection := &meta.Collection{whiteSpace, OpenParenthesisComment}
|
|
||||||
|
|
||||||
// action
|
|
||||||
|
|
||||||
actualCutCollection := actualCollection.Cut(meta.OrFilter(
|
|
||||||
meta.TypeFilter(meta.CommentType),
|
|
||||||
meta.TypeFilter(meta.WhiteSpaceType)),
|
|
||||||
)
|
|
||||||
|
|
||||||
// check
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expectedCollection, actualCollection) {
|
|
||||||
diff := pretty.Compare(expectedCollection, actualCollection)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\ndiff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expectedCutCollection, actualCutCollection) {
|
|
||||||
diff := pretty.Compare(expectedCutCollection, actualCutCollection)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("\nexpected and actual Cut collections are not equal\ndiff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("\nexpected and actual Cut collections are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCollectionCutByTokenNameButNotType(t *testing.T) {
|
|
||||||
|
|
||||||
// prepare
|
|
||||||
|
|
||||||
whiteSpace := &meta.Data{
|
|
||||||
Type: meta.WhiteSpaceType,
|
|
||||||
Value: "\n",
|
|
||||||
}
|
|
||||||
OpenParenthesisComment := &meta.Data{
|
|
||||||
Type: meta.CommentType,
|
|
||||||
Value: "// some comment",
|
|
||||||
TokenName: meta.OpenParenthesisToken,
|
|
||||||
}
|
|
||||||
OpenParenthesisToken := &meta.Data{
|
|
||||||
Type: meta.TokenType,
|
|
||||||
Value: "(",
|
|
||||||
TokenName: meta.OpenParenthesisToken,
|
|
||||||
}
|
|
||||||
CloseParenthesisToken := &meta.Data{
|
|
||||||
Type: meta.TokenType,
|
|
||||||
Value: ")",
|
|
||||||
TokenName: meta.CloseParenthesisToken,
|
|
||||||
}
|
|
||||||
|
|
||||||
actualCollection := meta.Collection{
|
|
||||||
whiteSpace,
|
|
||||||
OpenParenthesisComment,
|
|
||||||
OpenParenthesisToken,
|
|
||||||
CloseParenthesisToken,
|
|
||||||
}
|
|
||||||
|
|
||||||
expectedCollection := meta.Collection{
|
|
||||||
whiteSpace,
|
|
||||||
OpenParenthesisToken,
|
|
||||||
CloseParenthesisToken,
|
|
||||||
}
|
|
||||||
expectedCutCollection := &meta.Collection{
|
|
||||||
OpenParenthesisComment,
|
|
||||||
}
|
|
||||||
|
|
||||||
// action
|
|
||||||
|
|
||||||
actualCutCollection := actualCollection.Cut(meta.AndFilter(
|
|
||||||
meta.TokenNameFilter(meta.OpenParenthesisToken),
|
|
||||||
meta.NotFilter(meta.TypeFilter(meta.TokenType))),
|
|
||||||
)
|
|
||||||
|
|
||||||
// check
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expectedCollection, actualCollection) {
|
|
||||||
diff := pretty.Compare(expectedCollection, actualCollection)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\ndiff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expectedCutCollection, actualCutCollection) {
|
|
||||||
diff := pretty.Compare(expectedCutCollection, actualCutCollection)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("\nexpected and actual Cut collections are not equal\ndiff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("\nexpected and actual Cut collections are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCollectionCutByValue(t *testing.T) {
|
|
||||||
|
|
||||||
// prepare
|
|
||||||
|
|
||||||
whiteSpace := &meta.Data{
|
|
||||||
Type: meta.WhiteSpaceType,
|
|
||||||
Value: "\n",
|
|
||||||
}
|
|
||||||
OpenParenthesisComment := &meta.Data{
|
|
||||||
Type: meta.CommentType,
|
|
||||||
Value: "// some comment",
|
|
||||||
TokenName: meta.OpenParenthesisToken,
|
|
||||||
}
|
|
||||||
OpenParenthesisToken := &meta.Data{
|
|
||||||
Type: meta.TokenType,
|
|
||||||
Value: "(",
|
|
||||||
TokenName: meta.OpenParenthesisToken,
|
|
||||||
}
|
|
||||||
CloseParenthesisToken := &meta.Data{
|
|
||||||
Type: meta.TokenType,
|
|
||||||
Value: ")",
|
|
||||||
TokenName: meta.CloseParenthesisToken,
|
|
||||||
}
|
|
||||||
|
|
||||||
actualCollection := meta.Collection{
|
|
||||||
whiteSpace,
|
|
||||||
OpenParenthesisComment,
|
|
||||||
OpenParenthesisToken,
|
|
||||||
CloseParenthesisToken,
|
|
||||||
}
|
|
||||||
|
|
||||||
expectedCollection := meta.Collection{
|
|
||||||
whiteSpace,
|
|
||||||
OpenParenthesisComment,
|
|
||||||
}
|
|
||||||
expectedCutCollection := &meta.Collection{
|
|
||||||
OpenParenthesisToken,
|
|
||||||
CloseParenthesisToken,
|
|
||||||
}
|
|
||||||
|
|
||||||
// action
|
|
||||||
|
|
||||||
actualCutCollection := actualCollection.Cut(meta.ValueFilter("(", ")"))
|
|
||||||
|
|
||||||
// check
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expectedCollection, actualCollection) {
|
|
||||||
diff := pretty.Compare(expectedCollection, actualCollection)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\ndiff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expectedCutCollection, actualCutCollection) {
|
|
||||||
diff := pretty.Compare(expectedCutCollection, actualCutCollection)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("\nexpected and actual Cut collections are not equal\ndiff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("\nexpected and actual Cut collections are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCollectionCutUntilFirstToken(t *testing.T) {
|
|
||||||
|
|
||||||
// prepare
|
|
||||||
|
|
||||||
whiteSpace := &meta.Data{
|
|
||||||
Type: meta.WhiteSpaceType,
|
|
||||||
Value: "\n",
|
|
||||||
TokenName: meta.NodeStart,
|
|
||||||
}
|
|
||||||
OpenParenthesisComment := &meta.Data{
|
|
||||||
Type: meta.CommentType,
|
|
||||||
Value: "// some comment",
|
|
||||||
TokenName: meta.NodeStart,
|
|
||||||
}
|
|
||||||
OpenParenthesisToken := &meta.Data{
|
|
||||||
Type: meta.TokenType,
|
|
||||||
Value: "(",
|
|
||||||
TokenName: meta.OpenParenthesisToken,
|
|
||||||
}
|
|
||||||
CloseParenthesisComment := &meta.Data{
|
|
||||||
Type: meta.WhiteSpaceType,
|
|
||||||
Value: "// some comment",
|
|
||||||
TokenName: meta.OpenParenthesisToken,
|
|
||||||
}
|
|
||||||
CloseParenthesisToken := &meta.Data{
|
|
||||||
Type: meta.TokenType,
|
|
||||||
Value: ")",
|
|
||||||
TokenName: meta.CloseParenthesisToken,
|
|
||||||
}
|
|
||||||
|
|
||||||
actualCollection := meta.Collection{
|
|
||||||
whiteSpace,
|
|
||||||
OpenParenthesisComment,
|
|
||||||
OpenParenthesisToken,
|
|
||||||
CloseParenthesisComment,
|
|
||||||
CloseParenthesisToken,
|
|
||||||
}
|
|
||||||
|
|
||||||
expectedCutCollection := &meta.Collection{
|
|
||||||
whiteSpace,
|
|
||||||
OpenParenthesisComment,
|
|
||||||
}
|
|
||||||
expectedCollection := meta.Collection{
|
|
||||||
OpenParenthesisToken,
|
|
||||||
CloseParenthesisComment, // must not be cut
|
|
||||||
CloseParenthesisToken,
|
|
||||||
}
|
|
||||||
|
|
||||||
// action
|
|
||||||
|
|
||||||
actualCutCollection := actualCollection.Cut(
|
|
||||||
meta.StopOnFailureFilter(
|
|
||||||
meta.NotFilter(
|
|
||||||
meta.TypeFilter(meta.TokenType),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
// check
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expectedCollection, actualCollection) {
|
|
||||||
diff := pretty.Compare(expectedCollection, actualCollection)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\ndiff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expectedCutCollection, actualCutCollection) {
|
|
||||||
diff := pretty.Compare(expectedCutCollection, actualCutCollection)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("\nexpected and actual Cut collections are not equal\ndiff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("\nexpected and actual Cut collections are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCollectionFindByType(t *testing.T) {
|
|
||||||
|
|
||||||
// prepare
|
|
||||||
|
|
||||||
whiteSpace := &meta.Data{
|
|
||||||
Type: meta.WhiteSpaceType,
|
|
||||||
Value: "\n",
|
|
||||||
TokenName: meta.NodeStart,
|
|
||||||
}
|
|
||||||
OpenParenthesisComment := &meta.Data{
|
|
||||||
Type: meta.CommentType,
|
|
||||||
Value: "// some comment",
|
|
||||||
TokenName: meta.NodeStart,
|
|
||||||
}
|
|
||||||
OpenParenthesisToken := &meta.Data{
|
|
||||||
Type: meta.TokenType,
|
|
||||||
Value: "(",
|
|
||||||
TokenName: meta.OpenParenthesisToken,
|
|
||||||
}
|
|
||||||
CloseParenthesisComment := &meta.Data{
|
|
||||||
Type: meta.WhiteSpaceType,
|
|
||||||
Value: "// some comment",
|
|
||||||
TokenName: meta.OpenParenthesisToken,
|
|
||||||
}
|
|
||||||
CloseParenthesisToken := &meta.Data{
|
|
||||||
Type: meta.TokenType,
|
|
||||||
Value: ")",
|
|
||||||
TokenName: meta.CloseParenthesisToken,
|
|
||||||
}
|
|
||||||
|
|
||||||
actualCollection := meta.Collection{
|
|
||||||
whiteSpace,
|
|
||||||
OpenParenthesisComment,
|
|
||||||
OpenParenthesisToken,
|
|
||||||
CloseParenthesisComment,
|
|
||||||
CloseParenthesisToken,
|
|
||||||
}
|
|
||||||
|
|
||||||
expectedCollection := meta.Collection{
|
|
||||||
whiteSpace,
|
|
||||||
OpenParenthesisComment,
|
|
||||||
OpenParenthesisToken,
|
|
||||||
CloseParenthesisComment,
|
|
||||||
CloseParenthesisToken,
|
|
||||||
}
|
|
||||||
|
|
||||||
expectedFoundCollection := meta.Collection{
|
|
||||||
OpenParenthesisToken,
|
|
||||||
CloseParenthesisToken,
|
|
||||||
}
|
|
||||||
|
|
||||||
// action
|
|
||||||
|
|
||||||
actualFoundCollection := actualCollection.FindBy(meta.TypeFilter(meta.TokenType))
|
|
||||||
|
|
||||||
// check
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expectedCollection, actualCollection) {
|
|
||||||
diff := pretty.Compare(expectedCollection, actualCollection)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\ndiff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("\nexpected and actual collections are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(expectedFoundCollection, actualFoundCollection) {
|
|
||||||
diff := pretty.Compare(expectedFoundCollection, actualFoundCollection)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("\nexpected and actual Cut collections are not equal\ndiff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("\nexpected and actual Cut collections are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
17
meta/data.go
17
meta/data.go
@ -1,17 +0,0 @@
|
|||||||
package meta
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/z7zmey/php-parser/position"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Data contain additional information that isn't part of AST
|
|
||||||
type Data struct {
|
|
||||||
Value string
|
|
||||||
Type Type
|
|
||||||
Position *position.Position
|
|
||||||
TokenName TokenName
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Data) String() string {
|
|
||||||
return d.Value
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package meta_test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/meta"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestCommentPrint(t *testing.T) {
|
|
||||||
expected := "/** hello world */"
|
|
||||||
|
|
||||||
comment := meta.Data{
|
|
||||||
Value: expected,
|
|
||||||
}
|
|
||||||
|
|
||||||
actual := comment.String()
|
|
||||||
|
|
||||||
if expected != actual {
|
|
||||||
t.Errorf("expected and actual are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,85 +0,0 @@
|
|||||||
package meta
|
|
||||||
|
|
||||||
// TokenName is used to specify a comment position
|
|
||||||
type TokenName int
|
|
||||||
|
|
||||||
//go:generate stringer -type=TokenName -output ./tokenName_string.go
|
|
||||||
const (
|
|
||||||
NodeStart TokenName = iota
|
|
||||||
NodeEnd
|
|
||||||
WhileToken
|
|
||||||
EndwhileToken
|
|
||||||
ForInitSemicolonToken
|
|
||||||
ForCondSemicolonToken
|
|
||||||
EndforToken
|
|
||||||
EndforeachToken
|
|
||||||
EnddeclareToken
|
|
||||||
AsToken
|
|
||||||
EndswitchToken
|
|
||||||
FunctionToken
|
|
||||||
ConstToken
|
|
||||||
InsteadofToken
|
|
||||||
ClassToken
|
|
||||||
ExtendsToken
|
|
||||||
ImplementsToken
|
|
||||||
DoubleArrowToken
|
|
||||||
PaamayimNekudotayimToken
|
|
||||||
NsSeparatorToken
|
|
||||||
EllipsisToken
|
|
||||||
LogicalOrToken
|
|
||||||
LogicalXorToken
|
|
||||||
LogicalAndToken
|
|
||||||
InstanceofToken
|
|
||||||
EndifToken
|
|
||||||
IncToken
|
|
||||||
DecToken
|
|
||||||
ObjectOperatorToken
|
|
||||||
CoalesceToken
|
|
||||||
SpaceshipToken
|
|
||||||
PlusEqualToken
|
|
||||||
MinusEqualToken
|
|
||||||
MulEqualToken
|
|
||||||
PowEqualToken
|
|
||||||
DivEqualToken
|
|
||||||
ConcatEqualToken
|
|
||||||
ModEqualToken
|
|
||||||
AndEqualToken
|
|
||||||
OrEqualToken
|
|
||||||
XorEqualToken
|
|
||||||
SlEqualToken
|
|
||||||
SrEqualToken
|
|
||||||
BooleanOrToken
|
|
||||||
BooleanAndToken
|
|
||||||
PowToken
|
|
||||||
SlToken
|
|
||||||
SrToken
|
|
||||||
IsIdenticalToken
|
|
||||||
IsNotIdenticalToken
|
|
||||||
IsEqualToken
|
|
||||||
IsNotEqualToken
|
|
||||||
IsSmallerOrEqualToken
|
|
||||||
IsGreaterOrEqualToken
|
|
||||||
CaseSeparatorToken // ';' or ':'
|
|
||||||
OpenCurlyBracesToken // '{'
|
|
||||||
CloseCurlyBracesToken // '}'
|
|
||||||
SemiColonToken // ';'
|
|
||||||
ColonToken // ':'
|
|
||||||
OpenParenthesisToken // '('
|
|
||||||
CloseParenthesisToken // ')'
|
|
||||||
OpenSquareBracket // '['
|
|
||||||
CloseSquareBracket // ']'
|
|
||||||
QuestionMarkToken // '?'
|
|
||||||
AmpersandToken // '&'
|
|
||||||
MinusToken // '-'
|
|
||||||
PlusToken // '+'
|
|
||||||
CommaToken // ','
|
|
||||||
VerticalBarToken // '|'
|
|
||||||
EqualToken // '='
|
|
||||||
CaretToken // '^'
|
|
||||||
AsteriskToken // '*'
|
|
||||||
SlashToken // '/'
|
|
||||||
PercentToken // '%'
|
|
||||||
LessToken // '<'
|
|
||||||
GreaterToken // '>'
|
|
||||||
DotToken // '.'
|
|
||||||
)
|
|
@ -1,16 +0,0 @@
|
|||||||
// Code generated by "stringer -type=TokenName -output ./tokenName_string.go"; DO NOT EDIT.
|
|
||||||
|
|
||||||
package meta
|
|
||||||
|
|
||||||
import "strconv"
|
|
||||||
|
|
||||||
const _TokenName_name = "NodeStartNodeEndWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenEndforTokenEndforeachTokenEnddeclareTokenAsTokenEndswitchTokenFunctionTokenConstTokenInsteadofTokenClassTokenExtendsTokenImplementsTokenDoubleArrowTokenPaamayimNekudotayimTokenNsSeparatorTokenEllipsisTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenEndifTokenIncTokenDecTokenObjectOperatorTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenCaseSeparatorTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
|
|
||||||
|
|
||||||
var _TokenName_index = [...]uint16{0, 9, 16, 26, 39, 60, 81, 92, 107, 122, 129, 143, 156, 166, 180, 190, 202, 217, 233, 257, 273, 286, 300, 315, 330, 345, 355, 363, 371, 390, 403, 417, 431, 446, 459, 472, 485, 501, 514, 527, 539, 552, 564, 576, 590, 605, 613, 620, 627, 643, 662, 674, 689, 710, 731, 749, 769, 790, 804, 814, 834, 855, 872, 890, 907, 921, 931, 940, 950, 966, 976, 986, 999, 1009, 1021, 1030, 1042, 1050}
|
|
||||||
|
|
||||||
func (i TokenName) String() string {
|
|
||||||
if i < 0 || i >= TokenName(len(_TokenName_index)-1) {
|
|
||||||
return "TokenName(" + strconv.FormatInt(int64(i), 10) + ")"
|
|
||||||
}
|
|
||||||
return _TokenName_name[_TokenName_index[i]:_TokenName_index[i+1]]
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
package meta_test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/meta"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestTokenNameString(t *testing.T) {
|
|
||||||
c := meta.NsSeparatorToken
|
|
||||||
|
|
||||||
expected := "NsSeparatorToken"
|
|
||||||
actual := c.String()
|
|
||||||
|
|
||||||
if expected != actual {
|
|
||||||
t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestWrongTokenNameString(t *testing.T) {
|
|
||||||
c := meta.TokenName(-1)
|
|
||||||
|
|
||||||
expected := "TokenName(-1)"
|
|
||||||
actual := c.String()
|
|
||||||
|
|
||||||
if expected != actual {
|
|
||||||
t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
|
|
||||||
}
|
|
||||||
}
|
|
11
meta/type.go
11
meta/type.go
@ -1,11 +0,0 @@
|
|||||||
package meta
|
|
||||||
|
|
||||||
// Type TODO
|
|
||||||
type Type int
|
|
||||||
|
|
||||||
//go:generate stringer -type=Type -output ./type_string.go
|
|
||||||
const (
|
|
||||||
CommentType Type = iota
|
|
||||||
WhiteSpaceType
|
|
||||||
TokenType
|
|
||||||
)
|
|
@ -1,16 +0,0 @@
|
|||||||
// Code generated by "stringer -type=Type -output ./type_string.go"; DO NOT EDIT.
|
|
||||||
|
|
||||||
package meta
|
|
||||||
|
|
||||||
import "strconv"
|
|
||||||
|
|
||||||
const _Type_name = "CommentTypeWhiteSpaceTypeTokenType"
|
|
||||||
|
|
||||||
var _Type_index = [...]uint8{0, 11, 25, 34}
|
|
||||||
|
|
||||||
func (i Type) String() string {
|
|
||||||
if i < 0 || i >= Type(len(_Type_index)-1) {
|
|
||||||
return "Type(" + strconv.FormatInt(int64(i), 10) + ")"
|
|
||||||
}
|
|
||||||
return _Type_name[_Type_index[i]:_Type_index[i+1]]
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
package meta_test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/meta"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestTypeString(t *testing.T) {
|
|
||||||
c := meta.CommentType
|
|
||||||
|
|
||||||
expected := "CommentType"
|
|
||||||
actual := c.String()
|
|
||||||
|
|
||||||
if expected != actual {
|
|
||||||
t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestWrongTypeString(t *testing.T) {
|
|
||||||
c := meta.Type(-1)
|
|
||||||
|
|
||||||
expected := "Type(-1)"
|
|
||||||
actual := c.String()
|
|
||||||
|
|
||||||
if expected != actual {
|
|
||||||
t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,7 @@
|
|||||||
package assign
|
package assign
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Assign node
|
// Assign node
|
||||||
type Assign struct {
|
type Assign struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variable node.Node
|
Variable node.Node
|
||||||
Expression node.Node
|
Expression node.Node
|
||||||
@ -18,6 +18,7 @@ type Assign struct {
|
|||||||
// NewAssign node constructor
|
// NewAssign node constructor
|
||||||
func NewAssign(Variable node.Node, Expression node.Node) *Assign {
|
func NewAssign(Variable node.Node, Expression node.Node) *Assign {
|
||||||
return &Assign{
|
return &Assign{
|
||||||
|
FreeFloating: nil,
|
||||||
Variable: Variable,
|
Variable: Variable,
|
||||||
Expression: Expression,
|
Expression: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Assign) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Assign) GetMeta() *meta.Collection {
|
func (n *Assign) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package assign
|
package assign
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Reference node
|
// Reference node
|
||||||
type Reference struct {
|
type Reference struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variable node.Node
|
Variable node.Node
|
||||||
Expression node.Node
|
Expression node.Node
|
||||||
@ -18,6 +18,7 @@ type Reference struct {
|
|||||||
// NewReference node constructor
|
// NewReference node constructor
|
||||||
func NewReference(Variable node.Node, Expression node.Node) *Reference {
|
func NewReference(Variable node.Node, Expression node.Node) *Reference {
|
||||||
return &Reference{
|
return &Reference{
|
||||||
|
FreeFloating: nil,
|
||||||
Variable: Variable,
|
Variable: Variable,
|
||||||
Expression: Expression,
|
Expression: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Reference) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Reference) GetMeta() *meta.Collection {
|
func (n *Reference) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package assign
|
package assign
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// BitwiseAnd node
|
// BitwiseAnd node
|
||||||
type BitwiseAnd struct {
|
type BitwiseAnd struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variable node.Node
|
Variable node.Node
|
||||||
Expression node.Node
|
Expression node.Node
|
||||||
@ -18,6 +18,7 @@ type BitwiseAnd struct {
|
|||||||
// NewBitwiseAnd node constructor
|
// NewBitwiseAnd node constructor
|
||||||
func NewBitwiseAnd(Variable node.Node, Expression node.Node) *BitwiseAnd {
|
func NewBitwiseAnd(Variable node.Node, Expression node.Node) *BitwiseAnd {
|
||||||
return &BitwiseAnd{
|
return &BitwiseAnd{
|
||||||
|
FreeFloating: nil,
|
||||||
Variable: Variable,
|
Variable: Variable,
|
||||||
Expression: Expression,
|
Expression: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *BitwiseAnd) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *BitwiseAnd) GetMeta() *meta.Collection {
|
func (n *BitwiseAnd) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package assign
|
package assign
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// BitwiseOr node
|
// BitwiseOr node
|
||||||
type BitwiseOr struct {
|
type BitwiseOr struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variable node.Node
|
Variable node.Node
|
||||||
Expression node.Node
|
Expression node.Node
|
||||||
@ -18,6 +18,7 @@ type BitwiseOr struct {
|
|||||||
// NewBitwiseOr node constructor
|
// NewBitwiseOr node constructor
|
||||||
func NewBitwiseOr(Variable node.Node, Expression node.Node) *BitwiseOr {
|
func NewBitwiseOr(Variable node.Node, Expression node.Node) *BitwiseOr {
|
||||||
return &BitwiseOr{
|
return &BitwiseOr{
|
||||||
|
FreeFloating: nil,
|
||||||
Variable: Variable,
|
Variable: Variable,
|
||||||
Expression: Expression,
|
Expression: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *BitwiseOr) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *BitwiseOr) GetMeta() *meta.Collection {
|
func (n *BitwiseOr) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package assign
|
package assign
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// BitwiseXor node
|
// BitwiseXor node
|
||||||
type BitwiseXor struct {
|
type BitwiseXor struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variable node.Node
|
Variable node.Node
|
||||||
Expression node.Node
|
Expression node.Node
|
||||||
@ -18,6 +18,7 @@ type BitwiseXor struct {
|
|||||||
// NewBitwiseXor node constructor
|
// NewBitwiseXor node constructor
|
||||||
func NewBitwiseXor(Variable node.Node, Expression node.Node) *BitwiseXor {
|
func NewBitwiseXor(Variable node.Node, Expression node.Node) *BitwiseXor {
|
||||||
return &BitwiseXor{
|
return &BitwiseXor{
|
||||||
|
FreeFloating: nil,
|
||||||
Variable: Variable,
|
Variable: Variable,
|
||||||
Expression: Expression,
|
Expression: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *BitwiseXor) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *BitwiseXor) GetMeta() *meta.Collection {
|
func (n *BitwiseXor) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package assign
|
package assign
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Concat node
|
// Concat node
|
||||||
type Concat struct {
|
type Concat struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variable node.Node
|
Variable node.Node
|
||||||
Expression node.Node
|
Expression node.Node
|
||||||
@ -18,6 +18,7 @@ type Concat struct {
|
|||||||
// NewConcat node constructor
|
// NewConcat node constructor
|
||||||
func NewConcat(Variable node.Node, Expression node.Node) *Concat {
|
func NewConcat(Variable node.Node, Expression node.Node) *Concat {
|
||||||
return &Concat{
|
return &Concat{
|
||||||
|
FreeFloating: nil,
|
||||||
Variable: Variable,
|
Variable: Variable,
|
||||||
Expression: Expression,
|
Expression: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Concat) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Concat) GetMeta() *meta.Collection {
|
func (n *Concat) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package assign
|
package assign
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Div node
|
// Div node
|
||||||
type Div struct {
|
type Div struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variable node.Node
|
Variable node.Node
|
||||||
Expression node.Node
|
Expression node.Node
|
||||||
@ -18,6 +18,7 @@ type Div struct {
|
|||||||
// NewDiv node constructor
|
// NewDiv node constructor
|
||||||
func NewDiv(Variable node.Node, Expression node.Node) *Div {
|
func NewDiv(Variable node.Node, Expression node.Node) *Div {
|
||||||
return &Div{
|
return &Div{
|
||||||
|
FreeFloating: nil,
|
||||||
Variable: Variable,
|
Variable: Variable,
|
||||||
Expression: Expression,
|
Expression: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Div) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Div) GetMeta() *meta.Collection {
|
func (n *Div) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package assign
|
package assign
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Minus node
|
// Minus node
|
||||||
type Minus struct {
|
type Minus struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variable node.Node
|
Variable node.Node
|
||||||
Expression node.Node
|
Expression node.Node
|
||||||
@ -18,6 +18,7 @@ type Minus struct {
|
|||||||
// NewMinus node constructor
|
// NewMinus node constructor
|
||||||
func NewMinus(Variable node.Node, Expression node.Node) *Minus {
|
func NewMinus(Variable node.Node, Expression node.Node) *Minus {
|
||||||
return &Minus{
|
return &Minus{
|
||||||
|
FreeFloating: nil,
|
||||||
Variable: Variable,
|
Variable: Variable,
|
||||||
Expression: Expression,
|
Expression: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Minus) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Minus) GetMeta() *meta.Collection {
|
func (n *Minus) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package assign
|
package assign
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Mod node
|
// Mod node
|
||||||
type Mod struct {
|
type Mod struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variable node.Node
|
Variable node.Node
|
||||||
Expression node.Node
|
Expression node.Node
|
||||||
@ -18,6 +18,7 @@ type Mod struct {
|
|||||||
// NewMod node constructor
|
// NewMod node constructor
|
||||||
func NewMod(Variable node.Node, Expression node.Node) *Mod {
|
func NewMod(Variable node.Node, Expression node.Node) *Mod {
|
||||||
return &Mod{
|
return &Mod{
|
||||||
|
FreeFloating: nil,
|
||||||
Variable: Variable,
|
Variable: Variable,
|
||||||
Expression: Expression,
|
Expression: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Mod) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Mod) GetMeta() *meta.Collection {
|
func (n *Mod) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package assign
|
package assign
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Mul node
|
// Mul node
|
||||||
type Mul struct {
|
type Mul struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variable node.Node
|
Variable node.Node
|
||||||
Expression node.Node
|
Expression node.Node
|
||||||
@ -18,6 +18,7 @@ type Mul struct {
|
|||||||
// NewMul node constructor
|
// NewMul node constructor
|
||||||
func NewMul(Variable node.Node, Expression node.Node) *Mul {
|
func NewMul(Variable node.Node, Expression node.Node) *Mul {
|
||||||
return &Mul{
|
return &Mul{
|
||||||
|
FreeFloating: nil,
|
||||||
Variable: Variable,
|
Variable: Variable,
|
||||||
Expression: Expression,
|
Expression: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Mul) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Mul) GetMeta() *meta.Collection {
|
func (n *Mul) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package assign
|
package assign
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Plus node
|
// Plus node
|
||||||
type Plus struct {
|
type Plus struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variable node.Node
|
Variable node.Node
|
||||||
Expression node.Node
|
Expression node.Node
|
||||||
@ -18,6 +18,7 @@ type Plus struct {
|
|||||||
// NewPlus node constructor
|
// NewPlus node constructor
|
||||||
func NewPlus(Variable node.Node, Expression node.Node) *Plus {
|
func NewPlus(Variable node.Node, Expression node.Node) *Plus {
|
||||||
return &Plus{
|
return &Plus{
|
||||||
|
FreeFloating: nil,
|
||||||
Variable: Variable,
|
Variable: Variable,
|
||||||
Expression: Expression,
|
Expression: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Plus) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Plus) GetMeta() *meta.Collection {
|
func (n *Plus) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package assign
|
package assign
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Pow node
|
// Pow node
|
||||||
type Pow struct {
|
type Pow struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variable node.Node
|
Variable node.Node
|
||||||
Expression node.Node
|
Expression node.Node
|
||||||
@ -18,6 +18,7 @@ type Pow struct {
|
|||||||
// NewPow node constructor
|
// NewPow node constructor
|
||||||
func NewPow(Variable node.Node, Expression node.Node) *Pow {
|
func NewPow(Variable node.Node, Expression node.Node) *Pow {
|
||||||
return &Pow{
|
return &Pow{
|
||||||
|
FreeFloating: nil,
|
||||||
Variable: Variable,
|
Variable: Variable,
|
||||||
Expression: Expression,
|
Expression: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Pow) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Pow) GetMeta() *meta.Collection {
|
func (n *Pow) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package assign
|
package assign
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// ShiftLeft node
|
// ShiftLeft node
|
||||||
type ShiftLeft struct {
|
type ShiftLeft struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variable node.Node
|
Variable node.Node
|
||||||
Expression node.Node
|
Expression node.Node
|
||||||
@ -18,6 +18,7 @@ type ShiftLeft struct {
|
|||||||
// NewShiftLeft node constructor
|
// NewShiftLeft node constructor
|
||||||
func NewShiftLeft(Variable node.Node, Expression node.Node) *ShiftLeft {
|
func NewShiftLeft(Variable node.Node, Expression node.Node) *ShiftLeft {
|
||||||
return &ShiftLeft{
|
return &ShiftLeft{
|
||||||
|
FreeFloating: nil,
|
||||||
Variable: Variable,
|
Variable: Variable,
|
||||||
Expression: Expression,
|
Expression: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *ShiftLeft) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ShiftLeft) GetMeta() *meta.Collection {
|
func (n *ShiftLeft) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package assign
|
package assign
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// ShiftRight node
|
// ShiftRight node
|
||||||
type ShiftRight struct {
|
type ShiftRight struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variable node.Node
|
Variable node.Node
|
||||||
Expression node.Node
|
Expression node.Node
|
||||||
@ -18,6 +18,7 @@ type ShiftRight struct {
|
|||||||
// NewShiftRight node constructor
|
// NewShiftRight node constructor
|
||||||
func NewShiftRight(Variable node.Node, Expression node.Node) *ShiftRight {
|
func NewShiftRight(Variable node.Node, Expression node.Node) *ShiftRight {
|
||||||
return &ShiftRight{
|
return &ShiftRight{
|
||||||
|
FreeFloating: nil,
|
||||||
Variable: Variable,
|
Variable: Variable,
|
||||||
Expression: Expression,
|
Expression: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *ShiftRight) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ShiftRight) GetMeta() *meta.Collection {
|
func (n *ShiftRight) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -2,14 +2,13 @@ package assign_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"reflect"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"gotest.tools/assert"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node/expr/assign"
|
"github.com/z7zmey/php-parser/node/expr/assign"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
|
|
||||||
"github.com/kylelemons/godebug/pretty"
|
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/node/expr"
|
"github.com/z7zmey/php-parser/node/expr"
|
||||||
"github.com/z7zmey/php-parser/node/name"
|
"github.com/z7zmey/php-parser/node/name"
|
||||||
@ -18,18 +17,6 @@ import (
|
|||||||
"github.com/z7zmey/php-parser/php7"
|
"github.com/z7zmey/php-parser/php7"
|
||||||
)
|
)
|
||||||
|
|
||||||
func assertEqual(t *testing.T, expected interface{}, actual interface{}) {
|
|
||||||
if !reflect.DeepEqual(expected, actual) {
|
|
||||||
diff := pretty.Compare(expected, actual)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("diff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("expected and actual are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestReference(t *testing.T) {
|
func TestReference(t *testing.T) {
|
||||||
src := `<? $a =& $b;`
|
src := `<? $a =& $b;`
|
||||||
|
|
||||||
@ -97,12 +84,12 @@ func TestReference(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestReferenceNew(t *testing.T) {
|
func TestReferenceNew(t *testing.T) {
|
||||||
@ -182,12 +169,12 @@ func TestReferenceNew(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestReferenceArgs(t *testing.T) {
|
func TestReferenceArgs(t *testing.T) {
|
||||||
@ -304,12 +291,12 @@ func TestReferenceArgs(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAssign(t *testing.T) {
|
func TestAssign(t *testing.T) {
|
||||||
@ -379,12 +366,12 @@ func TestAssign(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBitwiseAnd(t *testing.T) {
|
func TestBitwiseAnd(t *testing.T) {
|
||||||
@ -454,12 +441,12 @@ func TestBitwiseAnd(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBitwiseOr(t *testing.T) {
|
func TestBitwiseOr(t *testing.T) {
|
||||||
@ -529,12 +516,12 @@ func TestBitwiseOr(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBitwiseXor(t *testing.T) {
|
func TestBitwiseXor(t *testing.T) {
|
||||||
@ -604,12 +591,12 @@ func TestBitwiseXor(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConcat(t *testing.T) {
|
func TestConcat(t *testing.T) {
|
||||||
@ -679,12 +666,12 @@ func TestConcat(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDiv(t *testing.T) {
|
func TestDiv(t *testing.T) {
|
||||||
@ -754,12 +741,12 @@ func TestDiv(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMinus(t *testing.T) {
|
func TestMinus(t *testing.T) {
|
||||||
@ -829,12 +816,12 @@ func TestMinus(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMod(t *testing.T) {
|
func TestMod(t *testing.T) {
|
||||||
@ -904,12 +891,12 @@ func TestMod(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMul(t *testing.T) {
|
func TestMul(t *testing.T) {
|
||||||
@ -979,12 +966,12 @@ func TestMul(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPlus(t *testing.T) {
|
func TestPlus(t *testing.T) {
|
||||||
@ -1054,12 +1041,12 @@ func TestPlus(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPow(t *testing.T) {
|
func TestPow(t *testing.T) {
|
||||||
@ -1129,12 +1116,12 @@ func TestPow(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestShiftLeft(t *testing.T) {
|
func TestShiftLeft(t *testing.T) {
|
||||||
@ -1204,12 +1191,12 @@ func TestShiftLeft(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestShiftRight(t *testing.T) {
|
func TestShiftRight(t *testing.T) {
|
||||||
@ -1279,10 +1266,10 @@ func TestShiftRight(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
81
node/expr/assign/t_freefloating_test.go
Normal file
81
node/expr/assign/t_freefloating_test.go
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
package assign_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"gotest.tools/assert"
|
||||||
|
|
||||||
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
|
"github.com/z7zmey/php-parser/node"
|
||||||
|
"github.com/z7zmey/php-parser/node/expr/assign"
|
||||||
|
)
|
||||||
|
|
||||||
|
var expected freefloating.Collection = freefloating.Collection{
|
||||||
|
freefloating.Start: []freefloating.String{
|
||||||
|
{
|
||||||
|
StringType: freefloating.WhiteSpaceType,
|
||||||
|
Value: " ",
|
||||||
|
Position: nil,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
StringType: freefloating.CommentType,
|
||||||
|
Value: "//comment\n",
|
||||||
|
Position: nil,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
var nodes = []node.Node{
|
||||||
|
&assign.Reference{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&assign.Assign{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&assign.BitwiseAnd{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&assign.BitwiseOr{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&assign.BitwiseXor{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&assign.Concat{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&assign.Div{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&assign.Minus{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&assign.Mod{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&assign.Mul{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&assign.Plus{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&assign.Pow{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&assign.ShiftLeft{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&assign.ShiftRight{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&assign.ShiftRight{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestMeta(t *testing.T) {
|
||||||
|
for _, n := range nodes {
|
||||||
|
actual := *n.GetFreeFloating()
|
||||||
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
}
|
||||||
|
}
|
@ -1,49 +0,0 @@
|
|||||||
package assign_test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node/expr/assign"
|
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/meta"
|
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
|
||||||
)
|
|
||||||
|
|
||||||
var nodes = []node.Node{
|
|
||||||
&assign.Reference{},
|
|
||||||
&assign.Assign{},
|
|
||||||
&assign.BitwiseAnd{},
|
|
||||||
&assign.BitwiseOr{},
|
|
||||||
&assign.BitwiseXor{},
|
|
||||||
&assign.Concat{},
|
|
||||||
&assign.Div{},
|
|
||||||
&assign.Minus{},
|
|
||||||
&assign.Mod{},
|
|
||||||
&assign.Mul{},
|
|
||||||
&assign.Plus{},
|
|
||||||
&assign.Pow{},
|
|
||||||
&assign.ShiftLeft{},
|
|
||||||
&assign.ShiftRight{},
|
|
||||||
&assign.ShiftRight{},
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMeta(t *testing.T) {
|
|
||||||
expected := &meta.Collection{
|
|
||||||
&meta.Data{
|
|
||||||
Value: "//comment\n",
|
|
||||||
Type: meta.CommentType,
|
|
||||||
Position: nil,
|
|
||||||
},
|
|
||||||
&meta.Data{
|
|
||||||
Value: " ",
|
|
||||||
Type: meta.WhiteSpaceType,
|
|
||||||
Position: nil,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
for _, n := range nodes {
|
|
||||||
n.GetMeta().Push(*expected...)
|
|
||||||
actual := n.GetMeta()
|
|
||||||
assertEqual(t, expected, actual)
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,6 +3,8 @@ package assign_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"gotest.tools/assert"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -11,6 +13,6 @@ func TestPosition(t *testing.T) {
|
|||||||
for _, n := range nodes {
|
for _, n := range nodes {
|
||||||
n.SetPosition(expected)
|
n.SetPosition(expected)
|
||||||
actual := n.GetPosition()
|
actual := n.GetPosition()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
package assign_test
|
package assign_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"reflect"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node/expr/assign"
|
"gotest.tools/assert"
|
||||||
|
|
||||||
"github.com/kylelemons/godebug/pretty"
|
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/node/expr"
|
"github.com/z7zmey/php-parser/node/expr"
|
||||||
|
"github.com/z7zmey/php-parser/node/expr/assign"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -24,7 +22,7 @@ var nodesToTest = []struct {
|
|||||||
Expression: &expr.Variable{},
|
Expression: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Variable", "Expression"},
|
[]string{"Variable", "Expression"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&assign.Assign{
|
&assign.Assign{
|
||||||
@ -32,7 +30,7 @@ var nodesToTest = []struct {
|
|||||||
Expression: &expr.Variable{},
|
Expression: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Variable", "Expression"},
|
[]string{"Variable", "Expression"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&assign.BitwiseAnd{
|
&assign.BitwiseAnd{
|
||||||
@ -40,7 +38,7 @@ var nodesToTest = []struct {
|
|||||||
Expression: &expr.Variable{},
|
Expression: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Variable", "Expression"},
|
[]string{"Variable", "Expression"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&assign.BitwiseOr{
|
&assign.BitwiseOr{
|
||||||
@ -48,7 +46,7 @@ var nodesToTest = []struct {
|
|||||||
Expression: &expr.Variable{},
|
Expression: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Variable", "Expression"},
|
[]string{"Variable", "Expression"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&assign.BitwiseXor{
|
&assign.BitwiseXor{
|
||||||
@ -56,7 +54,7 @@ var nodesToTest = []struct {
|
|||||||
Expression: &expr.Variable{},
|
Expression: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Variable", "Expression"},
|
[]string{"Variable", "Expression"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&assign.Concat{
|
&assign.Concat{
|
||||||
@ -64,7 +62,7 @@ var nodesToTest = []struct {
|
|||||||
Expression: &expr.Variable{},
|
Expression: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Variable", "Expression"},
|
[]string{"Variable", "Expression"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&assign.Div{
|
&assign.Div{
|
||||||
@ -72,7 +70,7 @@ var nodesToTest = []struct {
|
|||||||
Expression: &expr.Variable{},
|
Expression: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Variable", "Expression"},
|
[]string{"Variable", "Expression"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&assign.Minus{
|
&assign.Minus{
|
||||||
@ -80,7 +78,7 @@ var nodesToTest = []struct {
|
|||||||
Expression: &expr.Variable{},
|
Expression: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Variable", "Expression"},
|
[]string{"Variable", "Expression"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&assign.Mod{
|
&assign.Mod{
|
||||||
@ -88,7 +86,7 @@ var nodesToTest = []struct {
|
|||||||
Expression: &expr.Variable{},
|
Expression: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Variable", "Expression"},
|
[]string{"Variable", "Expression"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&assign.Mul{
|
&assign.Mul{
|
||||||
@ -96,7 +94,7 @@ var nodesToTest = []struct {
|
|||||||
Expression: &expr.Variable{},
|
Expression: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Variable", "Expression"},
|
[]string{"Variable", "Expression"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&assign.Plus{
|
&assign.Plus{
|
||||||
@ -104,7 +102,7 @@ var nodesToTest = []struct {
|
|||||||
Expression: &expr.Variable{},
|
Expression: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Variable", "Expression"},
|
[]string{"Variable", "Expression"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&assign.Pow{
|
&assign.Pow{
|
||||||
@ -112,7 +110,7 @@ var nodesToTest = []struct {
|
|||||||
Expression: &expr.Variable{},
|
Expression: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Variable", "Expression"},
|
[]string{"Variable", "Expression"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&assign.ShiftLeft{
|
&assign.ShiftLeft{
|
||||||
@ -120,7 +118,7 @@ var nodesToTest = []struct {
|
|||||||
Expression: &expr.Variable{},
|
Expression: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Variable", "Expression"},
|
[]string{"Variable", "Expression"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&assign.ShiftRight{
|
&assign.ShiftRight{
|
||||||
@ -128,7 +126,7 @@ var nodesToTest = []struct {
|
|||||||
Expression: &expr.Variable{},
|
Expression: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Variable", "Expression"},
|
[]string{"Variable", "Expression"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,31 +148,25 @@ func (v *visitorMock) LeaveChildList(key string, w walker.Walkable) {}
|
|||||||
|
|
||||||
func TestVisitorDisableChildren(t *testing.T) {
|
func TestVisitorDisableChildren(t *testing.T) {
|
||||||
for _, tt := range nodesToTest {
|
for _, tt := range nodesToTest {
|
||||||
v := &visitorMock{false, nil}
|
v := &visitorMock{false, []string{}}
|
||||||
tt.node.Walk(v)
|
tt.node.Walk(v)
|
||||||
|
|
||||||
expected := []string{}
|
expected := []string{}
|
||||||
actual := v.visitedKeys
|
actual := v.visitedKeys
|
||||||
|
|
||||||
diff := pretty.Compare(expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("%s diff: (-expected +actual)\n%s", reflect.TypeOf(tt.node), diff)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVisitor(t *testing.T) {
|
func TestVisitor(t *testing.T) {
|
||||||
for _, tt := range nodesToTest {
|
for _, tt := range nodesToTest {
|
||||||
v := &visitorMock{true, nil}
|
v := &visitorMock{true, []string{}}
|
||||||
tt.node.Walk(v)
|
tt.node.Walk(v)
|
||||||
|
|
||||||
expected := tt.expectedVisitedKeys
|
expected := tt.expectedVisitedKeys
|
||||||
actual := v.visitedKeys
|
actual := v.visitedKeys
|
||||||
|
|
||||||
diff := pretty.Compare(expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("%s diff: (-expected +actual)\n%s", reflect.TypeOf(tt.node), diff)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,9 +177,6 @@ func TestNameAttributes(t *testing.T) {
|
|||||||
expected := tt.expectedAttributes
|
expected := tt.expectedAttributes
|
||||||
actual := tt.node.Attributes()
|
actual := tt.node.Attributes()
|
||||||
|
|
||||||
diff := pretty.Compare(expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("%s diff: (-expected +actual)\n%s", reflect.TypeOf(tt.node), diff)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// BitwiseAnd node
|
// BitwiseAnd node
|
||||||
type BitwiseAnd struct {
|
type BitwiseAnd struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type BitwiseAnd struct {
|
|||||||
// NewBitwiseAnd node constructor
|
// NewBitwiseAnd node constructor
|
||||||
func NewBitwiseAnd(Variable node.Node, Expression node.Node) *BitwiseAnd {
|
func NewBitwiseAnd(Variable node.Node, Expression node.Node) *BitwiseAnd {
|
||||||
return &BitwiseAnd{
|
return &BitwiseAnd{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *BitwiseAnd) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *BitwiseAnd) GetMeta() *meta.Collection {
|
func (n *BitwiseAnd) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// BitwiseOr node
|
// BitwiseOr node
|
||||||
type BitwiseOr struct {
|
type BitwiseOr struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type BitwiseOr struct {
|
|||||||
// NewBitwiseOr node constructor
|
// NewBitwiseOr node constructor
|
||||||
func NewBitwiseOr(Variable node.Node, Expression node.Node) *BitwiseOr {
|
func NewBitwiseOr(Variable node.Node, Expression node.Node) *BitwiseOr {
|
||||||
return &BitwiseOr{
|
return &BitwiseOr{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *BitwiseOr) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *BitwiseOr) GetMeta() *meta.Collection {
|
func (n *BitwiseOr) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// BitwiseXor node
|
// BitwiseXor node
|
||||||
type BitwiseXor struct {
|
type BitwiseXor struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type BitwiseXor struct {
|
|||||||
// NewBitwiseXor node constructor
|
// NewBitwiseXor node constructor
|
||||||
func NewBitwiseXor(Variable node.Node, Expression node.Node) *BitwiseXor {
|
func NewBitwiseXor(Variable node.Node, Expression node.Node) *BitwiseXor {
|
||||||
return &BitwiseXor{
|
return &BitwiseXor{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *BitwiseXor) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *BitwiseXor) GetMeta() *meta.Collection {
|
func (n *BitwiseXor) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// BooleanAnd node
|
// BooleanAnd node
|
||||||
type BooleanAnd struct {
|
type BooleanAnd struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type BooleanAnd struct {
|
|||||||
// NewBooleanAnd node constructor
|
// NewBooleanAnd node constructor
|
||||||
func NewBooleanAnd(Variable node.Node, Expression node.Node) *BooleanAnd {
|
func NewBooleanAnd(Variable node.Node, Expression node.Node) *BooleanAnd {
|
||||||
return &BooleanAnd{
|
return &BooleanAnd{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *BooleanAnd) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *BooleanAnd) GetMeta() *meta.Collection {
|
func (n *BooleanAnd) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// BooleanOr node
|
// BooleanOr node
|
||||||
type BooleanOr struct {
|
type BooleanOr struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type BooleanOr struct {
|
|||||||
// NewBooleanOr node constructor
|
// NewBooleanOr node constructor
|
||||||
func NewBooleanOr(Variable node.Node, Expression node.Node) *BooleanOr {
|
func NewBooleanOr(Variable node.Node, Expression node.Node) *BooleanOr {
|
||||||
return &BooleanOr{
|
return &BooleanOr{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *BooleanOr) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *BooleanOr) GetMeta() *meta.Collection {
|
func (n *BooleanOr) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Coalesce node
|
// Coalesce node
|
||||||
type Coalesce struct {
|
type Coalesce struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type Coalesce struct {
|
|||||||
// NewCoalesce node constructor
|
// NewCoalesce node constructor
|
||||||
func NewCoalesce(Variable node.Node, Expression node.Node) *Coalesce {
|
func NewCoalesce(Variable node.Node, Expression node.Node) *Coalesce {
|
||||||
return &Coalesce{
|
return &Coalesce{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Coalesce) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Coalesce) GetMeta() *meta.Collection {
|
func (n *Coalesce) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Concat node
|
// Concat node
|
||||||
type Concat struct {
|
type Concat struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type Concat struct {
|
|||||||
// NewConcat node constructor
|
// NewConcat node constructor
|
||||||
func NewConcat(Variable node.Node, Expression node.Node) *Concat {
|
func NewConcat(Variable node.Node, Expression node.Node) *Concat {
|
||||||
return &Concat{
|
return &Concat{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Concat) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Concat) GetMeta() *meta.Collection {
|
func (n *Concat) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Div node
|
// Div node
|
||||||
type Div struct {
|
type Div struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type Div struct {
|
|||||||
// NewDiv node constructor
|
// NewDiv node constructor
|
||||||
func NewDiv(Variable node.Node, Expression node.Node) *Div {
|
func NewDiv(Variable node.Node, Expression node.Node) *Div {
|
||||||
return &Div{
|
return &Div{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Div) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Div) GetMeta() *meta.Collection {
|
func (n *Div) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Equal node
|
// Equal node
|
||||||
type Equal struct {
|
type Equal struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type Equal struct {
|
|||||||
// NewEqual node constructor
|
// NewEqual node constructor
|
||||||
func NewEqual(Variable node.Node, Expression node.Node) *Equal {
|
func NewEqual(Variable node.Node, Expression node.Node) *Equal {
|
||||||
return &Equal{
|
return &Equal{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Equal) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Equal) GetMeta() *meta.Collection {
|
func (n *Equal) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Greater node
|
// Greater node
|
||||||
type Greater struct {
|
type Greater struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type Greater struct {
|
|||||||
// NewGreater node constructor
|
// NewGreater node constructor
|
||||||
func NewGreater(Variable node.Node, Expression node.Node) *Greater {
|
func NewGreater(Variable node.Node, Expression node.Node) *Greater {
|
||||||
return &Greater{
|
return &Greater{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Greater) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Greater) GetMeta() *meta.Collection {
|
func (n *Greater) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// GreaterOrEqual node
|
// GreaterOrEqual node
|
||||||
type GreaterOrEqual struct {
|
type GreaterOrEqual struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type GreaterOrEqual struct {
|
|||||||
// NewGreaterOrEqual node constructor
|
// NewGreaterOrEqual node constructor
|
||||||
func NewGreaterOrEqual(Variable node.Node, Expression node.Node) *GreaterOrEqual {
|
func NewGreaterOrEqual(Variable node.Node, Expression node.Node) *GreaterOrEqual {
|
||||||
return &GreaterOrEqual{
|
return &GreaterOrEqual{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *GreaterOrEqual) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *GreaterOrEqual) GetMeta() *meta.Collection {
|
func (n *GreaterOrEqual) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Identical node
|
// Identical node
|
||||||
type Identical struct {
|
type Identical struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type Identical struct {
|
|||||||
// NewIdentical node constructor
|
// NewIdentical node constructor
|
||||||
func NewIdentical(Variable node.Node, Expression node.Node) *Identical {
|
func NewIdentical(Variable node.Node, Expression node.Node) *Identical {
|
||||||
return &Identical{
|
return &Identical{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Identical) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Identical) GetMeta() *meta.Collection {
|
func (n *Identical) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// LogicalAnd node
|
// LogicalAnd node
|
||||||
type LogicalAnd struct {
|
type LogicalAnd struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type LogicalAnd struct {
|
|||||||
// NewLogicalAnd node constructor
|
// NewLogicalAnd node constructor
|
||||||
func NewLogicalAnd(Variable node.Node, Expression node.Node) *LogicalAnd {
|
func NewLogicalAnd(Variable node.Node, Expression node.Node) *LogicalAnd {
|
||||||
return &LogicalAnd{
|
return &LogicalAnd{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *LogicalAnd) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *LogicalAnd) GetMeta() *meta.Collection {
|
func (n *LogicalAnd) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// LogicalOr node
|
// LogicalOr node
|
||||||
type LogicalOr struct {
|
type LogicalOr struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type LogicalOr struct {
|
|||||||
// NewLogicalOr node constructor
|
// NewLogicalOr node constructor
|
||||||
func NewLogicalOr(Variable node.Node, Expression node.Node) *LogicalOr {
|
func NewLogicalOr(Variable node.Node, Expression node.Node) *LogicalOr {
|
||||||
return &LogicalOr{
|
return &LogicalOr{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *LogicalOr) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *LogicalOr) GetMeta() *meta.Collection {
|
func (n *LogicalOr) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// LogicalXor node
|
// LogicalXor node
|
||||||
type LogicalXor struct {
|
type LogicalXor struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type LogicalXor struct {
|
|||||||
// NewLogicalXor node constructor
|
// NewLogicalXor node constructor
|
||||||
func NewLogicalXor(Variable node.Node, Expression node.Node) *LogicalXor {
|
func NewLogicalXor(Variable node.Node, Expression node.Node) *LogicalXor {
|
||||||
return &LogicalXor{
|
return &LogicalXor{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *LogicalXor) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *LogicalXor) GetMeta() *meta.Collection {
|
func (n *LogicalXor) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Minus node
|
// Minus node
|
||||||
type Minus struct {
|
type Minus struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type Minus struct {
|
|||||||
// NewMinus node constructor
|
// NewMinus node constructor
|
||||||
func NewMinus(Variable node.Node, Expression node.Node) *Minus {
|
func NewMinus(Variable node.Node, Expression node.Node) *Minus {
|
||||||
return &Minus{
|
return &Minus{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Minus) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Minus) GetMeta() *meta.Collection {
|
func (n *Minus) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Mod node
|
// Mod node
|
||||||
type Mod struct {
|
type Mod struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type Mod struct {
|
|||||||
// NewMod node constructor
|
// NewMod node constructor
|
||||||
func NewMod(Variable node.Node, Expression node.Node) *Mod {
|
func NewMod(Variable node.Node, Expression node.Node) *Mod {
|
||||||
return &Mod{
|
return &Mod{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Mod) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Mod) GetMeta() *meta.Collection {
|
func (n *Mod) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Mul node
|
// Mul node
|
||||||
type Mul struct {
|
type Mul struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type Mul struct {
|
|||||||
// NewMul node constructor
|
// NewMul node constructor
|
||||||
func NewMul(Variable node.Node, Expression node.Node) *Mul {
|
func NewMul(Variable node.Node, Expression node.Node) *Mul {
|
||||||
return &Mul{
|
return &Mul{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Mul) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Mul) GetMeta() *meta.Collection {
|
func (n *Mul) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// NotEqual node
|
// NotEqual node
|
||||||
type NotEqual struct {
|
type NotEqual struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type NotEqual struct {
|
|||||||
// NewNotEqual node constructor
|
// NewNotEqual node constructor
|
||||||
func NewNotEqual(Variable node.Node, Expression node.Node) *NotEqual {
|
func NewNotEqual(Variable node.Node, Expression node.Node) *NotEqual {
|
||||||
return &NotEqual{
|
return &NotEqual{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *NotEqual) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *NotEqual) GetMeta() *meta.Collection {
|
func (n *NotEqual) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// NotIdentical node
|
// NotIdentical node
|
||||||
type NotIdentical struct {
|
type NotIdentical struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type NotIdentical struct {
|
|||||||
// NewNotIdentical node constructor
|
// NewNotIdentical node constructor
|
||||||
func NewNotIdentical(Variable node.Node, Expression node.Node) *NotIdentical {
|
func NewNotIdentical(Variable node.Node, Expression node.Node) *NotIdentical {
|
||||||
return &NotIdentical{
|
return &NotIdentical{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *NotIdentical) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *NotIdentical) GetMeta() *meta.Collection {
|
func (n *NotIdentical) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Plus node
|
// Plus node
|
||||||
type Plus struct {
|
type Plus struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type Plus struct {
|
|||||||
// NewPlus node constructor
|
// NewPlus node constructor
|
||||||
func NewPlus(Variable node.Node, Expression node.Node) *Plus {
|
func NewPlus(Variable node.Node, Expression node.Node) *Plus {
|
||||||
return &Plus{
|
return &Plus{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Plus) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Plus) GetMeta() *meta.Collection {
|
func (n *Plus) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Pow node
|
// Pow node
|
||||||
type Pow struct {
|
type Pow struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type Pow struct {
|
|||||||
// NewPow node constructor
|
// NewPow node constructor
|
||||||
func NewPow(Variable node.Node, Expression node.Node) *Pow {
|
func NewPow(Variable node.Node, Expression node.Node) *Pow {
|
||||||
return &Pow{
|
return &Pow{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Pow) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Pow) GetMeta() *meta.Collection {
|
func (n *Pow) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// ShiftLeft node
|
// ShiftLeft node
|
||||||
type ShiftLeft struct {
|
type ShiftLeft struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type ShiftLeft struct {
|
|||||||
// NewShiftLeft node constructor
|
// NewShiftLeft node constructor
|
||||||
func NewShiftLeft(Variable node.Node, Expression node.Node) *ShiftLeft {
|
func NewShiftLeft(Variable node.Node, Expression node.Node) *ShiftLeft {
|
||||||
return &ShiftLeft{
|
return &ShiftLeft{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *ShiftLeft) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ShiftLeft) GetMeta() *meta.Collection {
|
func (n *ShiftLeft) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// ShiftRight node
|
// ShiftRight node
|
||||||
type ShiftRight struct {
|
type ShiftRight struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type ShiftRight struct {
|
|||||||
// NewShiftRight node constructor
|
// NewShiftRight node constructor
|
||||||
func NewShiftRight(Variable node.Node, Expression node.Node) *ShiftRight {
|
func NewShiftRight(Variable node.Node, Expression node.Node) *ShiftRight {
|
||||||
return &ShiftRight{
|
return &ShiftRight{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *ShiftRight) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ShiftRight) GetMeta() *meta.Collection {
|
func (n *ShiftRight) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Smaller node
|
// Smaller node
|
||||||
type Smaller struct {
|
type Smaller struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type Smaller struct {
|
|||||||
// NewSmaller node constructor
|
// NewSmaller node constructor
|
||||||
func NewSmaller(Variable node.Node, Expression node.Node) *Smaller {
|
func NewSmaller(Variable node.Node, Expression node.Node) *Smaller {
|
||||||
return &Smaller{
|
return &Smaller{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Smaller) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Smaller) GetMeta() *meta.Collection {
|
func (n *Smaller) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// SmallerOrEqual node
|
// SmallerOrEqual node
|
||||||
type SmallerOrEqual struct {
|
type SmallerOrEqual struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type SmallerOrEqual struct {
|
|||||||
// NewSmallerOrEqual node constructor
|
// NewSmallerOrEqual node constructor
|
||||||
func NewSmallerOrEqual(Variable node.Node, Expression node.Node) *SmallerOrEqual {
|
func NewSmallerOrEqual(Variable node.Node, Expression node.Node) *SmallerOrEqual {
|
||||||
return &SmallerOrEqual{
|
return &SmallerOrEqual{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *SmallerOrEqual) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *SmallerOrEqual) GetMeta() *meta.Collection {
|
func (n *SmallerOrEqual) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package binary
|
package binary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Spaceship node
|
// Spaceship node
|
||||||
type Spaceship struct {
|
type Spaceship struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Left node.Node
|
Left node.Node
|
||||||
Right node.Node
|
Right node.Node
|
||||||
@ -18,6 +18,7 @@ type Spaceship struct {
|
|||||||
// NewSpaceship node constructor
|
// NewSpaceship node constructor
|
||||||
func NewSpaceship(Variable node.Node, Expression node.Node) *Spaceship {
|
func NewSpaceship(Variable node.Node, Expression node.Node) *Spaceship {
|
||||||
return &Spaceship{
|
return &Spaceship{
|
||||||
|
FreeFloating: nil,
|
||||||
Left: Variable,
|
Left: Variable,
|
||||||
Right: Expression,
|
Right: Expression,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *Spaceship) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Spaceship) GetMeta() *meta.Collection {
|
func (n *Spaceship) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -2,10 +2,9 @@ package binary_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"reflect"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/kylelemons/godebug/pretty"
|
"gotest.tools/assert"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/node/expr"
|
"github.com/z7zmey/php-parser/node/expr"
|
||||||
@ -16,18 +15,6 @@ import (
|
|||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
)
|
)
|
||||||
|
|
||||||
func assertEqual(t *testing.T, expected interface{}, actual interface{}) {
|
|
||||||
if !reflect.DeepEqual(expected, actual) {
|
|
||||||
diff := pretty.Compare(expected, actual)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("diff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("expected and actual are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestBitwiseAnd(t *testing.T) {
|
func TestBitwiseAnd(t *testing.T) {
|
||||||
src := `<? $a & $b;`
|
src := `<? $a & $b;`
|
||||||
|
|
||||||
@ -95,12 +82,12 @@ func TestBitwiseAnd(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBitwiseOr(t *testing.T) {
|
func TestBitwiseOr(t *testing.T) {
|
||||||
@ -170,12 +157,12 @@ func TestBitwiseOr(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBitwiseXor(t *testing.T) {
|
func TestBitwiseXor(t *testing.T) {
|
||||||
@ -245,12 +232,12 @@ func TestBitwiseXor(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBooleanAnd(t *testing.T) {
|
func TestBooleanAnd(t *testing.T) {
|
||||||
@ -320,12 +307,12 @@ func TestBooleanAnd(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBooleanOr(t *testing.T) {
|
func TestBooleanOr(t *testing.T) {
|
||||||
@ -395,12 +382,12 @@ func TestBooleanOr(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCoalesce(t *testing.T) {
|
func TestCoalesce(t *testing.T) {
|
||||||
@ -470,7 +457,7 @@ func TestCoalesce(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConcat(t *testing.T) {
|
func TestConcat(t *testing.T) {
|
||||||
@ -540,12 +527,12 @@ func TestConcat(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDiv(t *testing.T) {
|
func TestDiv(t *testing.T) {
|
||||||
@ -615,12 +602,12 @@ func TestDiv(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEqual(t *testing.T) {
|
func TestEqual(t *testing.T) {
|
||||||
@ -690,12 +677,12 @@ func TestEqual(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGreaterOrEqual(t *testing.T) {
|
func TestGreaterOrEqual(t *testing.T) {
|
||||||
@ -765,12 +752,12 @@ func TestGreaterOrEqual(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGreater(t *testing.T) {
|
func TestGreater(t *testing.T) {
|
||||||
@ -840,12 +827,12 @@ func TestGreater(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIdentical(t *testing.T) {
|
func TestIdentical(t *testing.T) {
|
||||||
@ -915,12 +902,12 @@ func TestIdentical(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLogicalAnd(t *testing.T) {
|
func TestLogicalAnd(t *testing.T) {
|
||||||
@ -990,12 +977,12 @@ func TestLogicalAnd(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLogicalOr(t *testing.T) {
|
func TestLogicalOr(t *testing.T) {
|
||||||
@ -1065,12 +1052,12 @@ func TestLogicalOr(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLogicalXor(t *testing.T) {
|
func TestLogicalXor(t *testing.T) {
|
||||||
@ -1140,12 +1127,12 @@ func TestLogicalXor(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMinus(t *testing.T) {
|
func TestMinus(t *testing.T) {
|
||||||
@ -1215,12 +1202,12 @@ func TestMinus(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMod(t *testing.T) {
|
func TestMod(t *testing.T) {
|
||||||
@ -1290,12 +1277,12 @@ func TestMod(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMul(t *testing.T) {
|
func TestMul(t *testing.T) {
|
||||||
@ -1365,12 +1352,12 @@ func TestMul(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNotEqual(t *testing.T) {
|
func TestNotEqual(t *testing.T) {
|
||||||
@ -1440,12 +1427,12 @@ func TestNotEqual(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNotIdentical(t *testing.T) {
|
func TestNotIdentical(t *testing.T) {
|
||||||
@ -1515,12 +1502,12 @@ func TestNotIdentical(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPlus(t *testing.T) {
|
func TestPlus(t *testing.T) {
|
||||||
@ -1590,12 +1577,12 @@ func TestPlus(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPow(t *testing.T) {
|
func TestPow(t *testing.T) {
|
||||||
@ -1665,12 +1652,12 @@ func TestPow(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestShiftLeft(t *testing.T) {
|
func TestShiftLeft(t *testing.T) {
|
||||||
@ -1740,12 +1727,12 @@ func TestShiftLeft(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestShiftRight(t *testing.T) {
|
func TestShiftRight(t *testing.T) {
|
||||||
@ -1815,12 +1802,12 @@ func TestShiftRight(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSmallerOrEqual(t *testing.T) {
|
func TestSmallerOrEqual(t *testing.T) {
|
||||||
@ -1890,12 +1877,12 @@ func TestSmallerOrEqual(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSmaller(t *testing.T) {
|
func TestSmaller(t *testing.T) {
|
||||||
@ -1965,12 +1952,12 @@ func TestSmaller(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSpaceship(t *testing.T) {
|
func TestSpaceship(t *testing.T) {
|
||||||
@ -2040,5 +2027,5 @@ func TestSpaceship(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
117
node/expr/binary/t_freefloating_test.go
Normal file
117
node/expr/binary/t_freefloating_test.go
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
package binary_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"gotest.tools/assert"
|
||||||
|
|
||||||
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
|
"github.com/z7zmey/php-parser/node"
|
||||||
|
"github.com/z7zmey/php-parser/node/expr/binary"
|
||||||
|
)
|
||||||
|
|
||||||
|
var expected freefloating.Collection = freefloating.Collection{
|
||||||
|
freefloating.Start: []freefloating.String{
|
||||||
|
{
|
||||||
|
StringType: freefloating.WhiteSpaceType,
|
||||||
|
Value: " ",
|
||||||
|
Position: nil,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
StringType: freefloating.CommentType,
|
||||||
|
Value: "//comment\n",
|
||||||
|
Position: nil,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
var nodes = []node.Node{
|
||||||
|
&binary.BitwiseAnd{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.BitwiseOr{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.BitwiseXor{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.BooleanAnd{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.BooleanOr{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.Coalesce{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.Concat{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.Div{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.Equal{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.GreaterOrEqual{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.Greater{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.Identical{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.LogicalAnd{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.LogicalOr{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.LogicalXor{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.Minus{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.Mod{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.Mul{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.NotEqual{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.NotIdentical{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.Plus{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.Pow{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.ShiftLeft{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.ShiftRight{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.SmallerOrEqual{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.Smaller{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&binary.Spaceship{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestMeta(t *testing.T) {
|
||||||
|
for _, n := range nodes {
|
||||||
|
actual := *n.GetFreeFloating()
|
||||||
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
}
|
||||||
|
}
|
@ -1,61 +0,0 @@
|
|||||||
package binary_test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node/expr/binary"
|
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/meta"
|
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
|
||||||
)
|
|
||||||
|
|
||||||
var nodes = []node.Node{
|
|
||||||
&binary.BitwiseAnd{},
|
|
||||||
&binary.BitwiseOr{},
|
|
||||||
&binary.BitwiseXor{},
|
|
||||||
&binary.BooleanAnd{},
|
|
||||||
&binary.BooleanOr{},
|
|
||||||
&binary.Coalesce{},
|
|
||||||
&binary.Concat{},
|
|
||||||
&binary.Div{},
|
|
||||||
&binary.Equal{},
|
|
||||||
&binary.GreaterOrEqual{},
|
|
||||||
&binary.Greater{},
|
|
||||||
&binary.Identical{},
|
|
||||||
&binary.LogicalAnd{},
|
|
||||||
&binary.LogicalOr{},
|
|
||||||
&binary.LogicalXor{},
|
|
||||||
&binary.Minus{},
|
|
||||||
&binary.Mod{},
|
|
||||||
&binary.Mul{},
|
|
||||||
&binary.NotEqual{},
|
|
||||||
&binary.NotIdentical{},
|
|
||||||
&binary.Plus{},
|
|
||||||
&binary.Pow{},
|
|
||||||
&binary.ShiftLeft{},
|
|
||||||
&binary.ShiftRight{},
|
|
||||||
&binary.SmallerOrEqual{},
|
|
||||||
&binary.Smaller{},
|
|
||||||
&binary.Spaceship{},
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMeta(t *testing.T) {
|
|
||||||
expected := &meta.Collection{
|
|
||||||
&meta.Data{
|
|
||||||
Value: "//comment\n",
|
|
||||||
Type: meta.CommentType,
|
|
||||||
Position: nil,
|
|
||||||
},
|
|
||||||
&meta.Data{
|
|
||||||
Value: " ",
|
|
||||||
Type: meta.WhiteSpaceType,
|
|
||||||
Position: nil,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
for _, n := range nodes {
|
|
||||||
n.GetMeta().Push(*expected...)
|
|
||||||
actual := n.GetMeta()
|
|
||||||
assertEqual(t, expected, actual)
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,6 +3,8 @@ package binary_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"gotest.tools/assert"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -11,6 +13,6 @@ func TestPosition(t *testing.T) {
|
|||||||
for _, n := range nodes {
|
for _, n := range nodes {
|
||||||
n.SetPosition(expected)
|
n.SetPosition(expected)
|
||||||
actual := n.GetPosition()
|
actual := n.GetPosition()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
package binary_test
|
package binary_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"reflect"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/kylelemons/godebug/pretty"
|
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/node/expr"
|
"github.com/z7zmey/php-parser/node/expr"
|
||||||
"github.com/z7zmey/php-parser/node/expr/binary"
|
"github.com/z7zmey/php-parser/node/expr/binary"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
|
"gotest.tools/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
var nodesToTest = []struct {
|
var nodesToTest = []struct {
|
||||||
@ -23,7 +21,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.BitwiseOr{
|
&binary.BitwiseOr{
|
||||||
@ -31,7 +29,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.BitwiseXor{
|
&binary.BitwiseXor{
|
||||||
@ -39,7 +37,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.BooleanAnd{
|
&binary.BooleanAnd{
|
||||||
@ -47,7 +45,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.BooleanOr{
|
&binary.BooleanOr{
|
||||||
@ -55,7 +53,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.Coalesce{
|
&binary.Coalesce{
|
||||||
@ -63,7 +61,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.Concat{
|
&binary.Concat{
|
||||||
@ -71,7 +69,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.Div{
|
&binary.Div{
|
||||||
@ -79,7 +77,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.Equal{
|
&binary.Equal{
|
||||||
@ -87,7 +85,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.GreaterOrEqual{
|
&binary.GreaterOrEqual{
|
||||||
@ -95,7 +93,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.Greater{
|
&binary.Greater{
|
||||||
@ -103,7 +101,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.Identical{
|
&binary.Identical{
|
||||||
@ -111,7 +109,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.LogicalAnd{
|
&binary.LogicalAnd{
|
||||||
@ -119,7 +117,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.LogicalOr{
|
&binary.LogicalOr{
|
||||||
@ -127,7 +125,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.LogicalXor{
|
&binary.LogicalXor{
|
||||||
@ -135,7 +133,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.Minus{
|
&binary.Minus{
|
||||||
@ -143,7 +141,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.Mod{
|
&binary.Mod{
|
||||||
@ -151,7 +149,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.Mul{
|
&binary.Mul{
|
||||||
@ -159,7 +157,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.NotEqual{
|
&binary.NotEqual{
|
||||||
@ -167,7 +165,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.NotIdentical{
|
&binary.NotIdentical{
|
||||||
@ -175,7 +173,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.Plus{
|
&binary.Plus{
|
||||||
@ -183,7 +181,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.Pow{
|
&binary.Pow{
|
||||||
@ -191,7 +189,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.ShiftLeft{
|
&binary.ShiftLeft{
|
||||||
@ -199,7 +197,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.ShiftRight{
|
&binary.ShiftRight{
|
||||||
@ -207,7 +205,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.SmallerOrEqual{
|
&binary.SmallerOrEqual{
|
||||||
@ -215,7 +213,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.Smaller{
|
&binary.Smaller{
|
||||||
@ -223,7 +221,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&binary.Spaceship{
|
&binary.Spaceship{
|
||||||
@ -231,7 +229,7 @@ var nodesToTest = []struct {
|
|||||||
Right: &expr.Variable{},
|
Right: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Left", "Right"},
|
[]string{"Left", "Right"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,31 +251,25 @@ func (v *visitorMock) LeaveChildList(key string, w walker.Walkable) {}
|
|||||||
|
|
||||||
func TestVisitorDisableChildren(t *testing.T) {
|
func TestVisitorDisableChildren(t *testing.T) {
|
||||||
for _, tt := range nodesToTest {
|
for _, tt := range nodesToTest {
|
||||||
v := &visitorMock{false, nil}
|
v := &visitorMock{false, []string{}}
|
||||||
tt.node.Walk(v)
|
tt.node.Walk(v)
|
||||||
|
|
||||||
expected := []string{}
|
expected := []string{}
|
||||||
actual := v.visitedKeys
|
actual := v.visitedKeys
|
||||||
|
|
||||||
diff := pretty.Compare(expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("%s diff: (-expected +actual)\n%s", reflect.TypeOf(tt.node), diff)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVisitor(t *testing.T) {
|
func TestVisitor(t *testing.T) {
|
||||||
for _, tt := range nodesToTest {
|
for _, tt := range nodesToTest {
|
||||||
v := &visitorMock{true, nil}
|
v := &visitorMock{true, []string{}}
|
||||||
tt.node.Walk(v)
|
tt.node.Walk(v)
|
||||||
|
|
||||||
expected := tt.expectedVisitedKeys
|
expected := tt.expectedVisitedKeys
|
||||||
actual := v.visitedKeys
|
actual := v.visitedKeys
|
||||||
|
|
||||||
diff := pretty.Compare(expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("%s diff: (-expected +actual)\n%s", reflect.TypeOf(tt.node), diff)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,9 +280,6 @@ func TestNameAttributes(t *testing.T) {
|
|||||||
expected := tt.expectedAttributes
|
expected := tt.expectedAttributes
|
||||||
actual := tt.node.Attributes()
|
actual := tt.node.Attributes()
|
||||||
|
|
||||||
diff := pretty.Compare(expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("%s diff: (-expected +actual)\n%s", reflect.TypeOf(tt.node), diff)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package cast
|
package cast
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Array node
|
// Array node
|
||||||
type Array struct {
|
type Array struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type Array struct {
|
|||||||
// NewArray node constructor
|
// NewArray node constructor
|
||||||
func NewArray(Expr node.Node) *Array {
|
func NewArray(Expr node.Node) *Array {
|
||||||
return &Array{
|
return &Array{
|
||||||
|
FreeFloating: nil,
|
||||||
Expr: Expr,
|
Expr: Expr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *Array) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Array) GetMeta() *meta.Collection {
|
func (n *Array) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package cast
|
package cast
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Bool node
|
// Bool node
|
||||||
type Bool struct {
|
type Bool struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type Bool struct {
|
|||||||
// NewBool node constructor
|
// NewBool node constructor
|
||||||
func NewBool(Expr node.Node) *Bool {
|
func NewBool(Expr node.Node) *Bool {
|
||||||
return &Bool{
|
return &Bool{
|
||||||
|
FreeFloating: nil,
|
||||||
Expr: Expr,
|
Expr: Expr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *Bool) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Bool) GetMeta() *meta.Collection {
|
func (n *Bool) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package cast
|
package cast
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Double node
|
// Double node
|
||||||
type Double struct {
|
type Double struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type Double struct {
|
|||||||
// NewDouble node constructor
|
// NewDouble node constructor
|
||||||
func NewDouble(Expr node.Node) *Double {
|
func NewDouble(Expr node.Node) *Double {
|
||||||
return &Double{
|
return &Double{
|
||||||
|
FreeFloating: nil,
|
||||||
Expr: Expr,
|
Expr: Expr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *Double) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Double) GetMeta() *meta.Collection {
|
func (n *Double) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package cast
|
package cast
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Int node
|
// Int node
|
||||||
type Int struct {
|
type Int struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type Int struct {
|
|||||||
// NewInt node constructor
|
// NewInt node constructor
|
||||||
func NewInt(Expr node.Node) *Int {
|
func NewInt(Expr node.Node) *Int {
|
||||||
return &Int{
|
return &Int{
|
||||||
|
FreeFloating: nil,
|
||||||
Expr: Expr,
|
Expr: Expr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *Int) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Int) GetMeta() *meta.Collection {
|
func (n *Int) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package cast
|
package cast
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Object node
|
// Object node
|
||||||
type Object struct {
|
type Object struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type Object struct {
|
|||||||
// NewObject node constructor
|
// NewObject node constructor
|
||||||
func NewObject(Expr node.Node) *Object {
|
func NewObject(Expr node.Node) *Object {
|
||||||
return &Object{
|
return &Object{
|
||||||
|
FreeFloating: nil,
|
||||||
Expr: Expr,
|
Expr: Expr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *Object) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Object) GetMeta() *meta.Collection {
|
func (n *Object) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package cast
|
package cast
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// String node
|
// String node
|
||||||
type String struct {
|
type String struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type String struct {
|
|||||||
// NewString node constructor
|
// NewString node constructor
|
||||||
func NewString(Expr node.Node) *String {
|
func NewString(Expr node.Node) *String {
|
||||||
return &String{
|
return &String{
|
||||||
|
FreeFloating: nil,
|
||||||
Expr: Expr,
|
Expr: Expr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *String) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *String) GetMeta() *meta.Collection {
|
func (n *String) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package cast
|
package cast
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Unset node
|
// Unset node
|
||||||
type Unset struct {
|
type Unset struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type Unset struct {
|
|||||||
// NewUnset node constructor
|
// NewUnset node constructor
|
||||||
func NewUnset(Expr node.Node) *Unset {
|
func NewUnset(Expr node.Node) *Unset {
|
||||||
return &Unset{
|
return &Unset{
|
||||||
|
FreeFloating: nil,
|
||||||
Expr: Expr,
|
Expr: Expr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *Unset) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Unset) GetMeta() *meta.Collection {
|
func (n *Unset) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -2,10 +2,9 @@ package cast_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"reflect"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/kylelemons/godebug/pretty"
|
"gotest.tools/assert"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/node/expr"
|
"github.com/z7zmey/php-parser/node/expr"
|
||||||
@ -16,18 +15,6 @@ import (
|
|||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
)
|
)
|
||||||
|
|
||||||
func assertEqual(t *testing.T, expected interface{}, actual interface{}) {
|
|
||||||
if !reflect.DeepEqual(expected, actual) {
|
|
||||||
diff := pretty.Compare(expected, actual)
|
|
||||||
|
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("diff: (-expected +actual)\n%s", diff)
|
|
||||||
} else {
|
|
||||||
t.Errorf("expected and actual are not equal\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestArray(t *testing.T) {
|
func TestArray(t *testing.T) {
|
||||||
src := `<? (array)$a;`
|
src := `<? (array)$a;`
|
||||||
|
|
||||||
@ -78,12 +65,12 @@ func TestArray(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBool(t *testing.T) {
|
func TestBool(t *testing.T) {
|
||||||
@ -136,12 +123,12 @@ func TestBool(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBoolShort(t *testing.T) {
|
func TestBoolShort(t *testing.T) {
|
||||||
@ -194,12 +181,12 @@ func TestBoolShort(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDouble(t *testing.T) {
|
func TestDouble(t *testing.T) {
|
||||||
@ -252,12 +239,12 @@ func TestDouble(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCastFloat(t *testing.T) {
|
func TestCastFloat(t *testing.T) {
|
||||||
@ -310,12 +297,12 @@ func TestCastFloat(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestInt(t *testing.T) {
|
func TestInt(t *testing.T) {
|
||||||
@ -368,12 +355,12 @@ func TestInt(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIntShort(t *testing.T) {
|
func TestIntShort(t *testing.T) {
|
||||||
@ -426,12 +413,12 @@ func TestIntShort(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestObject(t *testing.T) {
|
func TestObject(t *testing.T) {
|
||||||
@ -484,12 +471,12 @@ func TestObject(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestString(t *testing.T) {
|
func TestString(t *testing.T) {
|
||||||
@ -542,12 +529,12 @@ func TestString(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBinaryString(t *testing.T) {
|
func TestBinaryString(t *testing.T) {
|
||||||
@ -600,12 +587,12 @@ func TestBinaryString(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUnset(t *testing.T) {
|
func TestUnset(t *testing.T) {
|
||||||
@ -658,10 +645,10 @@ func TestUnset(t *testing.T) {
|
|||||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php7parser.Parse()
|
php7parser.Parse()
|
||||||
actual := php7parser.GetRootNode()
|
actual := php7parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
|
||||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||||
php5parser.Parse()
|
php5parser.Parse()
|
||||||
actual = php5parser.GetRootNode()
|
actual = php5parser.GetRootNode()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
57
node/expr/cast/t_freefloating_test.go
Normal file
57
node/expr/cast/t_freefloating_test.go
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
package cast_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"gotest.tools/assert"
|
||||||
|
|
||||||
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
|
"github.com/z7zmey/php-parser/node"
|
||||||
|
"github.com/z7zmey/php-parser/node/expr/cast"
|
||||||
|
)
|
||||||
|
|
||||||
|
var expected freefloating.Collection = freefloating.Collection{
|
||||||
|
freefloating.Start: []freefloating.String{
|
||||||
|
{
|
||||||
|
StringType: freefloating.WhiteSpaceType,
|
||||||
|
Value: " ",
|
||||||
|
Position: nil,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
StringType: freefloating.CommentType,
|
||||||
|
Value: "//comment\n",
|
||||||
|
Position: nil,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
var nodes = []node.Node{
|
||||||
|
&cast.Array{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&cast.Bool{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&cast.Double{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&cast.Int{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&cast.Object{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&cast.String{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
&cast.Unset{
|
||||||
|
FreeFloating: expected,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestMeta(t *testing.T) {
|
||||||
|
for _, n := range nodes {
|
||||||
|
actual := *n.GetFreeFloating()
|
||||||
|
assert.DeepEqual(t, expected, actual)
|
||||||
|
}
|
||||||
|
}
|
@ -1,41 +0,0 @@
|
|||||||
package cast_test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node/expr/cast"
|
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/meta"
|
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
|
||||||
)
|
|
||||||
|
|
||||||
var nodes = []node.Node{
|
|
||||||
&cast.Array{},
|
|
||||||
&cast.Bool{},
|
|
||||||
&cast.Double{},
|
|
||||||
&cast.Int{},
|
|
||||||
&cast.Object{},
|
|
||||||
&cast.String{},
|
|
||||||
&cast.Unset{},
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMeta(t *testing.T) {
|
|
||||||
expected := &meta.Collection{
|
|
||||||
&meta.Data{
|
|
||||||
Value: "//comment\n",
|
|
||||||
Type: meta.CommentType,
|
|
||||||
Position: nil,
|
|
||||||
},
|
|
||||||
&meta.Data{
|
|
||||||
Value: " ",
|
|
||||||
Type: meta.WhiteSpaceType,
|
|
||||||
Position: nil,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
for _, n := range nodes {
|
|
||||||
n.GetMeta().Push(*expected...)
|
|
||||||
actual := n.GetMeta()
|
|
||||||
assertEqual(t, expected, actual)
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,6 +3,8 @@ package cast_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"gotest.tools/assert"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -11,6 +13,6 @@ func TestPosition(t *testing.T) {
|
|||||||
for _, n := range nodes {
|
for _, n := range nodes {
|
||||||
n.SetPosition(expected)
|
n.SetPosition(expected)
|
||||||
actual := n.GetPosition()
|
actual := n.GetPosition()
|
||||||
assertEqual(t, expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
package cast_test
|
package cast_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"reflect"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/kylelemons/godebug/pretty"
|
"gotest.tools/assert"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/node/expr"
|
"github.com/z7zmey/php-parser/node/expr"
|
||||||
@ -22,49 +21,49 @@ var nodesToTest = []struct {
|
|||||||
Expr: &expr.Variable{},
|
Expr: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Expr"},
|
[]string{"Expr"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&cast.Bool{
|
&cast.Bool{
|
||||||
Expr: &expr.Variable{},
|
Expr: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Expr"},
|
[]string{"Expr"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&cast.Double{
|
&cast.Double{
|
||||||
Expr: &expr.Variable{},
|
Expr: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Expr"},
|
[]string{"Expr"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&cast.Int{
|
&cast.Int{
|
||||||
Expr: &expr.Variable{},
|
Expr: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Expr"},
|
[]string{"Expr"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&cast.Object{
|
&cast.Object{
|
||||||
Expr: &expr.Variable{},
|
Expr: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Expr"},
|
[]string{"Expr"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&cast.String{
|
&cast.String{
|
||||||
Expr: &expr.Variable{},
|
Expr: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Expr"},
|
[]string{"Expr"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&cast.Unset{
|
&cast.Unset{
|
||||||
Expr: &expr.Variable{},
|
Expr: &expr.Variable{},
|
||||||
},
|
},
|
||||||
[]string{"Expr"},
|
[]string{"Expr"},
|
||||||
map[string]interface{}{},
|
nil,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,31 +85,25 @@ func (v *visitorMock) LeaveChildList(key string, w walker.Walkable) {}
|
|||||||
|
|
||||||
func TestVisitorDisableChildren(t *testing.T) {
|
func TestVisitorDisableChildren(t *testing.T) {
|
||||||
for _, tt := range nodesToTest {
|
for _, tt := range nodesToTest {
|
||||||
v := &visitorMock{false, nil}
|
v := &visitorMock{false, []string{}}
|
||||||
tt.node.Walk(v)
|
tt.node.Walk(v)
|
||||||
|
|
||||||
expected := []string{}
|
expected := []string{}
|
||||||
actual := v.visitedKeys
|
actual := v.visitedKeys
|
||||||
|
|
||||||
diff := pretty.Compare(expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("%s diff: (-expected +actual)\n%s", reflect.TypeOf(tt.node), diff)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVisitor(t *testing.T) {
|
func TestVisitor(t *testing.T) {
|
||||||
for _, tt := range nodesToTest {
|
for _, tt := range nodesToTest {
|
||||||
v := &visitorMock{true, nil}
|
v := &visitorMock{true, []string{}}
|
||||||
tt.node.Walk(v)
|
tt.node.Walk(v)
|
||||||
|
|
||||||
expected := tt.expectedVisitedKeys
|
expected := tt.expectedVisitedKeys
|
||||||
actual := v.visitedKeys
|
actual := v.visitedKeys
|
||||||
|
|
||||||
diff := pretty.Compare(expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("%s diff: (-expected +actual)\n%s", reflect.TypeOf(tt.node), diff)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,9 +114,6 @@ func TestNameAttributes(t *testing.T) {
|
|||||||
expected := tt.expectedAttributes
|
expected := tt.expectedAttributes
|
||||||
actual := tt.node.Attributes()
|
actual := tt.node.Attributes()
|
||||||
|
|
||||||
diff := pretty.Compare(expected, actual)
|
assert.DeepEqual(t, expected, actual)
|
||||||
if diff != "" {
|
|
||||||
t.Errorf("%s diff: (-expected +actual)\n%s", reflect.TypeOf(tt.node), diff)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Array node
|
// Array node
|
||||||
type Array struct {
|
type Array struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Items []node.Node
|
Items []node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type Array struct {
|
|||||||
// NewArray node constructor
|
// NewArray node constructor
|
||||||
func NewArray(Items []node.Node) *Array {
|
func NewArray(Items []node.Node) *Array {
|
||||||
return &Array{
|
return &Array{
|
||||||
|
FreeFloating: nil,
|
||||||
Items: Items,
|
Items: Items,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *Array) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Array) GetMeta() *meta.Collection {
|
func (n *Array) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// ArrayDimFetch node
|
// ArrayDimFetch node
|
||||||
type ArrayDimFetch struct {
|
type ArrayDimFetch struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variable node.Node
|
Variable node.Node
|
||||||
Dim node.Node
|
Dim node.Node
|
||||||
@ -18,6 +18,7 @@ type ArrayDimFetch struct {
|
|||||||
// NewArrayDimFetch node constructor
|
// NewArrayDimFetch node constructor
|
||||||
func NewArrayDimFetch(Variable node.Node, Dim node.Node) *ArrayDimFetch {
|
func NewArrayDimFetch(Variable node.Node, Dim node.Node) *ArrayDimFetch {
|
||||||
return &ArrayDimFetch{
|
return &ArrayDimFetch{
|
||||||
|
FreeFloating: nil,
|
||||||
Variable: Variable,
|
Variable: Variable,
|
||||||
Dim: Dim,
|
Dim: Dim,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *ArrayDimFetch) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ArrayDimFetch) GetMeta() *meta.Collection {
|
func (n *ArrayDimFetch) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// ArrayItem node
|
// ArrayItem node
|
||||||
type ArrayItem struct {
|
type ArrayItem struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Key node.Node
|
Key node.Node
|
||||||
Val node.Node
|
Val node.Node
|
||||||
@ -18,6 +18,7 @@ type ArrayItem struct {
|
|||||||
// NewArrayItem node constructor
|
// NewArrayItem node constructor
|
||||||
func NewArrayItem(Key node.Node, Val node.Node) *ArrayItem {
|
func NewArrayItem(Key node.Node, Val node.Node) *ArrayItem {
|
||||||
return &ArrayItem{
|
return &ArrayItem{
|
||||||
|
FreeFloating: nil,
|
||||||
Key: Key,
|
Key: Key,
|
||||||
Val: Val,
|
Val: Val,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *ArrayItem) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ArrayItem) GetMeta() *meta.Collection {
|
func (n *ArrayItem) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// BitwiseNot node
|
// BitwiseNot node
|
||||||
type BitwiseNot struct {
|
type BitwiseNot struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type BitwiseNot struct {
|
|||||||
// NewBitwiseNot node constructor
|
// NewBitwiseNot node constructor
|
||||||
func NewBitwiseNot(Expression node.Node) *BitwiseNot {
|
func NewBitwiseNot(Expression node.Node) *BitwiseNot {
|
||||||
return &BitwiseNot{
|
return &BitwiseNot{
|
||||||
|
FreeFloating: nil,
|
||||||
Expr: Expression,
|
Expr: Expression,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *BitwiseNot) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *BitwiseNot) GetMeta() *meta.Collection {
|
func (n *BitwiseNot) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// BooleanNot node
|
// BooleanNot node
|
||||||
type BooleanNot struct {
|
type BooleanNot struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type BooleanNot struct {
|
|||||||
// NewBooleanNot node constructor
|
// NewBooleanNot node constructor
|
||||||
func NewBooleanNot(Expression node.Node) *BooleanNot {
|
func NewBooleanNot(Expression node.Node) *BooleanNot {
|
||||||
return &BooleanNot{
|
return &BooleanNot{
|
||||||
|
FreeFloating: nil,
|
||||||
Expr: Expression,
|
Expr: Expression,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *BooleanNot) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *BooleanNot) GetMeta() *meta.Collection {
|
func (n *BooleanNot) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// ClassConstFetch node
|
// ClassConstFetch node
|
||||||
type ClassConstFetch struct {
|
type ClassConstFetch struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Class node.Node
|
Class node.Node
|
||||||
ConstantName node.Node
|
ConstantName node.Node
|
||||||
@ -18,6 +18,7 @@ type ClassConstFetch struct {
|
|||||||
// NewClassConstFetch node constructor
|
// NewClassConstFetch node constructor
|
||||||
func NewClassConstFetch(Class node.Node, ConstantName node.Node) *ClassConstFetch {
|
func NewClassConstFetch(Class node.Node, ConstantName node.Node) *ClassConstFetch {
|
||||||
return &ClassConstFetch{
|
return &ClassConstFetch{
|
||||||
|
FreeFloating: nil,
|
||||||
Class: Class,
|
Class: Class,
|
||||||
ConstantName: ConstantName,
|
ConstantName: ConstantName,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *ClassConstFetch) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ClassConstFetch) GetMeta() *meta.Collection {
|
func (n *ClassConstFetch) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Clone node
|
// Clone node
|
||||||
type Clone struct {
|
type Clone struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type Clone struct {
|
|||||||
// NewClone node constructor
|
// NewClone node constructor
|
||||||
func NewClone(Expression node.Node) *Clone {
|
func NewClone(Expression node.Node) *Clone {
|
||||||
return &Clone{
|
return &Clone{
|
||||||
|
FreeFloating: nil,
|
||||||
Expr: Expression,
|
Expr: Expression,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *Clone) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Clone) GetMeta() *meta.Collection {
|
func (n *Clone) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Closure node
|
// Closure node
|
||||||
type Closure struct {
|
type Closure struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
ReturnsRef bool
|
ReturnsRef bool
|
||||||
Static bool
|
Static bool
|
||||||
@ -23,6 +23,7 @@ type Closure struct {
|
|||||||
// NewClosure node constructor
|
// NewClosure node constructor
|
||||||
func NewClosure(Params []node.Node, ClosureUse *ClosureUse, ReturnType node.Node, Stmts []node.Node, Static bool, ReturnsRef bool, PhpDocComment string) *Closure {
|
func NewClosure(Params []node.Node, ClosureUse *ClosureUse, ReturnType node.Node, Stmts []node.Node, Static bool, ReturnsRef bool, PhpDocComment string) *Closure {
|
||||||
return &Closure{
|
return &Closure{
|
||||||
|
FreeFloating: nil,
|
||||||
ReturnsRef: ReturnsRef,
|
ReturnsRef: ReturnsRef,
|
||||||
Static: Static,
|
Static: Static,
|
||||||
PhpDocComment: PhpDocComment,
|
PhpDocComment: PhpDocComment,
|
||||||
@ -43,8 +44,8 @@ func (n *Closure) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Closure) GetMeta() *meta.Collection {
|
func (n *Closure) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// ClosureUse node
|
// ClosureUse node
|
||||||
type ClosureUse struct {
|
type ClosureUse struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Uses []node.Node
|
Uses []node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type ClosureUse struct {
|
|||||||
// NewClosureUse node constructor
|
// NewClosureUse node constructor
|
||||||
func NewClosureUse(Uses []node.Node) *ClosureUse {
|
func NewClosureUse(Uses []node.Node) *ClosureUse {
|
||||||
return &ClosureUse{
|
return &ClosureUse{
|
||||||
|
FreeFloating: nil,
|
||||||
Uses: Uses,
|
Uses: Uses,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *ClosureUse) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ClosureUse) GetMeta() *meta.Collection {
|
func (n *ClosureUse) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// ConstFetch node
|
// ConstFetch node
|
||||||
type ConstFetch struct {
|
type ConstFetch struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Constant node.Node
|
Constant node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type ConstFetch struct {
|
|||||||
// NewConstFetch node constructor
|
// NewConstFetch node constructor
|
||||||
func NewConstFetch(Constant node.Node) *ConstFetch {
|
func NewConstFetch(Constant node.Node) *ConstFetch {
|
||||||
return &ConstFetch{
|
return &ConstFetch{
|
||||||
|
FreeFloating: nil,
|
||||||
Constant: Constant,
|
Constant: Constant,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *ConstFetch) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ConstFetch) GetMeta() *meta.Collection {
|
func (n *ConstFetch) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Empty node
|
// Empty node
|
||||||
type Empty struct {
|
type Empty struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type Empty struct {
|
|||||||
// NewEmpty node constructor
|
// NewEmpty node constructor
|
||||||
func NewEmpty(Expression node.Node) *Empty {
|
func NewEmpty(Expression node.Node) *Empty {
|
||||||
return &Empty{
|
return &Empty{
|
||||||
|
FreeFloating: nil,
|
||||||
Expr: Expression,
|
Expr: Expression,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *Empty) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Empty) GetMeta() *meta.Collection {
|
func (n *Empty) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// ErrorSuppress node
|
// ErrorSuppress node
|
||||||
type ErrorSuppress struct {
|
type ErrorSuppress struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type ErrorSuppress struct {
|
|||||||
// NewErrorSuppress node constructor
|
// NewErrorSuppress node constructor
|
||||||
func NewErrorSuppress(Expression node.Node) *ErrorSuppress {
|
func NewErrorSuppress(Expression node.Node) *ErrorSuppress {
|
||||||
return &ErrorSuppress{
|
return &ErrorSuppress{
|
||||||
|
FreeFloating: nil,
|
||||||
Expr: Expression,
|
Expr: Expression,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *ErrorSuppress) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ErrorSuppress) GetMeta() *meta.Collection {
|
func (n *ErrorSuppress) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Eval node
|
// Eval node
|
||||||
type Eval struct {
|
type Eval struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type Eval struct {
|
|||||||
// NewEval node constructor
|
// NewEval node constructor
|
||||||
func NewEval(Expression node.Node) *Eval {
|
func NewEval(Expression node.Node) *Eval {
|
||||||
return &Eval{
|
return &Eval{
|
||||||
|
FreeFloating: nil,
|
||||||
Expr: Expression,
|
Expr: Expression,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *Eval) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Eval) GetMeta() *meta.Collection {
|
func (n *Eval) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Exit node
|
// Exit node
|
||||||
type Exit struct {
|
type Exit struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Die bool
|
Die bool
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
@ -18,6 +18,7 @@ type Exit struct {
|
|||||||
// NewExit node constructor
|
// NewExit node constructor
|
||||||
func NewExit(Expr node.Node) *Exit {
|
func NewExit(Expr node.Node) *Exit {
|
||||||
return &Exit{
|
return &Exit{
|
||||||
|
FreeFloating: nil,
|
||||||
Expr: Expr,
|
Expr: Expr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -32,8 +33,8 @@ func (n *Exit) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Exit) GetMeta() *meta.Collection {
|
func (n *Exit) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// FunctionCall node
|
// FunctionCall node
|
||||||
type FunctionCall struct {
|
type FunctionCall struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Function node.Node
|
Function node.Node
|
||||||
ArgumentList *node.ArgumentList
|
ArgumentList *node.ArgumentList
|
||||||
@ -18,6 +18,7 @@ type FunctionCall struct {
|
|||||||
// NewFunctionCall node constructor
|
// NewFunctionCall node constructor
|
||||||
func NewFunctionCall(Function node.Node, ArgumentList *node.ArgumentList) *FunctionCall {
|
func NewFunctionCall(Function node.Node, ArgumentList *node.ArgumentList) *FunctionCall {
|
||||||
return &FunctionCall{
|
return &FunctionCall{
|
||||||
|
FreeFloating: nil,
|
||||||
Function: Function,
|
Function: Function,
|
||||||
ArgumentList: ArgumentList,
|
ArgumentList: ArgumentList,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *FunctionCall) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *FunctionCall) GetMeta() *meta.Collection {
|
func (n *FunctionCall) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Include node
|
// Include node
|
||||||
type Include struct {
|
type Include struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type Include struct {
|
|||||||
// NewInclude node constructor
|
// NewInclude node constructor
|
||||||
func NewInclude(Expression node.Node) *Include {
|
func NewInclude(Expression node.Node) *Include {
|
||||||
return &Include{
|
return &Include{
|
||||||
|
FreeFloating: nil,
|
||||||
Expr: Expression,
|
Expr: Expression,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *Include) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Include) GetMeta() *meta.Collection {
|
func (n *Include) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// IncludeOnce node
|
// IncludeOnce node
|
||||||
type IncludeOnce struct {
|
type IncludeOnce struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type IncludeOnce struct {
|
|||||||
// NewIncludeOnce node constructor
|
// NewIncludeOnce node constructor
|
||||||
func NewIncludeOnce(Expression node.Node) *IncludeOnce {
|
func NewIncludeOnce(Expression node.Node) *IncludeOnce {
|
||||||
return &IncludeOnce{
|
return &IncludeOnce{
|
||||||
|
FreeFloating: nil,
|
||||||
Expr: Expression,
|
Expr: Expression,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *IncludeOnce) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *IncludeOnce) GetMeta() *meta.Collection {
|
func (n *IncludeOnce) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// InstanceOf node
|
// InstanceOf node
|
||||||
type InstanceOf struct {
|
type InstanceOf struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
Class node.Node
|
Class node.Node
|
||||||
@ -18,6 +18,7 @@ type InstanceOf struct {
|
|||||||
// NewInstanceOf node constructor
|
// NewInstanceOf node constructor
|
||||||
func NewInstanceOf(Expr node.Node, Class node.Node) *InstanceOf {
|
func NewInstanceOf(Expr node.Node, Class node.Node) *InstanceOf {
|
||||||
return &InstanceOf{
|
return &InstanceOf{
|
||||||
|
FreeFloating: nil,
|
||||||
Expr: Expr,
|
Expr: Expr,
|
||||||
Class: Class,
|
Class: Class,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *InstanceOf) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *InstanceOf) GetMeta() *meta.Collection {
|
func (n *InstanceOf) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Isset node
|
// Isset node
|
||||||
type Isset struct {
|
type Isset struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variables []node.Node
|
Variables []node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type Isset struct {
|
|||||||
// NewIsset node constructor
|
// NewIsset node constructor
|
||||||
func NewIsset(Variables []node.Node) *Isset {
|
func NewIsset(Variables []node.Node) *Isset {
|
||||||
return &Isset{
|
return &Isset{
|
||||||
|
FreeFloating: nil,
|
||||||
Variables: Variables,
|
Variables: Variables,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *Isset) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Isset) GetMeta() *meta.Collection {
|
func (n *Isset) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// List node
|
// List node
|
||||||
type List struct {
|
type List struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Items []node.Node
|
Items []node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type List struct {
|
|||||||
// NewList node constructor
|
// NewList node constructor
|
||||||
func NewList(Items []node.Node) *List {
|
func NewList(Items []node.Node) *List {
|
||||||
return &List{
|
return &List{
|
||||||
|
FreeFloating: nil,
|
||||||
Items: Items,
|
Items: Items,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *List) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *List) GetMeta() *meta.Collection {
|
func (n *List) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// MethodCall node
|
// MethodCall node
|
||||||
type MethodCall struct {
|
type MethodCall struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variable node.Node
|
Variable node.Node
|
||||||
Method node.Node
|
Method node.Node
|
||||||
@ -19,6 +19,7 @@ type MethodCall struct {
|
|||||||
// NewMethodCall node constructor
|
// NewMethodCall node constructor
|
||||||
func NewMethodCall(Variable node.Node, Method node.Node, ArgumentList *node.ArgumentList) *MethodCall {
|
func NewMethodCall(Variable node.Node, Method node.Node, ArgumentList *node.ArgumentList) *MethodCall {
|
||||||
return &MethodCall{
|
return &MethodCall{
|
||||||
|
FreeFloating: nil,
|
||||||
Variable: Variable,
|
Variable: Variable,
|
||||||
Method: Method,
|
Method: Method,
|
||||||
ArgumentList: ArgumentList,
|
ArgumentList: ArgumentList,
|
||||||
@ -35,8 +36,8 @@ func (n *MethodCall) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *MethodCall) GetMeta() *meta.Collection {
|
func (n *MethodCall) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// New node
|
// New node
|
||||||
type New struct {
|
type New struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Class node.Node
|
Class node.Node
|
||||||
ArgumentList *node.ArgumentList
|
ArgumentList *node.ArgumentList
|
||||||
@ -18,6 +18,7 @@ type New struct {
|
|||||||
// NewNew node constructor
|
// NewNew node constructor
|
||||||
func NewNew(Class node.Node, ArgumentList *node.ArgumentList) *New {
|
func NewNew(Class node.Node, ArgumentList *node.ArgumentList) *New {
|
||||||
return &New{
|
return &New{
|
||||||
|
FreeFloating: nil,
|
||||||
Class: Class,
|
Class: Class,
|
||||||
ArgumentList: ArgumentList,
|
ArgumentList: ArgumentList,
|
||||||
}
|
}
|
||||||
@ -33,8 +34,8 @@ func (n *New) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *New) GetMeta() *meta.Collection {
|
func (n *New) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// PostDec node
|
// PostDec node
|
||||||
type PostDec struct {
|
type PostDec struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variable node.Node
|
Variable node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type PostDec struct {
|
|||||||
// NewPostDec node constructor
|
// NewPostDec node constructor
|
||||||
func NewPostDec(Variable node.Node) *PostDec {
|
func NewPostDec(Variable node.Node) *PostDec {
|
||||||
return &PostDec{
|
return &PostDec{
|
||||||
|
FreeFloating: nil,
|
||||||
Variable: Variable,
|
Variable: Variable,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *PostDec) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *PostDec) GetMeta() *meta.Collection {
|
func (n *PostDec) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// PostInc node
|
// PostInc node
|
||||||
type PostInc struct {
|
type PostInc struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variable node.Node
|
Variable node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type PostInc struct {
|
|||||||
// NewPostInc node constructor
|
// NewPostInc node constructor
|
||||||
func NewPostInc(Variable node.Node) *PostInc {
|
func NewPostInc(Variable node.Node) *PostInc {
|
||||||
return &PostInc{
|
return &PostInc{
|
||||||
|
FreeFloating: nil,
|
||||||
Variable: Variable,
|
Variable: Variable,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *PostInc) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *PostInc) GetMeta() *meta.Collection {
|
func (n *PostInc) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package expr
|
package expr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/meta"
|
"github.com/z7zmey/php-parser/freefloating"
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/position"
|
"github.com/z7zmey/php-parser/position"
|
||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// PreDec node
|
// PreDec node
|
||||||
type PreDec struct {
|
type PreDec struct {
|
||||||
Meta meta.Collection
|
FreeFloating freefloating.Collection
|
||||||
Position *position.Position
|
Position *position.Position
|
||||||
Variable node.Node
|
Variable node.Node
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ type PreDec struct {
|
|||||||
// NewPreDec node constructor
|
// NewPreDec node constructor
|
||||||
func NewPreDec(Variable node.Node) *PreDec {
|
func NewPreDec(Variable node.Node) *PreDec {
|
||||||
return &PreDec{
|
return &PreDec{
|
||||||
|
FreeFloating: nil,
|
||||||
Variable: Variable,
|
Variable: Variable,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,8 +32,8 @@ func (n *PreDec) GetPosition() *position.Position {
|
|||||||
return n.Position
|
return n.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *PreDec) GetMeta() *meta.Collection {
|
func (n *PreDec) GetFreeFloating() *freefloating.Collection {
|
||||||
return &n.Meta
|
return &n.FreeFloating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user