blob: 6181c2dbf8c30a5f09488a97ec5820da6067fa93 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package lexer
func scanNumber(l *Lexer) bool {
l.AcceptWhile("0123456789")
if l.AtStart() {
// not found any digit
return false
}
l.Accept(".")
l.AcceptWhile("0123456789")
return !l.AtStart()
}
func scanQuotedString(l *Lexer, quote rune) bool {
start := l.Pos
if l.Next() != quote {
l.Back()
return false
}
for {
ch := l.Next()
switch ch {
case eof:
l.Pos = start // Return position to start
return false // Unclosed quote string?
case '\\':
l.Next() // Skip next char
case quote:
return true // Closing quote
}
}
}
|