diff options
author | buraq <buraq@epfl.ch> | 2004-03-15 20:09:18 +0000 |
---|---|---|
committer | buraq <buraq@epfl.ch> | 2004-03-15 20:09:18 +0000 |
commit | 58dc39185c4c13dbd5849eab893a2f75411c90b6 (patch) | |
tree | 7a12816206f55e41c4098fe3171930ecdfd4e0a2 /sources | |
parent | 10090487be6062efbe467dd434b232bb5e04f9a7 (diff) | |
download | scala-58dc39185c4c13dbd5849eab893a2f75411c90b6.tar.gz scala-58dc39185c4c13dbd5849eab893a2f75411c90b6.tar.bz2 scala-58dc39185c4c13dbd5849eab893a2f75411c90b6.zip |
{{ works
Diffstat (limited to 'sources')
-rw-r--r-- | sources/scala/tools/scalac/ast/parser/MarkupParser.scala | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/sources/scala/tools/scalac/ast/parser/MarkupParser.scala b/sources/scala/tools/scalac/ast/parser/MarkupParser.scala index 2aa2111601..8408e842a6 100644 --- a/sources/scala/tools/scalac/ast/parser/MarkupParser.scala +++ b/sources/scala/tools/scalac/ast/parser/MarkupParser.scala @@ -4,7 +4,6 @@ import scalac.atree.AConstant; import scalac._; import scalac.util._; import ch.epfl.lamp.util.Position; -import java.util.{Map, Stack, ArrayList, LinkedList}; import java.lang.{Integer, Long, Float, Double}; import scala.Iterator; import scala.tools.scalac.util.NewArray; @@ -15,7 +14,7 @@ package scala.tools.scalac.ast.parser { class MarkupParser( unit:Unit, s:Scanner, p:Parser ) { - import Tokens.{EMPTY, RBRACE} ; + import Tokens.{EMPTY, LBRACE, RBRACE} ; import scala.tools.scalac.ast.{TreeList => myTreeList} val _AppendBuffer = Name.fromString("AppendBuffer"); @@ -220,8 +219,11 @@ class MarkupParser( unit:Unit, s:Scanner, p:Parser ) { s.xNext; s.xSpaceOpt; gen.mkStringLit( pos, tmp ) case '{' => + Console.println("LBRACE, s.pos = " + s.pos); s.nextToken(); // = LBRACE + Console.println("(2), s.pos = " + s.pos); s.nextToken(); + Console.println("(3), is LBRACE ?"+s.token == LBRACE+" s.pos = " + s.pos); val tmp = p.expr(false,false); if( s.token != RBRACE ) { s.xSyntaxError("expected end of Scala block"); @@ -287,14 +289,20 @@ class MarkupParser( unit:Unit, s:Scanner, p:Parser ) { } case '{' => // Scala block(s) while( s.ch == '{' ) { + var lastbp = s.bp; + s.nextToken(); // = LBRACE + lastbp = s.bp - lastbp; s.nextToken(); - s.nextToken(); - val bs = new myTreeList(); - val b = p.expr(true,false); //block( s.pos ); - if( s.token != RBRACE ) { - s.xSyntaxError(" expected end of Scala block"); + if(( s.token == LBRACE )&&( 1 == lastbp )) { // {{ => "{" + ts.append( makeText( s.pos, "{" )); + } else { + val bs = new myTreeList(); + val b = p.expr(true,false); //block( s.pos ); + if( s.token != RBRACE ) { + s.xSyntaxError(" expected end of Scala block"); + } + ts.append( b ); } - ts.append( b ); } case _ => // text content ts.append( makeText( s.pos, s.xText )); |