[refactoring] remove scanner.Lexer.PhpDocComment

This commit is contained in:
Vadym Slizov
2020-05-18 00:23:02 +03:00
parent 5620697cab
commit 8a50bd254a
5 changed files with 701 additions and 734 deletions

View File

@@ -13,8 +13,6 @@ import (
type Scanner interface {
Lex(lval Lval) int
ReturnTokenToPool(t *Token)
GetPhpDocComment() string
SetPhpDocComment(string)
GetErrors() []*errors.Error
GetWithHiddenTokens() bool
SetWithHiddenTokens(bool)
@@ -38,7 +36,6 @@ type Lexer struct {
TokenPool *TokenPool
HiddenTokens []token.Token
WithHiddenTokens bool
PhpDocComment string
lastToken *Token
Errors []*errors.Error
NewLines NewLines
@@ -49,14 +46,6 @@ func (l *Lexer) ReturnTokenToPool(t *Token) {
l.TokenPool.Put(t)
}
func (l *Lexer) GetPhpDocComment() string {
return l.PhpDocComment
}
func (l *Lexer) SetPhpDocComment(s string) {
l.PhpDocComment = s
}
func (l *Lexer) GetErrors() []*errors.Error {
return l.Errors
}

File diff suppressed because it is too large Load Diff

View File

@@ -336,7 +336,6 @@ func (lex *Lexer) Lex(lval Lval) int {
}
if isDocComment {
lex.PhpDocComment = string(lex.data[lex.ts:lex.te])
lex.addToken(T_DOC_COMMENT, lex.ts, lex.te)
} else {
lex.addToken(T_COMMENT, lex.ts, lex.te)
@@ -352,7 +351,7 @@ func (lex *Lexer) Lex(lval Lval) int {
};
"{" => { lex.setTokenPosition(token); tok = TokenID(int('{')); lex.call(ftargs, fentry(php)); goto _out; };
"}" => { lex.setTokenPosition(token); tok = TokenID(int('}')); lex.ret(1); lex.PhpDocComment = ""; goto _out;};
"}" => { lex.setTokenPosition(token); tok = TokenID(int('}')); lex.ret(1); goto _out;};
"$" varname => { lex.setTokenPosition(token); tok = T_VARIABLE; fbreak; };
varname => { lex.setTokenPosition(token); tok = T_STRING; fbreak; };