#33 comment package has renamed to meta and parser now saves whitespaces

This commit is contained in:
z7zmey
2018-06-30 00:51:11 +03:00
parent 36d0cf4823
commit e90df8ef5f
205 changed files with 16485 additions and 16302 deletions

View File

@@ -1,7 +1,7 @@
package assign
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/meta"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -9,7 +9,7 @@ import (
// Assign node
type Assign struct {
Comments []*comment.Comment
Meta []meta.Meta
Position *position.Position
Variable node.Node
Expression node.Node
@@ -33,15 +33,12 @@ func (n *Assign) GetPosition() *position.Position {
return n.Position
}
func (n *Assign) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
func (n *Assign) AddMeta(m []meta.Meta) {
n.Meta = append(n.Meta, m...)
}
func (n *Assign) GetComments() []*comment.Comment {
return n.Comments
func (n *Assign) GetMeta() []meta.Meta {
return n.Meta
}
// Attributes returns node attributes as map

View File

@@ -1,7 +1,7 @@
package assign
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/meta"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -9,7 +9,7 @@ import (
// Reference node
type Reference struct {
Comments []*comment.Comment
Meta []meta.Meta
Position *position.Position
Variable node.Node
Expression node.Node
@@ -33,15 +33,12 @@ func (n *Reference) GetPosition() *position.Position {
return n.Position
}
func (n *Reference) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
func (n *Reference) AddMeta(m []meta.Meta) {
n.Meta = append(n.Meta, m...)
}
func (n *Reference) GetComments() []*comment.Comment {
return n.Comments
func (n *Reference) GetMeta() []meta.Meta {
return n.Meta
}
// Attributes returns node attributes as map

View File

@@ -1,7 +1,7 @@
package assign
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/meta"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -9,7 +9,7 @@ import (
// BitwiseAnd node
type BitwiseAnd struct {
Comments []*comment.Comment
Meta []meta.Meta
Position *position.Position
Variable node.Node
Expression node.Node
@@ -33,15 +33,12 @@ func (n *BitwiseAnd) GetPosition() *position.Position {
return n.Position
}
func (n *BitwiseAnd) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
func (n *BitwiseAnd) AddMeta(m []meta.Meta) {
n.Meta = append(n.Meta, m...)
}
func (n *BitwiseAnd) GetComments() []*comment.Comment {
return n.Comments
func (n *BitwiseAnd) GetMeta() []meta.Meta {
return n.Meta
}
// Attributes returns node attributes as map

View File

@@ -1,7 +1,7 @@
package assign
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/meta"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -9,7 +9,7 @@ import (
// BitwiseOr node
type BitwiseOr struct {
Comments []*comment.Comment
Meta []meta.Meta
Position *position.Position
Variable node.Node
Expression node.Node
@@ -33,15 +33,12 @@ func (n *BitwiseOr) GetPosition() *position.Position {
return n.Position
}
func (n *BitwiseOr) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
func (n *BitwiseOr) AddMeta(m []meta.Meta) {
n.Meta = append(n.Meta, m...)
}
func (n *BitwiseOr) GetComments() []*comment.Comment {
return n.Comments
func (n *BitwiseOr) GetMeta() []meta.Meta {
return n.Meta
}
// Attributes returns node attributes as map

View File

@@ -1,7 +1,7 @@
package assign
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/meta"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -9,7 +9,7 @@ import (
// BitwiseXor node
type BitwiseXor struct {
Comments []*comment.Comment
Meta []meta.Meta
Position *position.Position
Variable node.Node
Expression node.Node
@@ -33,15 +33,12 @@ func (n *BitwiseXor) GetPosition() *position.Position {
return n.Position
}
func (n *BitwiseXor) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
func (n *BitwiseXor) AddMeta(m []meta.Meta) {
n.Meta = append(n.Meta, m...)
}
func (n *BitwiseXor) GetComments() []*comment.Comment {
return n.Comments
func (n *BitwiseXor) GetMeta() []meta.Meta {
return n.Meta
}
// Attributes returns node attributes as map

View File

@@ -1,7 +1,7 @@
package assign
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/meta"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -9,7 +9,7 @@ import (
// Concat node
type Concat struct {
Comments []*comment.Comment
Meta []meta.Meta
Position *position.Position
Variable node.Node
Expression node.Node
@@ -33,15 +33,12 @@ func (n *Concat) GetPosition() *position.Position {
return n.Position
}
func (n *Concat) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
func (n *Concat) AddMeta(m []meta.Meta) {
n.Meta = append(n.Meta, m...)
}
func (n *Concat) GetComments() []*comment.Comment {
return n.Comments
func (n *Concat) GetMeta() []meta.Meta {
return n.Meta
}
// Attributes returns node attributes as map

View File

@@ -1,7 +1,7 @@
package assign
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/meta"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -9,7 +9,7 @@ import (
// Div node
type Div struct {
Comments []*comment.Comment
Meta []meta.Meta
Position *position.Position
Variable node.Node
Expression node.Node
@@ -33,15 +33,12 @@ func (n *Div) GetPosition() *position.Position {
return n.Position
}
func (n *Div) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
func (n *Div) AddMeta(m []meta.Meta) {
n.Meta = append(n.Meta, m...)
}
func (n *Div) GetComments() []*comment.Comment {
return n.Comments
func (n *Div) GetMeta() []meta.Meta {
return n.Meta
}
// Attributes returns node attributes as map

View File

@@ -1,7 +1,7 @@
package assign
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/meta"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -9,7 +9,7 @@ import (
// Minus node
type Minus struct {
Comments []*comment.Comment
Meta []meta.Meta
Position *position.Position
Variable node.Node
Expression node.Node
@@ -33,15 +33,12 @@ func (n *Minus) GetPosition() *position.Position {
return n.Position
}
func (n *Minus) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
func (n *Minus) AddMeta(m []meta.Meta) {
n.Meta = append(n.Meta, m...)
}
func (n *Minus) GetComments() []*comment.Comment {
return n.Comments
func (n *Minus) GetMeta() []meta.Meta {
return n.Meta
}
// Attributes returns node attributes as map

View File

@@ -1,7 +1,7 @@
package assign
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/meta"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -9,7 +9,7 @@ import (
// Mod node
type Mod struct {
Comments []*comment.Comment
Meta []meta.Meta
Position *position.Position
Variable node.Node
Expression node.Node
@@ -33,15 +33,12 @@ func (n *Mod) GetPosition() *position.Position {
return n.Position
}
func (n *Mod) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
func (n *Mod) AddMeta(m []meta.Meta) {
n.Meta = append(n.Meta, m...)
}
func (n *Mod) GetComments() []*comment.Comment {
return n.Comments
func (n *Mod) GetMeta() []meta.Meta {
return n.Meta
}
// Attributes returns node attributes as map

View File

@@ -1,7 +1,7 @@
package assign
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/meta"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -9,7 +9,7 @@ import (
// Mul node
type Mul struct {
Comments []*comment.Comment
Meta []meta.Meta
Position *position.Position
Variable node.Node
Expression node.Node
@@ -33,15 +33,12 @@ func (n *Mul) GetPosition() *position.Position {
return n.Position
}
func (n *Mul) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
func (n *Mul) AddMeta(m []meta.Meta) {
n.Meta = append(n.Meta, m...)
}
func (n *Mul) GetComments() []*comment.Comment {
return n.Comments
func (n *Mul) GetMeta() []meta.Meta {
return n.Meta
}
// Attributes returns node attributes as map

View File

@@ -1,7 +1,7 @@
package assign
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/meta"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -9,7 +9,7 @@ import (
// Plus node
type Plus struct {
Comments []*comment.Comment
Meta []meta.Meta
Position *position.Position
Variable node.Node
Expression node.Node
@@ -33,15 +33,12 @@ func (n *Plus) GetPosition() *position.Position {
return n.Position
}
func (n *Plus) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
func (n *Plus) AddMeta(m []meta.Meta) {
n.Meta = append(n.Meta, m...)
}
func (n *Plus) GetComments() []*comment.Comment {
return n.Comments
func (n *Plus) GetMeta() []meta.Meta {
return n.Meta
}
// Attributes returns node attributes as map

View File

@@ -1,7 +1,7 @@
package assign
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/meta"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -9,7 +9,7 @@ import (
// Pow node
type Pow struct {
Comments []*comment.Comment
Meta []meta.Meta
Position *position.Position
Variable node.Node
Expression node.Node
@@ -33,15 +33,12 @@ func (n *Pow) GetPosition() *position.Position {
return n.Position
}
func (n *Pow) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
func (n *Pow) AddMeta(m []meta.Meta) {
n.Meta = append(n.Meta, m...)
}
func (n *Pow) GetComments() []*comment.Comment {
return n.Comments
func (n *Pow) GetMeta() []meta.Meta {
return n.Meta
}
// Attributes returns node attributes as map

View File

@@ -1,7 +1,7 @@
package assign
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/meta"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -9,7 +9,7 @@ import (
// ShiftLeft node
type ShiftLeft struct {
Comments []*comment.Comment
Meta []meta.Meta
Position *position.Position
Variable node.Node
Expression node.Node
@@ -33,15 +33,12 @@ func (n *ShiftLeft) GetPosition() *position.Position {
return n.Position
}
func (n *ShiftLeft) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
func (n *ShiftLeft) AddMeta(m []meta.Meta) {
n.Meta = append(n.Meta, m...)
}
func (n *ShiftLeft) GetComments() []*comment.Comment {
return n.Comments
func (n *ShiftLeft) GetMeta() []meta.Meta {
return n.Meta
}
// Attributes returns node attributes as map

View File

@@ -1,7 +1,7 @@
package assign
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/meta"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -9,7 +9,7 @@ import (
// ShiftRight node
type ShiftRight struct {
Comments []*comment.Comment
Meta []meta.Meta
Position *position.Position
Variable node.Node
Expression node.Node
@@ -33,15 +33,12 @@ func (n *ShiftRight) GetPosition() *position.Position {
return n.Position
}
func (n *ShiftRight) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
func (n *ShiftRight) AddMeta(m []meta.Meta) {
n.Meta = append(n.Meta, m...)
}
func (n *ShiftRight) GetComments() []*comment.Comment {
return n.Comments
func (n *ShiftRight) GetMeta() []meta.Meta {
return n.Meta
}
// Attributes returns node attributes as map