#25: save position within node

This commit is contained in:
z7zmey
2018-06-24 10:19:44 +03:00
parent 6ac67675d5
commit 1ebb0c6fad
268 changed files with 53606 additions and 7719 deletions

View File

@@ -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
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff