[as2api-dev] [CVS trunk] Make line number information available in objects representing javadoc tags

David Holroyd dave at badgers-in-foil.co.uk
Tue, 26 Jul 2005 21:07:46 +0000


<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;}
  #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 {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="4">Commit in <b><tt>trunk/as2api</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1">doc_comment.rb</a></tt></td><td align="right" id="added">+31</td><td align="right" id="removed">-7</td><td nowrap="nowrap" align="center"><a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/doc_comment.rb?rev=207&amp;content-type=text/vnd.viewcvs-markup">207</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/doc_comment.rb.diff?r1=207&amp;r2=208">-&gt;</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/doc_comment.rb?rev=208&amp;content-type=text/vnd.viewcvs-markup">208</a></td></tr>
<tr class="alt"><td><tt><a href="#file2">html_output.rb</a></tt></td><td align="right" id="added">+10</td><td align="right" id="removed">-3</td><td nowrap="nowrap" align="center"><a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb?rev=207&amp;content-type=text/vnd.viewcvs-markup">207</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb.diff?r1=207&amp;r2=208">-&gt;</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb?rev=208&amp;content-type=text/vnd.viewcvs-markup">208</a></td></tr>
<tr><td></td><td align="right" id="added">+41</td><td align="right" id="removed">-10</td><td></td></tr>
</table>
<small id="info">2 modified files</small><br />
<pre class="comment">
Make line number information available in objects representing javadoc tags
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname"><a
href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk">trunk</a>/<a
href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api">as2api</a></span><br />
<div class="fileheader"><big><b>doc_comment.rb</b></big> <small id="info"><a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/doc_comment.rb?rev=207&amp;content-type=text/vnd.viewcvs-markup">207</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/doc_comment.rb.diff?r1=207&amp;r2=208">-&gt;</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/doc_comment.rb?rev=208&amp;content-type=text/vnd.viewcvs-markup">208</a></small></div>
<pre class="diff"><small id="info">--- trunk/as2api/doc_comment.rb	2005-07-24 22:59:39 UTC (rev 207)
+++ trunk/as2api/doc_comment.rb	2005-07-26 21:07:43 UTC (rev 208)
@@ -58,7 +58,8 @@
</small></pre><pre class="diff" id="context">   end
 
   def end_inline_tag
</pre><pre class="diff" id="removed">-    @block_handler.add_inline(@inline_handler.end)
</pre><pre class="diff" id="added">+    tag = @inline_handler.end
+    @block_handler.add_inline(tag) if tag
</pre><pre class="diff" id="context">     @inline_handler = nil
   end
 
</pre><pre class="diff"><small id="info">@@ -105,8 +106,17 @@
</small></pre><pre class="diff" id="context"> end
 
 
</pre><pre class="diff" id="removed">-class LinkTag
-  def initialize(target, member, text)
</pre><pre class="diff" id="added">+class Tag
+  def initialize(lineno)
+    @lineno = lineno
+  end
+
+  attr_accessor :lineno
+end
+
+class LinkTag &lt; Tag
+  def initialize(lineno, target, member, text)
+    super(lineno)
</pre><pre class="diff" id="context">     @target = target
     @member = member
     @text = text
</pre><pre class="diff"><small id="info">@@ -115,8 +125,9 @@
</small></pre><pre class="diff" id="context">   attr_accessor :target, :member, :text
 end
 
</pre><pre class="diff" id="removed">-class CodeTag
-  def initialize(text)
</pre><pre class="diff" id="added">+class CodeTag &lt; Tag
+  def initialize(lineno, text)
+    super(lineno)
</pre><pre class="diff" id="context">     @text = text
   end
 
</pre><pre class="diff"><small id="info">@@ -201,7 +212,7 @@
</small></pre><pre class="diff" id="context">     else
       type_proxy = type_resolver.resolve(type_name, lineno)
     end
</pre><pre class="diff" id="removed">-    return LinkTag.new(type_proxy, member_name, text)
</pre><pre class="diff" id="added">+    return LinkTag.new(<span id="addedchars">lineno,&nbsp;</span>type_proxy, member_name, text)
</pre><pre class="diff" id="context">   end
   return nil
 end
