summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2015-04-16 12:07:02 -0700
committerSom Snytt <som.snytt@gmail.com>2015-04-16 12:07:02 -0700
commit498a07fcd8d922545e942b817d3fbd16ef56809b (patch)
tree2bdd71dd47eb2e209bd585087cc20215f028b5d9 /src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala
parent8623c2be74f8de0c400dcc04eb6f83168c6272c0 (diff)
downloadscala-498a07fcd8d922545e942b817d3fbd16ef56809b.tar.gz
scala-498a07fcd8d922545e942b817d3fbd16ef56809b.tar.bz2
scala-498a07fcd8d922545e942b817d3fbd16ef56809b.zip
SI-3368 Default to coalescing for 2.11
Preserve current behavior (no PCData nodes, only Text) for 2.11. The coalescing flag is on if enabled or if source level is not 2.12 and no flag was supplied. The subtle change is that adjacent Text nodes are thereby coalesced. This happens in the presence of CData sections, but this is at the discretion of the parser anyway. Also, no PCData nodes are emitted under coalescing, even if there were no sibling text nodes. That is the correct behavior: the general idea is that coalescing mode says, I only want to deal with text.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala')
-rwxr-xr-xsrc/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala
index 99399e363f..67241ef639 100755
--- a/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala
@@ -126,10 +126,9 @@ abstract class SymbolicXMLBuilder(p: Parsers#Parser, preserveWS: Boolean) {
def makeTextPat(txt: Tree) = Apply(_scala_xml__Text, List(txt))
def makeText1(txt: Tree) = New(_scala_xml_Text, LL(txt))
def comment(pos: Position, text: String) = atPos(pos)( Comment(const(text)) )
- def charData(pos: Position, txt: String) = atPos(pos) {
- val t = if (isPattern) Apply(_scala_xml(xmlterms._PCData), List(const(txt)))
- else New(_scala_xml(_PCData), LL(const(txt)))
- if (coalescing) t updateAttachment TextAttache(pos, txt) else t
+ def charData(pos: Position, txt: String) = if (coalescing) text(pos, txt) else atPos(pos) {
+ if (isPattern) Apply(_scala_xml(xmlterms._PCData), List(const(txt)))
+ else New(_scala_xml(_PCData), LL(const(txt)))
}
def procInstr(pos: Position, target: String, txt: String) =