remove meta.NamespaceToken

This commit is contained in:
z7zmey
2018-10-25 13:32:18 +03:00
parent 16de29a2a3
commit 379032b8c5
13 changed files with 55 additions and 63 deletions

View File

@@ -522,8 +522,6 @@ func (p *Printer) printNameFullyQualified(n node.Node) {
nn := n.(*name.FullyQualified)
p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.NsSeparatorToken)
for _, part := range nn.Parts {
io.WriteString(p.w, "\\")
p.Print(part)
@@ -535,13 +533,10 @@ func (p *Printer) printNameFullyQualified(n node.Node) {
func (p *Printer) printNameRelative(n node.Node) {
nn := n.(*name.Relative)
p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.NamespaceToken)
io.WriteString(p.w, "namespace")
for k, part := range nn.Parts {
if k == 0 {
p.printMeta(nn, meta.NsSeparatorToken)
}
p.printMeta(nn, meta.NsSeparatorToken)
for _, part := range nn.Parts {
io.WriteString(p.w, "\\")
p.Print(part)
}
@@ -2515,8 +2510,6 @@ func (p *Printer) printStmtLabel(n node.Node) {
func (p *Printer) printStmtNamespace(n node.Node) {
nn := n.(*stmt.Namespace)
p.printMeta(nn, meta.NodeStart)
p.printMeta(n, meta.NamespaceToken)
io.WriteString(p.w, "namespace")
if nn.NamespaceName != nil {

View File

@@ -113,7 +113,7 @@ func TestParseAndPrintParameter(t *testing.T) {
function & foo (
? int $a , & $b = null
, \ Foo ...$c
) : namespace \ Bar {
) : namespace \ Bar \ baz \ quuz{
;
}`

View File

@@ -162,7 +162,7 @@ func TestPrinterPrintParameter(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.NsSeparatorToken,
TokenName: meta.NodeStart,
},
},
Parts: []node.Node{
@@ -240,7 +240,7 @@ func TestPrinterPrintNullable(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.NsSeparatorToken,
TokenName: meta.NodeStart,
},
},
Parts: []node.Node{
@@ -464,7 +464,7 @@ func TestPrinterPrintNameFullyQualified(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.NsSeparatorToken,
TokenName: meta.NodeStart,
},
},
Parts: []node.Node{
@@ -494,7 +494,7 @@ func TestPrinterPrintNameRelative(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.NamespaceToken,
TokenName: meta.NodeStart,
},
&meta.Data{
Type: meta.WhiteSpaceType,
@@ -7524,7 +7524,7 @@ func TestPrinterPrintNamespace(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.NamespaceToken,
TokenName: meta.NodeStart,
},
&meta.Data{
Type: meta.WhiteSpaceType,
@@ -7557,7 +7557,7 @@ func TestPrinterPrintNamespaceWithStmts(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.NamespaceToken,
TokenName: meta.NodeStart,
},
&meta.Data{
Type: meta.WhiteSpaceType,