diff options
author | Paul Phillips <paulp@improving.org> | 2009-02-28 01:32:20 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-02-28 01:32:20 +0000 |
commit | 04949bcfb53515dce40e7c205aa370b49a519917 (patch) | |
tree | a927f763dd74fce6245a1fd34af4b1fbf3badd74 /src/library | |
parent | b6e70976e837630cd1bb5a2db5b47f72e13c3564 (diff) | |
download | scala-04949bcfb53515dce40e7c205aa370b49a519917.tar.gz scala-04949bcfb53515dce40e7c205aa370b49a519917.tar.bz2 scala-04949bcfb53515dce40e7c205aa370b49a519917.zip |
Fix for #1365, '_' should be a standard identif...
Fix for #1365, '_' should be a standard identifier char.
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/util/parsing/combinator/lexical/StdLexical.scala | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/library/scala/util/parsing/combinator/lexical/StdLexical.scala b/src/library/scala/util/parsing/combinator/lexical/StdLexical.scala index bab12f3798..2489c623e9 100644 --- a/src/library/scala/util/parsing/combinator/lexical/StdLexical.scala +++ b/src/library/scala/util/parsing/combinator/lexical/StdLexical.scala @@ -35,7 +35,7 @@ import collection.mutable.HashSet class StdLexical extends Lexical with StdTokens { // see `token' in `Scanners' def token: Parser[Token] = - ( letter ~ rep( letter | digit ) ^^ { case first ~ rest => processIdent(first :: rest mkString "") } + ( identChar ~ rep( identChar | digit ) ^^ { case first ~ rest => processIdent(first :: rest mkString "") } | digit ~ rep( digit ) ^^ { case first ~ rest => NumericLit(first :: rest mkString "") } | '\'' ~ rep( chrExcept('\'', '\n', EofCh) ) ~ '\'' ^^ { case '\'' ~ chars ~ '\'' => StringLit(chars mkString "") } | '\"' ~ rep( chrExcept('\"', '\n', EofCh) ) ~ '\"' ^^ { case '\"' ~ chars ~ '\"' => StringLit(chars mkString "") } @@ -46,6 +46,9 @@ class StdLexical extends Lexical with StdTokens { | failure("illegal character") ) + // legal identifier chars other than digits + def identChar = letter | elem('_') + // see `whitespace in `Scanners' def whitespace: Parser[Any] = rep( whitespaceChar |