add single quote string
This commit is contained in:
parent
14d7a5ce73
commit
80f4364f7e
1 changed files with 16 additions and 0 deletions
|
|
@ -303,6 +303,22 @@ func (l *Lexer) NextToken() (Token, error) {
|
||||||
|
|
||||||
return l.makeToken(TokenString), nil
|
return l.makeToken(TokenString), nil
|
||||||
|
|
||||||
|
case '\'':
|
||||||
|
// include ending quote
|
||||||
|
for !l.accept('\'') {
|
||||||
|
if l.match('\n') {
|
||||||
|
return l.makeToken(TokenError), errors.New("string did not end in current line")
|
||||||
|
}
|
||||||
|
|
||||||
|
if l.isAtEnd() {
|
||||||
|
return l.makeToken(TokenError), errors.New("string did not before end of source")
|
||||||
|
}
|
||||||
|
|
||||||
|
l.advance()
|
||||||
|
}
|
||||||
|
|
||||||
|
return l.makeToken(TokenString), nil
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if unicode.IsLetter(c) || c == '_' {
|
if unicode.IsLetter(c) || c == '_' {
|
||||||
// assemble variable
|
// assemble variable
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue