[as2api-dev] [CVS trunk] Beat doc_comment.rb until the new comment parser code fits.

David Holroyd dave at badgers-in-foil.co.uk
Fri, 15 Jul 2005 22:06:22 +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">api_loader.rb</a></tt></td><td align="right" id="added">+22</td><td align="right" id="removed">-13</td><td nowrap="nowrap" align="center"><a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/api_loader.rb?rev=200&amp;content-type=text/vnd.viewcvs-markup">200</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/api_loader.rb.diff?r1=200&amp;r2=201">-&gt;</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/api_loader.rb?rev=201&amp;content-type=text/vnd.viewcvs-markup">201</a></td></tr>
<tr class="alt"><td><tt><a href="#file2">doc_comment.rb</a></tt></td><td align="right" id="added">+124</td><td align="right" id="removed">-125</td><td nowrap="nowrap" align="center"><a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/doc_comment.rb?rev=200&amp;content-type=text/vnd.viewcvs-markup">200</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/doc_comment.rb.diff?r1=200&amp;r2=201">-&gt;</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/doc_comment.rb?rev=201&amp;content-type=text/vnd.viewcvs-markup">201</a></td></tr>
<tr><td></td><td align="right" id="added">+146</td><td align="right" id="removed">-138</td><td></td></tr>
</table>
<small id="info">2 modified files</small><br />
<pre class="comment">
Beat doc_comment.rb until the new comment parser code fits.

Kinda ugly, but seems to work.
</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>api_loader.rb</b></big> <small id="info"><a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/api_loader.rb?rev=200&amp;content-type=text/vnd.viewcvs-markup">200</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/api_loader.rb.diff?r1=200&amp;r2=201">-&gt;</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/api_loader.rb?rev=201&amp;content-type=text/vnd.viewcvs-markup">201</a></small></div>
<pre class="diff"><small id="info">--- trunk/as2api/api_loader.rb	2005-07-15 22:05:05 UTC (rev 200)
+++ trunk/as2api/api_loader.rb	2005-07-15 22:06:20 UTC (rev 201)
@@ -3,6 +3,8 @@
</small></pre><pre class="diff" id="context"> require 'parse/parser'
 require 'api_model'
 require 'doc_comment'
</pre><pre class="diff" id="added">+require 'parse/doccomment_lexer'
+require 'stringio'
</pre><pre class="diff" id="context"> 
 # We used to just define the class again to add this attribute, but I want
 # to be compatable with Ruby1.6, which doesn' allow 'class ModName::ClassName'
</pre><pre class="diff"><small id="info">@@ -100,9 +102,9 @@
</small></pre><pre class="diff" id="context"> class DocASHandler &lt; ActionScript::Parse::ASHandler
   def initialize
     parse_conf_build = ConfigBuilder.new
</pre><pre class="diff" id="removed">-    @method_comment_parser = DocCommentParser.new(parse_conf_build.build_method_config)
-    @field_comment_parser = DocCommentParser.new(parse_conf_build.build_field_config)
-    @type_comment_parser = DocCommentParser.new(parse_conf_build.build_type_config)
</pre><pre class="diff" id="added">+    @method_comment_config = parse_conf_build.build_method_config
+    @field_comment_config = parse_conf_build.build_field_config
+    @type_comment_config = parse_conf_build.build_type_config
</pre><pre class="diff" id="context">   end
 
   def compilation_unit_start
</pre><pre class="diff"><small id="info">@@ -124,8 +126,7 @@
</small></pre><pre class="diff" id="context">     @defined_type = ASClass.new(name)
     @type_resolver = LocalTypeResolver.new(@defined_type)
     if @doc_comment
</pre><pre class="diff" id="removed">-      input = create_comment_parser_input(@doc_comment)
-      @defined_type.comment = @type_comment_parser.parse(input)
</pre><pre class="diff" id="added">+      @defined_type.comment = parse_comment(@type_comment_config, @doc_comment)
</pre><pre class="diff" id="context">     end
     @defined_type.dynamic = dynamic
     if super_name
</pre><pre class="diff"><small id="info">@@ -149,8 +150,7 @@
</small></pre><pre class="diff" id="context">     @defined_type = ASInterface.new(name)
     @type_resolver = LocalTypeResolver.new(@defined_type)
     if @doc_comment
</pre><pre class="diff" id="removed">-      input = create_comment_parser_input(@doc_comment)
-      @defined_type.comment = @type_comment_parser.parse(input)
</pre><pre class="diff" id="added">+      @defined_type.comment = parse_comment(@type_comment_config, @doc_comment)
</pre><pre class="diff" id="context">     end
     if super_name
       @defined_type.extends = @type_resolver.resolve(super_name)
