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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
package cast
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 (
// String node
type String struct {
Comments []*comment.Comment
Meta []meta.Meta
Position *position.Position
Expr node.Node
}
@@ -31,15 +31,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

View File

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