#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 name
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 (
// FullyQualified node
type FullyQualified struct {
Comments []*comment.Comment
Meta []meta.Meta
Position *position.Position
Parts []node.Node
}
@@ -31,15 +31,12 @@ func (n *FullyQualified) GetPosition() *position.Position {
return n.Position
}
func (n *FullyQualified) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
func (n *FullyQualified) AddMeta(m []meta.Meta) {
n.Meta = append(n.Meta, m...)
}
func (n *FullyQualified) GetComments() []*comment.Comment {
return n.Comments
func (n *FullyQualified) GetMeta() []meta.Meta {
return n.Meta
}
// Attributes returns node attributes as map

View File

@@ -1,7 +1,7 @@
package name
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 (
// Name node
type Name struct {
Comments []*comment.Comment
Meta []meta.Meta
Position *position.Position
Parts []node.Node
}
@@ -31,15 +31,12 @@ func (n *Name) GetPosition() *position.Position {
return n.Position
}
func (n *Name) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
func (n *Name) AddMeta(m []meta.Meta) {
n.Meta = append(n.Meta, m...)
}
func (n *Name) GetComments() []*comment.Comment {
return n.Comments
func (n *Name) GetMeta() []meta.Meta {
return n.Meta
}
// Attributes returns node attributes as map

View File

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

View File

@@ -1,7 +1,7 @@
package name
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 (
// Relative node
type Relative struct {
Comments []*comment.Comment
Meta []meta.Meta
Position *position.Position
Parts []node.Node
}
@@ -31,15 +31,12 @@ func (n *Relative) GetPosition() *position.Position {
return n.Position
}
func (n *Relative) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
func (n *Relative) AddMeta(m []meta.Meta) {
n.Meta = append(n.Meta, m...)
}
func (n *Relative) GetComments() []*comment.Comment {
return n.Comments
func (n *Relative) GetMeta() []meta.Meta {
return n.Meta
}
// Attributes returns node attributes as map