</pre><pre class="diff"><small id="info">@@ -181,8 +181,7 @@
</small></pre><pre class="diff" id="context">       field.field_type = @type_resolver.resolve(type)
     end
     if @doc_comment
</pre><pre class="diff" id="removed">-      input = create_comment_parser_input(@doc_comment)
-      field.comment = @field_comment_parser.parse(input)
</pre><pre class="diff" id="added">+      field.comment = parse_comment(@field_comment_config, @doc_comment)
</pre><pre class="diff" id="context">     end
     @defined_type.add_field(field)
   end
</pre><pre class="diff"><small id="info">@@ -218,8 +217,7 @@
</small></pre><pre class="diff" id="context">       method.add_arg(argument)
     end
     if @doc_comment
</pre><pre class="diff" id="removed">-      input = create_comment_parser_input(@doc_comment)
-      method.comment = @method_comment_parser.parse(input)
</pre><pre class="diff" id="added">+      method.comment = parse_comment(@method_comment_config, @doc_comment)
</pre><pre class="diff" id="context">     end
     method
   end
</pre><pre class="diff"><small id="info">@@ -249,8 +247,19 @@
</small></pre><pre class="diff" id="context">     end
   end
 
</pre><pre class="diff" id="removed">-  def create_comment_parser_input(comment_token)
-    CommentInput.new(comment_token.body, comment_token.lineno, @type_resolver)
</pre><pre class="diff" id="added">+  def parse_comment(config, comment_token)
+    comment_data = CommentData.new
+
+    input = StringIO.new(comment_token.body)
+    input.lineno = comment_token.lineno
+    lexer = ActionScript::Parse::DocCommentLexer.new(input)
+    parser = ActionScript::Parse::DocCommentParser.new(lexer)
+    handler = OurDocCommentHandler.new(comment_data, config, @type_resolver)
+    parser.handler = handler
+
+    parser.parse_comment
+
+    comment_data
</pre><pre class="diff" id="context">   end
 end
 
