summaryrefslogtreecommitdiff
path: root/sources/scalac/ast
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2003-11-07 12:11:21 +0000
committerMartin Odersky <odersky@gmail.com>2003-11-07 12:11:21 +0000
commit4bab79034d0056fb9982cbf31491880f961f8b53 (patch)
tree8cfdc73de23393c12c83098e57fcef34839afeb1 /sources/scalac/ast
parentfc7e1bce49d8fd89b25b70277237ed41fb24965d (diff)
downloadscala-4bab79034d0056fb9982cbf31491880f961f8b53.tar.gz
scala-4bab79034d0056fb9982cbf31491880f961f8b53.tar.bz2
scala-4bab79034d0056fb9982cbf31491880f961f8b53.zip
*** empty log message ***
Diffstat (limited to 'sources/scalac/ast')
-rw-r--r--sources/scalac/ast/parser/Scanner.java36
-rw-r--r--sources/scalac/ast/parser/Scanner.scala7
2 files changed, 29 insertions, 14 deletions
diff --git a/sources/scalac/ast/parser/Scanner.java b/sources/scalac/ast/parser/Scanner.java
index 46b00d98d6..7d5910588b 100644
--- a/sources/scalac/ast/parser/Scanner.java
+++ b/sources/scalac/ast/parser/Scanner.java
@@ -226,6 +226,16 @@ public class Scanner extends TokenData {
nextch();
getOperatorRest(index);
return;
+ case '\\':
+ nextch();
+ if (ch == '"') {
+ getStringLit();
+ token = IDENTIFIER;
+ } else {
+ syntaxError(pos, "illegal character");
+ }
+ return;
+
case '/':
nextch();
if (!skipComment()) {
@@ -250,17 +260,7 @@ public class Scanner extends TokenData {
getNumber(index, 10);
return;
case '\"':
- 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();
@@ -497,6 +497,20 @@ public class Scanner extends TokenData {
}
}
+ private void getStringLit() {
+ 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.
*/
diff --git a/sources/scalac/ast/parser/Scanner.scala b/sources/scalac/ast/parser/Scanner.scala
index 5181812b9c..f36eec7f82 100644
--- a/sources/scalac/ast/parser/Scanner.scala
+++ b/sources/scalac/ast/parser/Scanner.scala
@@ -202,11 +202,12 @@ class Scanner(unit: Unit) extends TokenData {
nextch();
getOperatorRest(index);
return;
- case `\\' =>
+ case '\\' =>
nextch();
- if (ch == '"')//"
+ if (ch == '"') { //"
getStringLit();
- else
+ token = IDENTIFIER;
+ } else
syntaxError(pos, "illegal character");
return;
case '/' =>