diff options
author | Alex Cruise <alex@cluonflux.com> | 2012-03-08 23:41:58 -0800 |
---|---|---|
committer | Alex Cruise <alex@metaforsoftware.com> | 2012-03-15 14:31:08 -0700 |
commit | e7ea29cc0b3c55d7880b767f8c442d8bf3cd0dea (patch) | |
tree | 09008ce8463b33b068210128cdaf508c91b08195 /src/compiler | |
parent | 24d8760030ea9379131104561929d19e437a9793 (diff) | |
download | scala-e7ea29cc0b3c55d7880b767f8c442d8bf3cd0dea.tar.gz scala-e7ea29cc0b3c55d7880b767f8c442d8bf3cd0dea.tar.bz2 scala-e7ea29cc0b3c55d7880b767f8c442d8bf3cd0dea.zip |
SI-1118 WIP
Diffstat (limited to 'src/compiler')
-rwxr-xr-x[-rw-r--r--] | src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala b/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala index 46ade7d889..93fa9a60f6 100644..100755 --- a/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala @@ -267,7 +267,7 @@ trait MarkupParsers { val (qname, attrMap) = xTag(()) if (ch == '/') { // empty element xToken("/>") - handle.element(r2p(start, start, curOffset), qname, attrMap, new ListBuffer[Tree]) + handle.element(r2p(start, start, curOffset), qname, attrMap, true, new ListBuffer[Tree]) } else { // handle content xToken('>') @@ -281,7 +281,7 @@ trait MarkupParsers { val pos = r2p(start, start, curOffset) qname match { case "xml:group" => handle.group(pos, ts) - case _ => handle.element(pos, qname, attrMap, ts) + case _ => handle.element(pos, qname, attrMap, false, ts) } } } diff --git a/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala index ffe65aec63..591a3f557d 100644..100755 --- a/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala @@ -101,7 +101,8 @@ abstract class SymbolicXMLBuilder(p: Parsers#Parser, preserveWS: Boolean) { pre: Tree, label: Tree, attrs: Tree, - scope:Tree, + scope: Tree, + empty: Boolean, children: Seq[Tree]): Tree = { def starArgs = @@ -109,7 +110,7 @@ abstract class SymbolicXMLBuilder(p: Parsers#Parser, preserveWS: Boolean) { else List(Typed(makeXMLseq(pos, children), wildStar)) def pat = Apply(_scala_xml__Elem, List(pre, label, wild, wild) ::: convertToTextPat(children)) - def nonpat = New(_scala_xml_Elem, List(List(pre, label, attrs, scope) ::: starArgs)) + def nonpat = New(_scala_xml_Elem, List(List(pre, label, attrs, scope, if (empty) Literal(true) else Literal(false)) ::: starArgs)) atPos(pos) { if (isPattern) pat else nonpat } } @@ -140,7 +141,7 @@ abstract class SymbolicXMLBuilder(p: Parsers#Parser, preserveWS: Boolean) { case (Some(pre), rest) => (const(pre), const(rest)) case _ => (wild, const(n)) } - mkXML(pos, true, prepat, labpat, null, null, args) + mkXML(pos, true, prepat, labpat, null, null, false, args) } protected def convertToTextPat(t: Tree): Tree = t match { @@ -188,7 +189,7 @@ abstract class SymbolicXMLBuilder(p: Parsers#Parser, preserveWS: Boolean) { def unparsed(pos: Position, str: String): Tree = atPos(pos)( New(_scala_xml_Unparsed, LL(const(str))) ) - def element(pos: Position, qname: String, attrMap: mutable.Map[String, Tree], args: Seq[Tree]): Tree = { + def element(pos: Position, qname: String, attrMap: mutable.Map[String, Tree], empty: Boolean, args: Seq[Tree]): Tree = { def handleNamespaceBinding(pre: String, z: String): Tree = { def mkAssign(t: Tree): Tree = Assign( Ident(_tmpscope), @@ -259,6 +260,7 @@ abstract class SymbolicXMLBuilder(p: Parsers#Parser, preserveWS: Boolean) { const(newlabel), makeSymbolicAttrs, Ident(_scope), + empty, args ) |