#25: save position within node
This commit is contained in:
@@ -22,7 +22,6 @@ type Parser struct {
|
||||
errors []*errors.Error
|
||||
rootNode node.Node
|
||||
comments parser.Comments
|
||||
positions parser.Positions
|
||||
}
|
||||
|
||||
// NewParser creates and returns new Parser
|
||||
@@ -37,7 +36,6 @@ func NewParser(src io.Reader, path string) *Parser {
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,11 +56,7 @@ func (l *Parser) Parse() int {
|
||||
l.errors = nil
|
||||
l.rootNode = nil
|
||||
l.comments = parser.Comments{}
|
||||
l.positions = parser.Positions{}
|
||||
l.positionBuilder = &parser.PositionBuilder{
|
||||
Positions: &l.positions,
|
||||
PositionPool: &l.PositionPool,
|
||||
}
|
||||
l.positionBuilder = &parser.PositionBuilder{}
|
||||
|
||||
// parse
|
||||
|
||||
@@ -89,11 +83,6 @@ func (l *Parser) GetComments() parser.Comments {
|
||||
return l.comments
|
||||
}
|
||||
|
||||
// GetPositions returns positions list
|
||||
func (l *Parser) GetPositions() parser.Positions {
|
||||
return l.positions
|
||||
}
|
||||
|
||||
// helpers
|
||||
|
||||
func lastNode(nn []node.Node) node.Node {
|
||||
@@ -112,7 +101,6 @@ func (p *Parser) returnTokenToPool(yyDollar []yySymType, yyVAL *yySymType) {
|
||||
for i := 1; i < len(yyDollar); i++ {
|
||||
if yyDollar[i].token != nil {
|
||||
p.TokenPool.Put(yyDollar[i].token)
|
||||
p.PositionPool.Put(yyDollar[i].token.Position)
|
||||
}
|
||||
yyDollar[i].token = nil
|
||||
}
|
||||
|
||||
756
php7/php7.go
756
php7/php7.go
File diff suppressed because it is too large
Load Diff
698
php7/php7.y
698
php7/php7.y
File diff suppressed because it is too large
Load Diff
16028
php7/php7_test.go
16028
php7/php7_test.go
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user