[refactoring] update ast structure of "Lnumber" and "Dnumber" nodes

This commit is contained in:
Vadym Slizov 2020-11-20 23:08:30 +02:00
parent 7e2965f53b
commit e3ad9747f4
No known key found for this signature in database
GPG Key ID: AEA2A9388EF42A4A
5 changed files with 133 additions and 105 deletions

72
internal/php5/php5.go generated
View File

@ -347,7 +347,7 @@ const yyEofCode = 1
const yyErrCode = 2 const yyErrCode = 2
const yyInitialStackSize = 16 const yyInitialStackSize = 16
// line internal/php5/php5.y:6400 // line internal/php5/php5.y:6406
type simpleIndirectReference struct { type simpleIndirectReference struct {
all []*ast.ExprVariable all []*ast.ExprVariable
@ -6923,25 +6923,25 @@ yydefault:
yyDollar = yyS[yypt-1 : yypt+1] yyDollar = yyS[yypt-1 : yypt+1]
// line internal/php5/php5.y:4495 // line internal/php5/php5.y:4495
{ {
yyVAL.node = &ast.ScalarLnumber{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ScalarLnumber{
Node: ast.Node{
// save position Position: position.NewTokenPosition(yyDollar[1].token),
yyVAL.node.GetNode().Position = position.NewTokenPosition(yyDollar[1].token) },
NumberTkn: yyDollar[1].token,
// save comments Value: yyDollar[1].token.Value,
yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) }
} }
case 354: case 354:
yyDollar = yyS[yypt-1 : yypt+1] yyDollar = yyS[yypt-1 : yypt+1]
// line internal/php5/php5.y:4505 // line internal/php5/php5.y:4505
{ {
yyVAL.node = &ast.ScalarDnumber{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ScalarDnumber{
Node: ast.Node{
// save position Position: position.NewTokenPosition(yyDollar[1].token),
yyVAL.node.GetNode().Position = position.NewTokenPosition(yyDollar[1].token) },
NumberTkn: yyDollar[1].token,
// save comments Value: yyDollar[1].token.Value,
yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) }
} }
case 355: case 355:
yyDollar = yyS[yypt-1 : yypt+1] yyDollar = yyS[yypt-1 : yypt+1]
@ -8748,7 +8748,13 @@ yydefault:
{ {
// TODO: add option to handle 64 bit integer // TODO: add option to handle 64 bit integer
if _, err := strconv.Atoi(string(yyDollar[1].token.Value)); err == nil { if _, err := strconv.Atoi(string(yyDollar[1].token.Value)); err == nil {
yyVAL.node = &ast.ScalarLnumber{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ScalarLnumber{
Node: ast.Node{
Position: position.NewTokenPosition(yyDollar[1].token),
},
NumberTkn: yyDollar[1].token,
Value: yyDollar[1].token.Value,
}
} else { } else {
yyVAL.node = &ast.ScalarString{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ScalarString{ast.Node{}, yyDollar[1].token.Value}
} }
@ -8761,7 +8767,7 @@ yydefault:
} }
case 504: case 504:
yyDollar = yyS[yypt-1 : yypt+1] yyDollar = yyS[yypt-1 : yypt+1]
// line internal/php5/php5.y:6161 // line internal/php5/php5.y:6167
{ {
identifier := &ast.Identifier{ identifier := &ast.Identifier{
Node: ast.Node{ Node: ast.Node{
@ -8780,7 +8786,7 @@ yydefault:
} }
case 505: case 505:
yyDollar = yyS[yypt-4 : yypt+1] yyDollar = yyS[yypt-4 : yypt+1]
// line internal/php5/php5.y:6181 // line internal/php5/php5.y:6187
{ {
yyVAL.node = &ast.ExprIsset{ast.Node{}, yyDollar[3].list} yyVAL.node = &ast.ExprIsset{ast.Node{}, yyDollar[3].list}
@ -8794,7 +8800,7 @@ yydefault:
} }
case 506: case 506:
yyDollar = yyS[yypt-4 : yypt+1] yyDollar = yyS[yypt-4 : yypt+1]
// line internal/php5/php5.y:6193 // line internal/php5/php5.y:6199
{ {
exprBrackets := &ast.ParserBrackets{ exprBrackets := &ast.ParserBrackets{
Node: ast.Node{ Node: ast.Node{
@ -8816,7 +8822,7 @@ yydefault:
} }
case 507: case 507:
yyDollar = yyS[yypt-4 : yypt+1] yyDollar = yyS[yypt-4 : yypt+1]
// line internal/php5/php5.y:6213 // line internal/php5/php5.y:6219
{ {
exprBrackets := &ast.ParserBrackets{ exprBrackets := &ast.ParserBrackets{
Node: ast.Node{ Node: ast.Node{
@ -8838,7 +8844,7 @@ yydefault:
} }
case 508: case 508:
yyDollar = yyS[yypt-2 : yypt+1] yyDollar = yyS[yypt-2 : yypt+1]
// line internal/php5/php5.y:6233 // line internal/php5/php5.y:6239
{ {
yyVAL.node = &ast.ExprInclude{ast.Node{}, yyDollar[2].node} yyVAL.node = &ast.ExprInclude{ast.Node{}, yyDollar[2].node}
@ -8850,7 +8856,7 @@ yydefault:
} }
case 509: case 509:
yyDollar = yyS[yypt-2 : yypt+1] yyDollar = yyS[yypt-2 : yypt+1]
// line internal/php5/php5.y:6243 // line internal/php5/php5.y:6249
{ {
yyVAL.node = &ast.ExprIncludeOnce{ast.Node{}, yyDollar[2].node} yyVAL.node = &ast.ExprIncludeOnce{ast.Node{}, yyDollar[2].node}
@ -8862,7 +8868,7 @@ yydefault:
} }
case 510: case 510:
yyDollar = yyS[yypt-4 : yypt+1] yyDollar = yyS[yypt-4 : yypt+1]
// line internal/php5/php5.y:6253 // line internal/php5/php5.y:6259
{ {
exprBrackets := &ast.ParserBrackets{ exprBrackets := &ast.ParserBrackets{
Node: ast.Node{ Node: ast.Node{
@ -8884,7 +8890,7 @@ yydefault:
} }
case 511: case 511:
yyDollar = yyS[yypt-2 : yypt+1] yyDollar = yyS[yypt-2 : yypt+1]
// line internal/php5/php5.y:6273 // line internal/php5/php5.y:6279
{ {
yyVAL.node = &ast.ExprRequire{ast.Node{}, yyDollar[2].node} yyVAL.node = &ast.ExprRequire{ast.Node{}, yyDollar[2].node}
@ -8896,7 +8902,7 @@ yydefault:
} }
case 512: case 512:
yyDollar = yyS[yypt-2 : yypt+1] yyDollar = yyS[yypt-2 : yypt+1]
// line internal/php5/php5.y:6283 // line internal/php5/php5.y:6289
{ {
yyVAL.node = &ast.ExprRequireOnce{ast.Node{}, yyDollar[2].node} yyVAL.node = &ast.ExprRequireOnce{ast.Node{}, yyDollar[2].node}
@ -8908,13 +8914,13 @@ yydefault:
} }
case 513: case 513:
yyDollar = yyS[yypt-1 : yypt+1] yyDollar = yyS[yypt-1 : yypt+1]
// line internal/php5/php5.y:6296 // line internal/php5/php5.y:6302
{ {
yyVAL.list = []ast.Vertex{yyDollar[1].node} yyVAL.list = []ast.Vertex{yyDollar[1].node}
} }
case 514: case 514:
yyDollar = yyS[yypt-3 : yypt+1] yyDollar = yyS[yypt-3 : yypt+1]
// line internal/php5/php5.y:6300 // line internal/php5/php5.y:6306
{ {
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
@ -8923,19 +8929,19 @@ yydefault:
} }
case 515: case 515:
yyDollar = yyS[yypt-1 : yypt+1] yyDollar = yyS[yypt-1 : yypt+1]
// line internal/php5/php5.y:6310 // line internal/php5/php5.y:6316
{ {
yyVAL.node = yyDollar[1].node yyVAL.node = yyDollar[1].node
} }
case 516: case 516:
yyDollar = yyS[yypt-1 : yypt+1] yyDollar = yyS[yypt-1 : yypt+1]
// line internal/php5/php5.y:6314 // line internal/php5/php5.y:6320
{ {
yyVAL.node = yyDollar[1].node yyVAL.node = yyDollar[1].node
} }
case 517: case 517:
yyDollar = yyS[yypt-3 : yypt+1] yyDollar = yyS[yypt-3 : yypt+1]
// line internal/php5/php5.y:6321 // line internal/php5/php5.y:6327
{ {
target := &ast.Identifier{ target := &ast.Identifier{
Node: ast.Node{ Node: ast.Node{
@ -8955,7 +8961,7 @@ yydefault:
} }
case 518: case 518:
yyDollar = yyS[yypt-3 : yypt+1] yyDollar = yyS[yypt-3 : yypt+1]
// line internal/php5/php5.y:6339 // line internal/php5/php5.y:6345
{ {
target := &ast.Identifier{ target := &ast.Identifier{
Node: ast.Node{ Node: ast.Node{
@ -8975,7 +8981,7 @@ yydefault:
} }
case 519: case 519:
yyDollar = yyS[yypt-3 : yypt+1] yyDollar = yyS[yypt-3 : yypt+1]
// line internal/php5/php5.y:6360 // line internal/php5/php5.y:6366
{ {
target := &ast.Identifier{ target := &ast.Identifier{
Node: ast.Node{ Node: ast.Node{
@ -8995,7 +9001,7 @@ yydefault:
} }
case 520: case 520:
yyDollar = yyS[yypt-3 : yypt+1] yyDollar = yyS[yypt-3 : yypt+1]
// line internal/php5/php5.y:6381 // line internal/php5/php5.y:6387
{ {
target := &ast.Identifier{ target := &ast.Identifier{
Node: ast.Node{ Node: ast.Node{

View File

@ -4493,23 +4493,23 @@ ctor_arguments:
common_scalar: common_scalar:
T_LNUMBER T_LNUMBER
{ {
$$ = &ast.ScalarLnumber{ast.Node{}, $1.Value} $$ = &ast.ScalarLnumber{
Node: ast.Node{
// save position Position: position.NewTokenPosition($1),
$$.GetNode().Position = position.NewTokenPosition($1) },
NumberTkn: $1,
// save comments Value: $1.Value,
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens) }
} }
| T_DNUMBER | T_DNUMBER
{ {
$$ = &ast.ScalarDnumber{ast.Node{}, $1.Value} $$ = &ast.ScalarDnumber{
Node: ast.Node{
// save position Position: position.NewTokenPosition($1),
$$.GetNode().Position = position.NewTokenPosition($1) },
NumberTkn: $1,
// save comments Value: $1.Value,
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens) }
} }
| T_CONSTANT_ENCAPSED_STRING | T_CONSTANT_ENCAPSED_STRING
{ {
@ -6146,7 +6146,13 @@ encaps_var_offset:
{ {
// TODO: add option to handle 64 bit integer // TODO: add option to handle 64 bit integer
if _, err := strconv.Atoi(string($1.Value)); err == nil { if _, err := strconv.Atoi(string($1.Value)); err == nil {
$$ = &ast.ScalarLnumber{ast.Node{}, $1.Value} $$ = &ast.ScalarLnumber{
Node: ast.Node{
Position: position.NewTokenPosition($1),
},
NumberTkn: $1,
Value: $1.Value,
}
} else { } else {
$$ = &ast.ScalarString{ast.Node{}, $1.Value} $$ = &ast.ScalarString{ast.Node{}, $1.Value}
} }

75
internal/php7/php7.go generated
View File

@ -347,7 +347,7 @@ const yyEofCode = 1
const yyErrCode = 2 const yyErrCode = 2
const yyInitialStackSize = 16 const yyInitialStackSize = 16
// line internal/php7/php7.y:4964 // line internal/php7/php7.y:4971
// line yacctab:1 // line yacctab:1
var yyExca = [...]int{ var yyExca = [...]int{
@ -6549,25 +6549,25 @@ yydefault:
yyDollar = yyS[yypt-1 : yypt+1] yyDollar = yyS[yypt-1 : yypt+1]
// line internal/php7/php7.y:3942 // line internal/php7/php7.y:3942
{ {
yyVAL.node = &ast.ScalarLnumber{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ScalarLnumber{
Node: ast.Node{
// save position Position: position.NewTokenPosition(yyDollar[1].token),
yyVAL.node.GetNode().Position = position.NewTokenPosition(yyDollar[1].token) },
NumberTkn: yyDollar[1].token,
// save comments Value: yyDollar[1].token.Value,
yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) }
} }
case 403: case 403:
yyDollar = yyS[yypt-1 : yypt+1] yyDollar = yyS[yypt-1 : yypt+1]
// line internal/php7/php7.y:3952 // line internal/php7/php7.y:3952
{ {
yyVAL.node = &ast.ScalarDnumber{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ScalarDnumber{
Node: ast.Node{
// save position Position: position.NewTokenPosition(yyDollar[1].token),
yyVAL.node.GetNode().Position = position.NewTokenPosition(yyDollar[1].token) },
NumberTkn: yyDollar[1].token,
// save comments Value: yyDollar[1].token.Value,
yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) }
} }
case 404: case 404:
yyDollar = yyS[yypt-1 : yypt+1] yyDollar = yyS[yypt-1 : yypt+1]
@ -7494,7 +7494,13 @@ yydefault:
{ {
// TODO: add option to handle 64 bit integer // TODO: add option to handle 64 bit integer
if _, err := strconv.Atoi(string(yyDollar[1].token.Value)); err == nil { if _, err := strconv.Atoi(string(yyDollar[1].token.Value)); err == nil {
yyVAL.node = &ast.ScalarLnumber{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ScalarLnumber{
Node: ast.Node{
Position: position.NewTokenPosition(yyDollar[1].token),
},
NumberTkn: yyDollar[1].token,
Value: yyDollar[1].token.Value,
}
} else { } else {
yyVAL.node = &ast.ScalarString{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ScalarString{ast.Node{}, yyDollar[1].token.Value}
} }
@ -7507,15 +7513,19 @@ yydefault:
} }
case 483: case 483:
yyDollar = yyS[yypt-2 : yypt+1] yyDollar = yyS[yypt-2 : yypt+1]
// line internal/php7/php7.y:4800 // line internal/php7/php7.y:4806
{ {
var lnumber *ast.ScalarLnumber
// TODO: add option to handle 64 bit integer
_, err := strconv.Atoi(string(yyDollar[2].token.Value)) _, err := strconv.Atoi(string(yyDollar[2].token.Value))
isInt := err == nil isInt := err == nil
if isInt { if isInt {
lnumber = &ast.ScalarLnumber{ast.Node{}, yyDollar[2].token.Value} lnumber := &ast.ScalarLnumber{
Node: ast.Node{
Position: position.NewTokenPosition(yyDollar[2].token),
},
NumberTkn: yyDollar[2].token,
Value: yyDollar[2].token.Value,
}
yyVAL.node = &ast.ExprUnaryMinus{ast.Node{}, lnumber} yyVAL.node = &ast.ExprUnaryMinus{ast.Node{}, lnumber}
} else { } else {
yyDollar[2].token.Value = append([]byte("-"), yyDollar[2].token.Value...) yyDollar[2].token.Value = append([]byte("-"), yyDollar[2].token.Value...)
@ -7523,9 +7533,6 @@ yydefault:
} }
// save position // save position
if isInt {
lnumber.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[2].token)
}
yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[2].token) yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[2].token)
// save comments // save comments
@ -7533,7 +7540,7 @@ yydefault:
} }
case 484: case 484:
yyDollar = yyS[yypt-1 : yypt+1] yyDollar = yyS[yypt-1 : yypt+1]
// line internal/php7/php7.y:4824 // line internal/php7/php7.y:4831
{ {
identifier := &ast.Identifier{ identifier := &ast.Identifier{
Node: ast.Node{ Node: ast.Node{
@ -7552,7 +7559,7 @@ yydefault:
} }
case 485: case 485:
yyDollar = yyS[yypt-5 : yypt+1] yyDollar = yyS[yypt-5 : yypt+1]
// line internal/php7/php7.y:4844 // line internal/php7/php7.y:4851
{ {
yyVAL.node = &ast.ExprIsset{ast.Node{}, yyDollar[3].list} yyVAL.node = &ast.ExprIsset{ast.Node{}, yyDollar[3].list}
@ -7570,7 +7577,7 @@ yydefault:
} }
case 486: case 486:
yyDollar = yyS[yypt-4 : yypt+1] yyDollar = yyS[yypt-4 : yypt+1]
// line internal/php7/php7.y:4860 // line internal/php7/php7.y:4867
{ {
exprBrackets := &ast.ParserBrackets{ exprBrackets := &ast.ParserBrackets{
Node: ast.Node{ Node: ast.Node{
@ -7592,7 +7599,7 @@ yydefault:
} }
case 487: case 487:
yyDollar = yyS[yypt-2 : yypt+1] yyDollar = yyS[yypt-2 : yypt+1]
// line internal/php7/php7.y:4880 // line internal/php7/php7.y:4887
{ {
yyVAL.node = &ast.ExprInclude{ast.Node{}, yyDollar[2].node} yyVAL.node = &ast.ExprInclude{ast.Node{}, yyDollar[2].node}
@ -7604,7 +7611,7 @@ yydefault:
} }
case 488: case 488:
yyDollar = yyS[yypt-2 : yypt+1] yyDollar = yyS[yypt-2 : yypt+1]
// line internal/php7/php7.y:4890 // line internal/php7/php7.y:4897
{ {
yyVAL.node = &ast.ExprIncludeOnce{ast.Node{}, yyDollar[2].node} yyVAL.node = &ast.ExprIncludeOnce{ast.Node{}, yyDollar[2].node}
@ -7616,7 +7623,7 @@ yydefault:
} }
case 489: case 489:
yyDollar = yyS[yypt-4 : yypt+1] yyDollar = yyS[yypt-4 : yypt+1]
// line internal/php7/php7.y:4900 // line internal/php7/php7.y:4907
{ {
exprBrackets := &ast.ParserBrackets{ exprBrackets := &ast.ParserBrackets{
Node: ast.Node{ Node: ast.Node{
@ -7638,7 +7645,7 @@ yydefault:
} }
case 490: case 490:
yyDollar = yyS[yypt-2 : yypt+1] yyDollar = yyS[yypt-2 : yypt+1]
// line internal/php7/php7.y:4920 // line internal/php7/php7.y:4927
{ {
yyVAL.node = &ast.ExprRequire{ast.Node{}, yyDollar[2].node} yyVAL.node = &ast.ExprRequire{ast.Node{}, yyDollar[2].node}
@ -7650,7 +7657,7 @@ yydefault:
} }
case 491: case 491:
yyDollar = yyS[yypt-2 : yypt+1] yyDollar = yyS[yypt-2 : yypt+1]
// line internal/php7/php7.y:4930 // line internal/php7/php7.y:4937
{ {
yyVAL.node = &ast.ExprRequireOnce{ast.Node{}, yyDollar[2].node} yyVAL.node = &ast.ExprRequireOnce{ast.Node{}, yyDollar[2].node}
@ -7662,13 +7669,13 @@ yydefault:
} }
case 492: case 492:
yyDollar = yyS[yypt-1 : yypt+1] yyDollar = yyS[yypt-1 : yypt+1]
// line internal/php7/php7.y:4943 // line internal/php7/php7.y:4950
{ {
yyVAL.list = []ast.Vertex{yyDollar[1].node} yyVAL.list = []ast.Vertex{yyDollar[1].node}
} }
case 493: case 493:
yyDollar = yyS[yypt-3 : yypt+1] yyDollar = yyS[yypt-3 : yypt+1]
// line internal/php7/php7.y:4947 // line internal/php7/php7.y:4954
{ {
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
@ -7677,7 +7684,7 @@ yydefault:
} }
case 494: case 494:
yyDollar = yyS[yypt-1 : yypt+1] yyDollar = yyS[yypt-1 : yypt+1]
// line internal/php7/php7.y:4957 // line internal/php7/php7.y:4964
{ {
yyVAL.node = yyDollar[1].node yyVAL.node = yyDollar[1].node
} }

View File

@ -3940,23 +3940,23 @@ dereferencable_scalar:
scalar: scalar:
T_LNUMBER T_LNUMBER
{ {
$$ = &ast.ScalarLnumber{ast.Node{}, $1.Value} $$ = &ast.ScalarLnumber{
Node: ast.Node{
// save position Position: position.NewTokenPosition($1),
$$.GetNode().Position = position.NewTokenPosition($1) },
NumberTkn: $1,
// save comments Value: $1.Value,
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens) }
} }
| T_DNUMBER | T_DNUMBER
{ {
$$ = &ast.ScalarDnumber{ast.Node{}, $1.Value} $$ = &ast.ScalarDnumber{
Node: ast.Node{
// save position Position: position.NewTokenPosition($1),
$$.GetNode().Position = position.NewTokenPosition($1) },
NumberTkn: $1,
// save comments Value: $1.Value,
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens) }
} }
| T_LINE | T_LINE
{ {
@ -4785,7 +4785,13 @@ encaps_var_offset:
{ {
// TODO: add option to handle 64 bit integer // TODO: add option to handle 64 bit integer
if _, err := strconv.Atoi(string($1.Value)); err == nil { if _, err := strconv.Atoi(string($1.Value)); err == nil {
$$ = &ast.ScalarLnumber{ast.Node{}, $1.Value} $$ = &ast.ScalarLnumber{
Node: ast.Node{
Position: position.NewTokenPosition($1),
},
NumberTkn: $1,
Value: $1.Value,
}
} else { } else {
$$ = &ast.ScalarString{ast.Node{}, $1.Value} $$ = &ast.ScalarString{ast.Node{}, $1.Value}
} }
@ -4798,13 +4804,17 @@ encaps_var_offset:
} }
| '-' T_NUM_STRING | '-' T_NUM_STRING
{ {
var lnumber *ast.ScalarLnumber
// TODO: add option to handle 64 bit integer
_, err := strconv.Atoi(string($2.Value)); _, err := strconv.Atoi(string($2.Value));
isInt := err == nil isInt := err == nil
if isInt { if isInt {
lnumber = &ast.ScalarLnumber{ast.Node{}, $2.Value} lnumber := &ast.ScalarLnumber{
Node: ast.Node{
Position: position.NewTokenPosition($2),
},
NumberTkn: $2,
Value: $2.Value,
}
$$ = &ast.ExprUnaryMinus{ast.Node{}, lnumber} $$ = &ast.ExprUnaryMinus{ast.Node{}, lnumber}
} else { } else {
$2.Value = append([]byte("-"), $2.Value...) $2.Value = append([]byte("-"), $2.Value...)
@ -4812,9 +4822,6 @@ encaps_var_offset:
} }
// save position // save position
if isInt {
lnumber.GetNode().Position = position.NewTokensPosition($1, $2)
}
$$.GetNode().Position = position.NewTokensPosition($1, $2) $$.GetNode().Position = position.NewTokensPosition($1, $2)
// save comments // save comments

View File

@ -115,7 +115,8 @@ func (n *Argument) Accept(v NodeVisitor) {
// ScalarDnumber node // ScalarDnumber node
type ScalarDnumber struct { type ScalarDnumber struct {
Node Node
Value []byte NumberTkn *token.Token
Value []byte
} }
func (n *ScalarDnumber) Accept(v NodeVisitor) { func (n *ScalarDnumber) Accept(v NodeVisitor) {
@ -156,7 +157,8 @@ func (n *ScalarHeredoc) Accept(v NodeVisitor) {
// ScalarLnumber node // ScalarLnumber node
type ScalarLnumber struct { type ScalarLnumber struct {
Node Node
Value []byte NumberTkn *token.Token
Value []byte
} }
func (n *ScalarLnumber) Accept(v NodeVisitor) { func (n *ScalarLnumber) Accept(v NodeVisitor) {