</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>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=200&amp;content-type=text/vnd.viewcvs-markup">200</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/doc_comment.rb.diff?r1=200&amp;r2=201">-&gt;</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/doc_comment.rb?rev=201&amp;content-type=text/vnd.viewcvs-markup">201</a></small></div>
<pre class="diff"><small id="info">--- trunk/as2api/doc_comment.rb	2005-07-15 22:05:05 UTC (rev 200)
+++ trunk/as2api/doc_comment.rb	2005-07-15 22:06:20 UTC (rev 201)
@@ -1,54 +1,6 @@
</small></pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">-class CommentInput
-  def initialize(text, lineno, type_resolver)
-    @text = text
-    @lineno = lineno
-    @type_resolver = type_resolver
-  end
</pre><pre class="diff" id="added">+require 'parse/doccomment_parser'
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">-  attr_accessor :text, :lineno, :type_resolver
-
-  def derive(text, lineno=nil)
-    lineno = @lineno if lineno.nil?
-    return CommentInput.new(text, lineno, @type_resolver)
-  end
-end
-
-
-class DocCommentParser
-  def initialize(config)
-    @config = config
-  end
-
-  def parse(input)
-    data = CommentData.new
-    @config.begin_comment(data)
-    lineno = input.lineno
-    input.text.scan(/[^\n\r]*(?:\n\r|\n|\r)?/) do |text|
-      parse_line(input.derive(strip_stars(text), lineno))
-      lineno += 1
-    end
-    @config.end_comment
-    return data
-  end
-
-  private
-
-  def strip_stars(text)
-    text.sub(/\A\s*\**/, "").sub(/[ \t]*\Z/, "")
-  end
-
-  def parse_line(input)
-    if input.text =~ /^\s*@([a-zA-Z]+)\s*/
-      @config.begin_block($1)
-      @config.parse(input.derive($'))
-    else
-      @config.parse(input)
-    end
-  end
-end
-
-
</pre><pre class="diff" id="context"> class CommentData
   def initialize
     @blocks = []
</pre><pre class="diff"><small id="info">@@ -69,64 +21,87 @@
</small></pre><pre class="diff" id="context">   end
 end
 
</pre><pre class="diff" id="removed">-
-class DocCommentParserConfig
-  def initialize
-    @block_handlers = {}
-  end
-
-  def begin_comment(comment_data)
</pre><pre class="diff" id="added">+class OurDocCommentHandler &lt; ActionScript::Parse::DocCommentHandler
+  def initialize(comment_data, handler_config, type_resolver)
</pre><pre class="diff" id="context">     @comment_data = comment_data
</pre><pre class="diff" id="removed">-    @block = @description_block_handler
-    beginning_of_block
</pre><pre class="diff" id="added">+    @handler_config = handler_config
+    @type_resolver = type_resolver
</pre><pre class="diff" id="context">   end
 
</pre><pre class="diff" id="removed">-  def add_block_parser(name, handler)
-    @block_handlers[name] = handler
-    handler.handler = self
</pre><pre class="diff" id="added">+  def comment_start(lineno)
+    @block_handler = @handler_config.initial_block_handler
+    @inline_handler = nil
+    beginning_of_block(lineno)
</pre><pre class="diff" id="context">   end
 
</pre><pre class="diff" id="removed">-  def description_handler=(handler)
-    @description_block_handler = handler
</pre><pre class="diff" id="added">+  def comment_end
+    end_of_block
</pre><pre class="diff" id="context">   end
 
</pre><pre class="diff" id="removed">-  def end_comment
-    end_of_block
</pre><pre class="diff" id="added">+  def text(text)
+    if @inline_handler
+      @inline_handler.text(text)
+    else
+      @block_handler.text(text)
+    end
</pre><pre class="diff" id="context">   end
 
</pre><pre class="diff" id="removed">-  def begin_block(kind)
</pre><pre class="diff" id="added">+  def start_paragraph_tag(tag)
</pre><pre class="diff" id="context">     end_of_block
</pre><pre class="diff" id="removed">-    @block = handler_for(kind)
-    beginning_of_block
</pre><pre class="diff" id="added">+    @block_handler = @handler_config.handler_for(tag)
+    beginning_of_block(tag.lineno)
</pre><pre class="diff" id="context">   end
 
</pre><pre class="diff" id="removed">-  def parse(text)
-    @block.parse_line(text)
</pre><pre class="diff" id="added">+  def start_inline_tag(tag)
+    @inline_handler = @block_handler.handler_for(tag)
+    @inline_handler.start(@type_resolver, tag.lineno)
</pre><pre class="diff" id="context">   end
 
</pre><pre class="diff" id="removed">-  def parse_error(msg)
-    $stderr.puts(msg)
</pre><pre class="diff" id="added">+  def end_inline_tag
+    @block_handler.add_inline(@inline_handler.end)
+    @inline_handler = nil
</pre><pre class="diff" id="context">   end
 
   private
 
</pre><pre class="diff" id="added">+  def beginning_of_block(lineno)
+    @block_handler.begin_block(@type_resolver, lineno)
+  end
+
+  def end_of_block
+    block = @block_handler.end_block
+    @comment_data.add_block(block) unless block.nil?
+  end
+end
+
+class DocCommentParserConfig
+  def initialize
+    @initial_block_handler = nil
+    @block_handlers = {}
+  end
+
+  attr_accessor :initial_block_handler
+
+  def add_block_parser(name, handler)
+    @block_handlers[name] = handler
+    handler.handler = self
+  end
+
</pre><pre class="diff" id="context">   def handler_for(kind)
</pre><pre class="diff" id="removed">-    handler = @block_handlers[kind]
</pre><pre class="diff" id="added">+    handler = @block_handlers[kind<span id="addedchars">.body</span>]
</pre><pre class="diff" id="context">     if handler.nil?
</pre><pre class="diff" id="removed">-      parse_error("Unknown block tag @#{kind}")
</pre><pre class="diff" id="added">+      parse_error("#{kind.lineno}: Unknown block tag @#{kind.body}")
</pre><pre class="diff" id="context">       handler = NIL_HANDLER
     end
     handler
   end
 
</pre><pre class="diff" id="removed">-  def beginning_of_block
-    @block.begin_block
-  end
</pre><pre class="diff" id="added">+  private
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">-  def end_of_block
-    data = @block.end_block
-    @comment_data.add_block(data) unless data.nil?
</pre><pre class="diff" id="added">+  def parse_error(msg)
+    $stderr.puts(msg)
</pre><pre class="diff" id="context">   end
</pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context"> end
 
 
</pre><pre class="diff"><small id="info">@@ -155,7 +130,13 @@
</small></pre><pre class="diff" id="context">   end
 
   def add_inline(inline)
</pre><pre class="diff" id="removed">-    @inlines &lt;&lt; inline
</pre><pre class="diff" id="added">+    # coalesce multiple consecutive strings,
+    last_inline = @inlines.last
+    if inline.is_a?(String) &amp;&amp; last_inline.is_a?(String)
+      last_inline &lt;&lt; inline
+    else
+      @inlines &lt;&lt; inline
+    end
</pre><pre class="diff" id="context">   end
 
   def each_inline
</pre><pre class="diff"><small id="info">@@ -163,6 +144,10 @@
</small></pre><pre class="diff" id="context">       yield inline
     end
   end
</pre><pre class="diff" id="added">+
+  def inlines
+    @inlines
+  end
</pre><pre class="diff" id="context"> end
 
 
</pre><pre class="diff"><small id="info">@@ -185,15 +170,21 @@
</small></pre><pre class="diff" id="context"> 
 
 class InlineParser
</pre><pre class="diff" id="removed">-  def parse(block_data, inpu)
-    raise "implement me"
</pre><pre class="diff" id="added">+  def start(type_resolver, lineno)
+    @type_resolver = type_resolver
+    @lineno = lineno
+    @text = ""
</pre><pre class="diff" id="context">   end
</pre><pre class="diff" id="added">+
+  def text(text)
+    @text &lt;&lt; text.to_s
+  end
</pre><pre class="diff" id="context"> end
 
 
 # creates a LinkTag inline
</pre><pre class="diff" id="removed">-def create_link(input)
-  if input.text =~ /^([^\s]+(?:\([^\)]*\))?)\s*/
</pre><pre class="diff" id="added">+def create_link(type_resolver, text, lineno)
+  if text =~ /^\s*([^\s]+(?:\([^\)]*\))?)\s*/
</pre><pre class="diff" id="context">     target = $1
     text = $'
     # TODO: need a MemberProxy (and maybe Method+Field subclasses) with similar
