summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-10-23 15:37:20 +0000
committerPaul Phillips <paulp@improving.org>2009-10-23 15:37:20 +0000
commit3926c98936f79d25e1fcd2e0c206e3cb35f7ada8 (patch)
tree8dc794a7d48d470c4c750f9cc04b1efcf1d98c8d /src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
parent42a111ba41ce2f551d56ccde8ca878f1da27a0b4 (diff)
downloadscala-3926c98936f79d25e1fcd2e0c206e3cb35f7ada8.tar.gz
scala-3926c98936f79d25e1fcd2e0c206e3cb35f7ada8.tar.bz2
scala-3926c98936f79d25e1fcd2e0c206e3cb35f7ada8.zip
Parser fix involving backquoted identifiers (#2...
Parser fix involving backquoted identifiers (#2514) plus test case.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/parser/Scanners.scala')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Scanners.scala22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
index c966a23fcb..150de8db4d 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
@@ -306,13 +306,7 @@ trait Scanners {
base = 10
getNumber()
case '`' =>
- nextChar()
- if (getStringLit('`')) {
- finishNamed();
- if (name.length == 0) syntaxError("empty quoted identifier")
- token = BACKQUOTED_IDENT
- }
- else syntaxError("unclosed quoted identifier")
+ getBackquotedIdent()
case '\"' =>
nextChar()
if (ch == '\"') {
@@ -475,6 +469,16 @@ trait Scanners {
// Identifiers ---------------------------------------------------------------
+ private def getBackquotedIdent(): Unit = {
+ nextChar()
+ if (getStringLit('`')) {
+ finishNamed();
+ if (name.length == 0) syntaxError("empty quoted identifier")
+ token = BACKQUOTED_IDENT
+ }
+ else syntaxError("unclosed quoted identifier")
+ }
+
private def getIdentRest(): Unit = (ch: @switch) match {
case 'A' | 'B' | 'C' | 'D' | 'E' |
'F' | 'G' | 'H' | 'I' | 'J' |
@@ -747,6 +751,10 @@ trait Scanners {
case '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' =>
return restOfNumber()
+ /** Backquoted idents like 22.`foo` */
+ case '`' =>
+ return setStrVal()
+
/** These letters may be part of a literal, or a method invocation on an Int */
case 'd' | 'D' | 'f' | 'F' =>
lookahead.nextChar()