in rsc/src/main/scala/rsc/scan/java/Scanner.scala [18:100]
def next(): Unit = {
(ch: @switch) match {
case SU =>
start = end
token = EOF
value = null
case '/' =>
if (ch1 == '/' || ch1 == '*') comment()
else operator()
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' =>
idOrKeyword()
case '=' | '>' | '<' | '!' | '~' | '&' | '|' | '+' | '-' | '*' | '^' | '%' =>
operator()
case '?' =>
nextChar()
emit(QMARK, null)
case ':' =>
nextChar()
emit(COLON, null)
case '@' =>
nextChar()
emit(AT, null)
case '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' =>
number()
case '"' =>
string()
case '\'' =>
character()
case '.' =>
if (isDecimalDigit(ch1)) {
number()
} else {
nextChar()
if (ch == '.') {
nextChar()
if (ch == '.') {
nextChar()
emit(DOTDOTDOT, null)
} else {
val message = reportOffset(start, IllegalEllipsis)
emit(ERROR, message.str)
}
} else {
emit(DOT, null)
}
}
case ';' =>
nextChar()
emit(SEMI, null)
case ',' =>
nextChar()
emit(COMMA, null)
case '(' =>
nextChar()
emit(LPAREN, null)
case '{' =>
nextChar()
emit(LBRACE, null)
case ')' =>
nextChar()
emit(RPAREN, null)
case '}' =>
nextChar()
emit(RBRACE, null)
case '[' =>
nextChar()
emit(LBRACKET, null)
case ']' =>
nextChar()
emit(RBRACKET, null)
case other =>
val message = reportOffset(offset, IllegalCharacter)
emit(ERROR, message.str)
nextChar()
}
}