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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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