<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -2,18 +2,20 @@ module YARD
   class Docstring &lt; String
     attr_reader :ref_tags
     attr_accessor :object, :line_range, :all
+
+    META_MATCH = /^@([a-z_]+)(?:\s+(.*))?$/i
     
     def initialize(content = '', object = nil)
       @tag_factory = Tags::Library.new
-      @tags, @ref_tags = [], []
       @object = object
       
       self.all = content
     end
     
     def replace(content)
-      super parse_comments(content)
+      @tags, @ref_tags = [], []
       @all = content
+      super parse_comments(content)
     end
     alias all= replace
     
@@ -138,7 +140,6 @@ module YARD
     def parse_comments(comments)
       comments = comments.split(/\r?\n/) if comments.is_a?(String)
       return '' if !comments || comments.empty?
-      meta_match = /^@(\S+)\s*(.*)/
       docstring = &quot;&quot;
 
       indent, last_indent = comments.first[/^\s*/].length, 0
@@ -152,16 +153,16 @@ module YARD
         done = comments.size == index
 
         if tag_name &amp;&amp; (((indent &lt; orig_indent &amp;&amp; !empty) || done) || 
-            (indent &lt;= last_indent &amp;&amp; line =~ meta_match))
+            (indent &lt;= last_indent &amp;&amp; line =~ META_MATCH))
           create_tag(tag_name, tag_buf, raw_buf)
           tag_name, tag_buf, raw_buf = nil, '', []
           orig_indent = 0
         end
 
         # Found a meta tag
-        if line =~ meta_match
+        if line =~ META_MATCH
           orig_indent = indent
-          tag_name, tag_buf = $1, $2 
+          tag_name, tag_buf = $1, ($2 || '')
           raw_buf = [tag_buf.dup]
         elsif tag_name &amp;&amp; indent &gt;= orig_indent &amp;&amp; !empty
           # Extra data added to the tag on the next line</diff>
      <filename>lib/yard/docstring.rb</filename>
    </modified>
    <modified>
      <diff>@@ -64,6 +64,26 @@ describe YARD::Docstring do
     eof
     doc.summary.should == &quot;Returns a list of tags specified by +name+ or all tags if +name+ is not specified.&quot;
   end
+
+  it &quot;should only parse tags with charset [A-Za-z_]&quot; do
+    doc = Docstring.new
+    valid = %w( @testing @valid @is_a @is_A @__ )
+    invalid = %w( @ @return@ @param, @x.y @x-y )
+
+    log.enter_level(Logger::FATAL) do
+      {valid =&gt; 1, invalid =&gt; 0}.each do |tags, size|
+        tags.each do |tag|
+          class &lt;&lt; doc
+            def create_tag(tag_name, *args)
+              add_tag Tags::Tag.new(tag_name, *args)
+            end
+          end
+          doc.all = tag
+          doc.tags(tag[1..-1]).size.should == size
+        end
+      end
+    end
+  end
   
   it &quot;should parse reference tag into ref_tags&quot; do
     doc = Docstring.new(&quot;@return (see Foo#bar)&quot;)</diff>
      <filename>spec/docstring_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f6432b8c2f284bbac4ece5ee1b16adf68cf60be9</id>
    </parent>
  </parents>
  <author>
    <name>Loren Segal</name>
    <email>lsegal@soen.ca</email>
  </author>
  <url>http://github.com/lsegal/yard/commit/517754f4882256e91facc106f668410406fa688f</url>
  <id>517754f4882256e91facc106f668410406fa688f</id>
  <committed-date>2009-07-04T12:50:43-07:00</committed-date>
  <authored-date>2009-07-04T12:50:43-07:00</authored-date>
  <message>Only parse @tags that match the correct charset ([A-Za-z_])</message>
  <tree>3b9e66b94a812227f1db34062cd9a27217a6c311</tree>
  <committer>
    <name>Loren Segal</name>
    <email>lsegal@soen.ca</email>
  </committer>
</commit>
