in rsc/src/main/scala/rsc/scan/scala/Scanner.scala [226:312]
private def dispatchNormal(): Unit = {
(ch: @switch) match {
case SU =>
start = end
token = EOF
value = null
case '/' =>
if (ch1 == '/' || ch1 == '*') comment()
else symbolicIdOrKeyword()
case ' ' | '\t' =>
whitespace()
case CR | LF | FF =>
newline()
case 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' |
'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '$' | '_' | 'a' | 'b' |
'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' |
'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' =>
alphanumericIdOrKeyword()
case '<' =>
def xmlPre = token == WHITESPACE || token == LPAREN || token == LBRACE
def xmlSuf = isXmlNameStart(ch1) || ch1 == '!' || ch1 == '?'
if (xmlPre && xmlSuf) {
xml()
} else {
symbolicIdOrKeyword()
}
case '~' | '!' | '@' | '#' | '%' | '^' | '*' | '+' | '-' | '>' | '?' | ':' | '=' | '&' | '|' |
'\\' | '⇒' | '←' =>
symbolicIdOrKeyword()
case '`' =>
backquotedId()
case '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' =>
number()
case '"' =>
string()
case '\'' =>
characterOrSymbol()
case '.' =>
if (isDecimalDigit(ch1)) {
number()
} else {
nextChar()
emit(DOT, null)
}
case ';' =>
nextChar()
emit(SEMI, null)
case ',' =>
nextChar()
emit(COMMA, null)
case '(' =>
nextChar()
emit(LPAREN, null)
case '{' =>
nextChar()
emit(LBRACE, null)
_blevel += 1
case ')' =>
nextChar()
emit(RPAREN, null)
case '}' =>
nextChar()
emit(RBRACE, null)
_blevel -= 1
if (_ilevel != -1 && _blevel == _slevel) {
_slevels.pop()
_slevel = if (_slevels.isEmpty) -1 else _slevels.peek
_mode = INTERPOLATION
}
case '[' =>
nextChar()
emit(LBRACKET, null)
case ']' =>
nextChar()
emit(RBRACKET, null)
case other =>
if (isAlphanumericIdStart(other)) {
alphanumericIdOrKeyword()
} else if (isSymbolicIdStart(other)) {
symbolicIdOrKeyword()
} else {
val message = reportOffset(offset, IllegalCharacter)
emit(ERROR, message.str)
nextChar()
}
}
}