</pre><pre class="diff"><small id="info">@@ -221,7 +232,7 @@
</small></pre><pre class="diff" id="context"> 
 # handle {@code ...} in comments
 class CodeInlineParser &lt; InlineParser
</pre><pre class="diff" id="removed">-  def end; CodeTag.new(@text); end
</pre><pre class="diff" id="added">+  def end; CodeTag.new(@<span id="addedchars">lineno,&nbsp;@</span>text); end
</pre><pre class="diff" id="context"> end
 
 
</pre><pre class="diff"><small id="info">@@ -251,6 +262,12 @@
</small></pre><pre class="diff" id="context"> 
   def handler_for(tag)
     inline_parser = @inline_parsers[tag.body]
</pre><pre class="diff" id="added">+    if inline_parser.nil?
+      $stderr.puts("#{tag.lineno}: Unknown inline tag #{tag.body.inspect} for #{self.class.name}")
+      NIL_INLINE_PARSER
+    else
+      inline_parser
+    end
</pre><pre class="diff" id="context">   end
 
   def text(text)
</pre><pre class="diff"><small id="info">@@ -291,11 +308,18 @@
</small></pre><pre class="diff" id="context"> 
 class NilBlockParser &lt; BlockParser
   def add_text(text); end
</pre><pre class="diff" id="added">+  def handler_for(tag); NIL_INLINE_PARSER; end
</pre><pre class="diff" id="context"> end
 
 NIL_HANDLER = NilBlockParser.new
 
 
</pre><pre class="diff" id="added">+class NilInlineParser &lt; InlineParser
+  def end; nil; end
+end
+
+NIL_INLINE_PARSER = NilInlineParser.new
+
</pre><pre class="diff" id="context"> class ParamParser &lt; BlockParser
   def begin_block(type_resolver, lineno)
     super(type_resolver, lineno)
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname"><a
href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk">trunk</a>/<a
href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api">as2api</a></span><br />
<div class="fileheader"><big><b>html_output.rb</b></big> <small id="info"><a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb?rev=207&amp;content-type=text/vnd.viewcvs-markup">207</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb.diff?r1=207&amp;r2=208">-&gt;</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb?rev=208&amp;content-type=text/vnd.viewcvs-markup">208</a></small></div>
<pre class="diff"><small id="info">--- trunk/as2api/html_output.rb	2005-07-24 22:59:39 UTC (rev 207)
+++ trunk/as2api/html_output.rb	2005-07-26 21:07:43 UTC (rev 208)
@@ -411,6 +411,8 @@
</small></pre><pre class="diff" id="context">     @type = nil
   end
 
</pre><pre class="diff" id="added">+  def astype; @type; end
+
</pre><pre class="diff" id="context">   def generate_content
     html_body do
       # accessability; make a link to skip over the initial navigation elements
</pre><pre class="diff"><small id="info">@@ -473,6 +475,7 @@
</small></pre><pre class="diff" id="context">       end
     elsif inline.is_a?(CodeTag)
       input = StringIO.new(inline.text)
</pre><pre class="diff" id="added">+      input.lineno = inline.lineno
</pre><pre class="diff" id="context">       highlight = CodeHighlighter.new
       highlight.number_lines = false
       if inline.text =~ /[\n\r]/
</pre><pre class="diff"><small id="info">@@ -1819,9 +1822,13 @@
</small></pre><pre class="diff" id="context">   end
 
   def highlight(input, output)
</pre><pre class="diff" id="removed">-    lex = HighlightASLexer.new(output, input)
-    lex.number_lines = @number_lines
-    while lex.get_next; end
</pre><pre class="diff" id="added">+    begin
+      lex = HighlightASLexer.new(output, input)
+      lex.number_lines = @number_lines
+      while lex.get_next; end
+    rescue =&gt; e
+      $stderr.puts "#{output.astype.input_filename}:#{e.message}"
+    end
</pre><pre class="diff" id="context">   end
 end
 
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -&gt; email">CVSspam</a> 0.2.11</small></center>
</body></html>