<html>
<head>
<style><!--
  body {background-color:#ffffff;}
  .file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
  .pathname {font-family:monospace; float:right;}
  .fileheader {margin-bottom:.5em;}
  .diff {margin:0;}
  .tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
  .tasklist ul {margin-top:0;margin-bottom:0;}
  tr.alt {background-color:#eeeeee}
  #added {background-color:#ddffdd;}
  #addedchars {background-color:#99ff99;font-weight:bolder;}
  tr.alt #added {background-color:#ccf7cc;}
  #removed {background-color:#ffdddd;}
  #removedchars {background-color:#ff9999;font-weight:bolder;}
  tr.alt #removed {background-color:#f7cccc;}
  #copied {background-color:#ccccff;}
  tr.alt #copied {background-color:#bbbbf7;}
  #info {color:#888888;}
  #context {background-color:#eeeeee;}
  td {padding-left:.3em;padding-right:.3em;}
  tr.head {border-bottom-width:1px;border-bottom-style:solid;}
  tr.head td {padding:0;padding-top:.2em;}
  .task {background-color:#ffff00;}
  .comment {white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;padding:4px;border:1px dashed #000000;background-color:#ffffdd}
  .error {color:red;}
  hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="5">Commit in <b><tt>metaas/trunk/src/main</tt></b></td></tr>
<tr><td><tt>antlr/org/asdt/core/internal/antlr/<a href="#file1">AS3.g3</a></tt> </td><td></td><td align="right" id="added">+7</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center">509 -&gt; 510</td></tr>
<tr class="alt"><td><tt>antlr/uk/co/badgersinfoil/metaas/impl/parser/e4x/<a href="#file2">E4X.g</a></tt> </td><td></td><td align="right" id="added">+3</td><td align="right" id="removed">-2</td><td nowrap="nowrap" align="center">509 -&gt; 510</td></tr>
<tr><td><tt>java/uk/co/badgersinfoil/metaas/impl/parser/<a href="#file3">E4XHelper.java</a></tt> </td><td></td><td align="right" id="added">+16</td><td align="right" id="removed">-5</td><td nowrap="nowrap" align="center">509 -&gt; 510</td></tr>
<tr><td></td><td></td><td align="right" id="added">+26</td><td align="right" id="removed">-11</td><td></td></tr>
</table>
<small id="info">3 modified files</small><br />
<pre class="comment">
Fix problems due to the '&lt;' seen by the AS3Parser at the start of an
XML-literal being kept as the startToken for AST nodes, even though the
E4XParser was creating its own token to represent that character.

The E4X parser now reuses the token object created by the outer grammar.
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname">metaas/trunk/src/main/antlr/org/asdt/core/internal/antlr</span><br />
<div class="fileheader"><big><b>AS3.g3</b></big> <small id="info">509 -&gt; 510</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/antlr/org/asdt/core/internal/antlr/AS3.g3        2007-08-18 11:58:56 UTC (rev 509)
+++ trunk/src/main/antlr/org/asdt/core/internal/antlr/AS3.g3        2007-08-18 12:14:01 UTC (rev 510)
@@ -116,8 +116,8 @@
</small></pre><pre class="diff" id="context">         /**
          * Handle 'island grammar' for embeded XML-literal elements.
          */
</pre><pre class="diff" id="removed">-        private LinkedListTree parseXMLLiteral(LinkedListToken startMarker) throws RecognitionException {
-                return E4XHelper.parseXMLLiteral(startMarker, lexer, cs, (LinkedListTokenStream)input);
</pre><pre class="diff" id="added">+        private LinkedListTree parseXMLLiteral() throws RecognitionException {
+                return E4XHelper.parseXMLLiteral(lexer, cs, (LinkedListTokenStream)input);
</pre><pre class="diff" id="context">         }
 
         /**
</pre><pre class="diff"><small id="info">@@ -1073,8 +1073,11 @@
</small></pre><pre class="diff" id="context">         @init {
                 LinkedListTree xml = null;
         }
</pre><pre class="diff" id="removed">-        :        s=LT
-                { xml=parseXMLLiteral((LinkedListToken)$s); }
</pre><pre class="diff" id="added">+        :        // We have to have the LT in the outer grammar for lookahead
+                // in AS3Parser to be able to predict that the xmlLiteral rule
+                // should be used.
+                LT
+                { xml=parseXMLLiteral(); }
</pre><pre class="diff" id="context">                 -&gt; {xml}
         
 
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname">metaas/trunk/src/main/antlr/uk/co/badgersinfoil/metaas/impl/parser/e4x</span><br />
<div class="fileheader"><big><b>E4X.g</b></big> <small id="info">509 -&gt; 510</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/antlr/uk/co/badgersinfoil/metaas/impl/parser/e4x/E4X.g        2007-08-18 11:58:56 UTC (rev 509)
+++ trunk/src/main/antlr/uk/co/badgersinfoil/metaas/impl/parser/e4x/E4X.g        2007-08-18 12:14:01 UTC (rev 510)
@@ -79,7 +79,7 @@
</small></pre><pre class="diff" id="context">         
 
 xmlElement
</pre><pre class="diff" id="removed">-        :        (<span id="removedchars">'&lt;'</span> xmlTagContent XML_WS? -&gt; xmlTagContent)
</pre><pre class="diff" id="added">+        :        (<span id="addedchars">XML_LCHEVRON</span> xmlTagContent XML_WS? -&gt; xmlTagContent)
</pre><pre class="diff" id="context">                 (
                         '/&gt;'
                         -&gt; ^(XML_EMPTY_ELEMENT $xmlElement)
</pre><pre class="diff"><small id="info">@@ -143,6 +143,7 @@
</small></pre><pre class="diff" id="context">                 -&gt; ^(XML_LIST xmlElementContent*)
         
 
</pre><pre class="diff" id="added">+XML_LCHEVRON                :        '&lt;';
</pre><pre class="diff" id="context"> 
 XML_WS                        :        (' ' | '\t' | '\n' | '\r')+;
 
</pre><pre class="diff"><small id="info">@@ -171,5 +172,5 @@
</small></pre><pre class="diff" id="context"> fragment UNICODE_DIGIT        :        '0'..'9';
 
 XML_TEXT
</pre><pre class="diff" id="removed">-        :        (~('&lt;' | '{'))
</pre><pre class="diff" id="added">+        :        (~(XML_LCHEVRON | '{'))
</pre><pre class="diff" id="context">         
</pre></div>
<hr /><a name="file3" /><div class="file">
<span class="pathname">metaas/trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/parser</span><br />
<div class="fileheader"><big><b>E4XHelper.java</b></big> <small id="info">509 -&gt; 510</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/parser/E4XHelper.java        2007-08-18 11:58:56 UTC (rev 509)
+++ trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/parser/E4XHelper.java        2007-08-18 12:14:01 UTC (rev 510)
@@ -40,9 +40,8 @@
</small></pre><pre class="diff" id="context">                 return parser;
         }
 
</pre><pre class="diff" id="removed">-        public static LinkedListTree parseXMLLiteral(LinkedListToken startMarker, AS3Lexer lexer, CharStream cs, LinkedListTokenStream stream) throws RecognitionException {
-                String tail = startMarker.getText()  // the '&lt;'
-                            + cs.substring(cs.index(), cs.size()-1);  // the rest
</pre><pre class="diff" id="added">+        public static LinkedListTree parseXMLLiteral(AS3Lexer lexer, CharStream cs, LinkedListTokenStream stream) throws RecognitionException {
+                String tail = cs.substring(cs.index(), cs.size()-1);
</pre><pre class="diff" id="context">                 int initialTailLength = tail.length();
                 E4XParser parser;
                 try {
</pre><pre class="diff"><small id="info">@@ -54,7 +53,7 @@
</small></pre><pre class="diff" id="context">                 LinkedListTree ast = AS3FragmentParser.tree(parser.xmlPrimary());
                 tail = parser.getInputTail();
                 // skip over the XML in the original, underlying CharStream
</pre><pre class="diff" id="removed">-                cs.seek(cs.index() + (initialTailLength - tail.length())<span id="removedchars">&nbsp;-&nbsp;1</span>);
</pre><pre class="diff" id="added">+                cs.seek(cs.index() + (initialTailLength - tail.length()));
</pre><pre class="diff" id="context">                 LinkedListTokenSource source = (LinkedListTokenSource)stream.getTokenSource();
                 stream.setTokenSource(source);  // cause any remembered E4X state to be dropped
                 stream.scrub(1); // erase the subsequent token that the E4X parser got from this stream
</pre><pre class="diff"><small id="info">@@ -66,8 +65,20 @@
</small></pre><pre class="diff" id="context">                 ANTLRReaderStream cs = new ANTLRReaderStream(in);
                 E4XLexer lexer = new E4XLexer(cs);
                 LinkedListTokenSource source = (LinkedListTokenSource)stream.getTokenSource();
</pre><pre class="diff" id="removed">-                stream.scrub(1); // erase the '&lt;' and subsequent token that the AS3 parser got from this stream
</pre><pre class="diff" id="context">                 source.setDelegate(lexer);
</pre><pre class="diff" id="added">+                
+                // The AS3 grammar will see the initial '&lt;' as an LT (less-than)
+                // token, and lookahead in the AS3Parser will have already
+                // grabbed references to that token in order to make it the
+                // startToken for various AST subtrees, so we can't just delete
+                // it.  We therefore find the LT token and change its type to
+                // match the E4X vocabulary, and then rewind the token stream
+                // so that this will be the first token that the E4XParser will
+                // see.
+                LinkedListToken startMarker = (LinkedListToken)stream.LT(-1);
+                startMarker.setType(E4XParser.XML_LCHEVRON);
+                stream.seek(stream.index()-1);
+
</pre><pre class="diff" id="context">                 E4XParser parser = new E4XParser(stream);
                 parser.setTreeAdaptor(new LinkedListTreeAdaptor());
                 parser.setInput(lexer, cs);
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -&gt; email">CVSspam</a> 0.2.12</small></center>
</body></html>