diff options
author | Martin Odersky <odersky@gmail.com> | 2003-11-05 14:14:23 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2003-11-05 14:14:23 +0000 |
commit | d37c08ba93b7e3055412a3eafb7efcc4b6c6b3f7 (patch) | |
tree | 2ee2ad2c71c131c4db4201c61fe291bfc0b2ebdf /sources/scalac/ast | |
parent | 9bcc8b562fb0f8a7af444c68b1256abea1c6840a (diff) | |
download | scala-d37c08ba93b7e3055412a3eafb7efcc4b6c6b3f7.tar.gz scala-d37c08ba93b7e3055412a3eafb7efcc4b6c6b3f7.tar.bz2 scala-d37c08ba93b7e3055412a3eafb7efcc4b6c6b3f7.zip |
*** empty log message ***
Diffstat (limited to 'sources/scalac/ast')
-rw-r--r-- | sources/scalac/ast/parser/Scanner.scala | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/sources/scalac/ast/parser/Scanner.scala b/sources/scalac/ast/parser/Scanner.scala index d7376395eb..5181812b9c 100644 --- a/sources/scalac/ast/parser/Scanner.scala +++ b/sources/scalac/ast/parser/Scanner.scala @@ -202,6 +202,13 @@ class Scanner(unit: Unit) extends TokenData { nextch(); getOperatorRest(index); return; + case `\\' => + nextch(); + if (ch == '"')//" + getStringLit(); + else + syntaxError(pos, "illegal character"); + return; case '/' => nextch(); if (!skipComment()) { @@ -222,17 +229,7 @@ class Scanner(unit: Unit) extends TokenData { getNumber(index, 10); return; case '\"' => //" scala-mode: need to understand literals - nextch(); - litlen = 0; - while (ch != '\"'/*"*/ && ch != CR && ch != LF && ch != SU) - getlitch(); - if (ch == '\"'/*"*/) { - token = STRINGLIT; - name = Name.fromSource(lit, 0, litlen); - nextch(); - } else { - syntaxError("unclosed character literal"); - } + getStringLit(); return; case '\'' => nextch(); @@ -446,6 +443,20 @@ class Scanner(unit: Unit) extends TokenData { } } + private def getStringLit(): unit = { + nextch(); + litlen = 0; + while (ch != '\"'/*"*/ && ch != CR && ch != LF && ch != SU) + getlitch(); + if (ch == '\"'/*"*/) { + token = STRINGLIT; + name = Name.fromSource(lit, 0, litlen); + nextch(); + } else { + syntaxError("unclosed character literal"); + } + } + /** returns true if argument corresponds to a keyword. * Used in dtd2scala tool. */ |