issue #8: cli - parse concurrently

This commit is contained in:
z7zmey
2018-04-10 20:15:15 +03:00
parent 0cf164c11c
commit 316ed6e851
4 changed files with 106 additions and 49 deletions

View File

@@ -18,6 +18,7 @@ func (lval *yySymType) Token(t token.Token) {
// Parser structure
type Parser struct {
*scanner.Lexer
path string
lastToken *token.Token
positionBuilder *position.Builder
errors []*errors.Error
@@ -27,11 +28,12 @@ type Parser struct {
}
// NewParser creates and returns new Parser
func NewParser(src io.Reader, fName string) *Parser {
lexer := scanner.NewLexer(src, fName)
func NewParser(src io.Reader, path string) *Parser {
lexer := scanner.NewLexer(src, path)
return &Parser{
lexer,
path,
nil,
nil,
nil,
@@ -81,6 +83,11 @@ func (l *Parser) listGetFirstNodeComments(list []node.Node) []comment.Comment {
return l.comments[node]
}
// GetPath return path to file
func (l *Parser) GetPath() string {
return l.path
}
// GetRootNode returns root node
func (l *Parser) GetRootNode() node.Node {
return l.rootNode