</pre><pre class="diff"><small id="info">@@ -208,7 +199,7 @@
</small></pre><pre class="diff" id="context">     if type_name == ""
       type_proxy = nil
     else
</pre><pre class="diff" id="removed">-      type_proxy = input.type_resolver.resolve(type_name, input.lineno)
</pre><pre class="diff" id="added">+      type_proxy = type_resolver.resolve(type_name, lineno)
</pre><pre class="diff" id="context">     end
     return LinkTag.new(type_proxy, member_name, text)
   end
</pre><pre class="diff"><small id="info">@@ -218,21 +209,19 @@
</small></pre><pre class="diff" id="context"> 
 # handle {@link ...} in comments
 class LinkInlineParser &lt; InlineParser
</pre><pre class="diff" id="removed">-  def parse(block_data, input)
-    link = create_link(input)
</pre><pre class="diff" id="added">+  def end
+    link = create_link(@type_resolver, @text, @lineno)
</pre><pre class="diff" id="context">     if link.nil?
</pre><pre class="diff" id="removed">-      block_data.add_inline("{@link #{input.text}}")
</pre><pre class="diff" id="added">+      "{@link #{@text}}"
</pre><pre class="diff" id="context">     else
</pre><pre class="diff" id="removed">-      block_data.add_inline(link)
</pre><pre class="diff" id="added">+      link
</pre><pre class="diff" id="context">     end
   end
 end
 
 # handle {@code ...} in comments
 class CodeInlineParser &lt; InlineParser
</pre><pre class="diff" id="removed">-  def parse(block_data, input)
-    block_data.add_inline(CodeTag.new(input.text))
-  end
</pre><pre class="diff" id="added">+  def end; CodeTag.new(@text); end
</pre><pre class="diff" id="context"> end
 
 
</pre><pre class="diff"><small id="info">@@ -244,7 +233,9 @@
</small></pre><pre class="diff" id="context"> 
   attr_accessor :handler
 
</pre><pre class="diff" id="removed">-  def begin_block
</pre><pre class="diff" id="added">+  def begin_block(type_resolver, lineno)
+    @type_resolver = type_resolver
+    @lineno = lineno
</pre><pre class="diff" id="context">   end
 
   def parse_line(text)
</pre><pre class="diff"><small id="info">@@ -258,6 +249,18 @@
</small></pre><pre class="diff" id="context">     @inline_parsers[tag_name] = parser
   end
 
</pre><pre class="diff" id="added">+  def handler_for(tag)
+    inline_parser = @inline_parsers[tag.body]
+  end
+
+  def text(text)
+    add_text(text.to_s)
+  end
+
+  def add_inline(tag)
+    @data.add_inline(tag)
+  end
+
</pre><pre class="diff" id="context">   def parse_inlines(input)
     text = input.text
     while text.length &gt; 0
</pre><pre class="diff"><small id="info">@@ -281,6 +284,7 @@
</small></pre><pre class="diff" id="context">   end
 
   def add_text(text)
</pre><pre class="diff" id="added">+    raise "#{self.class.name} has no @data" unless @data
</pre><pre class="diff" id="context">     @data.add_inline(text)
   end
 end
