<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</tt></b></td></tr>
<tr><td><tt>main/java/uk/co/badgersinfoil/metaas/impl/antlr/<a href="#file1">LinkedListTokenStream.java</a></tt> </td><td></td><td align="right" id="added">+15</td><td></td><td nowrap="nowrap" align="center">439 -> 440</td></tr>
<tr class="alt"><td><tt>test/java/uk/co/badgersinfoil/metaas/impl/antlr/<a href="#file2"><span id="added">LinkedListTokenStreamTest.java</span></a></tt> </td><td></td><td align="right" id="added">+42</td><td></td><td nowrap="nowrap" align="right">added 440</td></tr>
<tr><td></td><td></td><td align="right" id="added">+57</td><td></td><td></td></tr>
</table>
<small id="info">1 added + 1 modified, total 2 files</small><br />
<pre class="comment">
Don't keep appending new EOF tokens to the end of the stream
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname">metaas/trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/antlr</span><br />
<div class="fileheader"><big><b>LinkedListTokenStream.java</b></big> <small id="info">439 -> 440</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/antlr/LinkedListTokenStream.java        2007-02-25 22:38:22 UTC (rev 439)
+++ trunk/src/main/java/uk/co/badgersinfoil/metaas/impl/antlr/LinkedListTokenStream.java        2007-02-26 00:02:24 UTC (rev 440)
@@ -92,6 +92,21 @@
</small></pre><pre class="diff" id="context">                         }
                        t = (LinkedListToken)tokenSource.nextToken();
                }
</pre><pre class="diff" id="added">+                if (t.getType() == CharStream.EOF) {
+                        // prevent ourselves from producing lots of EOF tokens
+                        // if the parser is 'pushy'; also, do the head/tail dance
+                        if (tail!=null && tail.getType()==CharStream.EOF) {
+                                return tail;
+                        } else {
+                                if (head == null && tail == null) {
+                                        head = tail = t;
+                                } else {
+                                        tail.setNext(t);
+                                        t.setPrev(tail);
+                                        tail = t;
+                                }
+                        }
+                }
</pre><pre class="diff" id="context">                 return skipOffTokenChannels(t);
        }
        
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname" id="added">metaas/trunk/src/test/java/uk/co/badgersinfoil/metaas/impl/antlr</span><br />
<div class="fileheader" id="added"><big><b>LinkedListTokenStreamTest.java</b></big> <small id="info">added at 440</small></div>
<pre class="diff"><small id="info">--- trunk/src/test/java/uk/co/badgersinfoil/metaas/impl/antlr/LinkedListTokenStreamTest.java        2007-02-25 22:38:22 UTC (rev 439)
+++ trunk/src/test/java/uk/co/badgersinfoil/metaas/impl/antlr/LinkedListTokenStreamTest.java        2007-02-26 00:02:24 UTC (rev 440)
@@ -0,0 +1,42 @@
</small></pre><pre class="diff" id="added">+package uk.co.badgersinfoil.metaas.impl.antlr;
+
+import org.antlr.runtime.CharStream;
+import org.antlr.runtime.CommonToken;
+import org.antlr.runtime.Token;
+import org.antlr.runtime.TokenSource;
+import junit.framework.TestCase;
+
+public class LinkedListTokenStreamTest extends TestCase {
+        private static final int TYPE_TEST = 123;
+
+        public void testEOF() {
+                TokenSource source = new TokenSource() {
+                        private boolean done = false;
+                        public Token nextToken() {
+                                if (done) {
+                                        return Token.EOF_TOKEN;
+                                }
+                                done = true;
+                                return new CommonToken(TYPE_TEST, "test");
+                        }
+                };
+                LinkedListTokenSource linkedSource = new LinkedListTokenSource(source);
+                LinkedListTokenStream stream = new LinkedListTokenStream(linkedSource);
+                LinkedListToken tok = next(stream);
+                assertEquals(TYPE_TEST, tok.getType());
+                LinkedListToken eof = next(stream);
+                assertEquals(CharStream.EOF, eof.getType());
+                assertEquals(tok, eof.getPrev());
+
+                LinkedListToken eof2 = next(stream);
+                assertEquals(CharStream.EOF, eof2.getType());
+                assertSame(eof, eof2);
+                assertEquals(tok, eof2.getPrev());
+        }
+
+        private LinkedListToken next(LinkedListTokenStream stream) {
+                LinkedListToken tok = (LinkedListToken)stream.LT(1);
+                stream.consume();
+                return tok;
+        }
+}
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -> email">CVSspam</a> 0.2.12</small></center>
</body></html>