[refactoring] update ast structure of "Echo" node

This commit is contained in:
Vadym Slizov
2020-09-10 23:11:08 +03:00
parent 3f12ada311
commit 7678303cb9
13 changed files with 1521 additions and 1614 deletions

View File

@@ -58,7 +58,7 @@ func (lex *Lexer) setTokenPosition(token *token.Token) {
}
func (lex *Lexer) addSkippedToken(t *token.Token, id token.ID, ps, pe int) {
if lex.sts == 0 {
if lex.sts == -1 {
lex.sts = lex.ts
}

View File

@@ -53,7 +53,7 @@ func (lex *Lexer) Lex() *token.Token {
tkn := lex.tokenPool.Get()
lex.sts = 0
lex.sts = -1
lex.ste = 0
lblStart := 0
@@ -24293,6 +24293,10 @@ func (lex *Lexer) Lex() *token.Token {
// line internal/scanner/scanner.rl:499
if lex.sts == -1 {
lex.sts = 0
}
tkn.Value = lex.data[lex.ts:lex.te]
tkn.ID = token.ID(tok)
tkn.Skipped = lex.data[lex.sts:lex.ste]

View File

@@ -26,7 +26,7 @@ func (lex *Lexer) Lex() *token.Token {
tkn := lex.tokenPool.Get()
lex.sts = 0
lex.sts = -1
lex.ste = 0
lblStart := 0
@@ -498,9 +498,13 @@ func (lex *Lexer) Lex() *token.Token {
write exec;
}%%
if lex.sts == -1 {
lex.sts = 0
}
tkn.Value = lex.data[lex.ts:lex.te]
tkn.ID = token.ID(tok)
tkn.SkippedString = lex.data[lex.sts:lex.ste]
tkn.Skipped = lex.data[lex.sts:lex.ste]
lex.addSkippedToken(tkn, tok, lex.ts, lex.te);
return tkn