</pre><pre class="diff"><small id="info">@@ -290,7 +294,8 @@
</small></pre><pre class="diff" id="context"> 
 
 class ParamParser &lt; BlockParser
</pre><pre class="diff" id="removed">-  def begin_block
</pre><pre class="diff" id="added">+  def begin_block(type_resolver, lineno)
+    super(type_resolver, lineno)
</pre><pre class="diff" id="context">     @data = ParamBlockTag.new
   end
 
</pre><pre class="diff"><small id="info">@@ -306,23 +311,27 @@
</small></pre><pre class="diff" id="context"> 
 
 class ThrowsParser &lt; BlockParser
</pre><pre class="diff" id="removed">-  def begin_block
</pre><pre class="diff" id="added">+  def begin_block(type_resolver, lineno)
+    super(type_resolver, lineno)
</pre><pre class="diff" id="context">     @data = ThrowsBlockTag.new
   end
 
</pre><pre class="diff" id="removed">-  def parse_line(input)
-    if @data.exception_type.nil?
-      input.text =~ /\A\s*([^\s]+)\s+/
-      @data.exception_type = input.type_resolver.resolve($1)
-      input = input.derive($')
-    end
-    parse_inlines(input)
</pre><pre class="diff" id="added">+  def end_block
+      first_inline = @data.inlines[0]
+      if first_inline =~ /\A\s*([^\s]+)\s+/
+	@data.inlines[0] = $'
+        @data.exception_type = @type_resolver.resolve($1)
+	@data
+      else
+	nil
+      end
</pre><pre class="diff" id="context">   end
 end
 
 
 class ReturnParser &lt; BlockParser
</pre><pre class="diff" id="removed">-  def begin_block
</pre><pre class="diff" id="added">+  def begin_block(type_resolver, lineno)
+    super(type_resolver, lineno)
</pre><pre class="diff" id="context">     @data = ReturnBlockTag.new
   end
   def parse_line(input)
</pre><pre class="diff"><small id="info">@@ -332,43 +341,33 @@
</small></pre><pre class="diff" id="context"> 
 
 class DescriptionParser &lt; BlockParser
</pre><pre class="diff" id="removed">-  def begin_block
</pre><pre class="diff" id="added">+  def begin_block(type_resolver, lineno)
+    super(type_resolver, lineno)
</pre><pre class="diff" id="context">     @data = BlockTag.new
   end
</pre><pre class="diff" id="removed">-  def parse_line(input)
-    parse_inlines(input)
-  end
</pre><pre class="diff" id="context"> end
 
 
 class SeeParser &lt; BlockParser
</pre><pre class="diff" id="removed">-  def begin_block
-    @data = nil
</pre><pre class="diff" id="added">+  def begin_block(type_resolver, lineno)
+    super(type_resolver, lineno)
+    @data = SeeBlockTag.new
</pre><pre class="diff" id="context">   end
 
</pre><pre class="diff" id="removed">-  def parse_line(input)
-    if @data.nil?
-      @data = SeeBlockTag.new
-      input.text =~ /\A\s*/
</pre><pre class="diff" id="added">+  def end_block
+      @data.inlines.first =~ /\A\s*/
</pre><pre class="diff" id="context">       case $'
 	when /['"]/
 	  # plain, 'string'-like see entry
</pre><pre class="diff" id="removed">-	  @data.add_inline(input.text)
</pre><pre class="diff" id="context"> 	when /&lt;/
 	  # HTML entry
</pre><pre class="diff" id="removed">-	  @data.add_inline(input.text)
</pre><pre class="diff" id="context"> 	else
 	  # 'link' entry
</pre><pre class="diff" id="removed">-	  link = create_link(input)
-	  if link.nil?
-	    @data.add_inline(input.text)
-	  else
-	    @data.add_inline(link)
</pre><pre class="diff" id="added">+	  link = create_link(@type_resolver, @data.inlines.first, @lineno)
+	  unless link.nil?
+	    @data.inlines[0] = link
</pre><pre class="diff" id="context"> 	  end
       end
</pre><pre class="diff" id="removed">-    else
-      @data.add_inline(input.text)
-    end
</pre><pre class="diff" id="context">   end
 end
 
</pre><pre class="diff"><small id="info">@@ -405,7 +404,7 @@
</small></pre><pre class="diff" id="context">   end
 
   def add_standard_block_parsers(config)
</pre><pre class="diff" id="removed">-    config.description_handler=build_description_block_parser
</pre><pre class="diff" id="added">+    config.initial_block_handler = build_description_block_parser
</pre><pre class="diff" id="context">     config.add_block_parser("see", build_see_block_parser)
   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>