From: Chris Alfeld Date: 2006-03-31T11:01:28+09:00 Subject: rdoc patch - multiline constants ------=_Part_7866_2882727.1143770485710 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, The following patch corrects RDoc's handling of multiline constants.=20 The following are now correctly parsed: ---- A =3D [ 1, 2, 3 ] B =3D { 1 =3D> 'foo', 2 =3D> 'bar' } C =3D proc do |x| x+1 end ---- A couple questions: 1. Is there any body of ``standard'' tests for rdoc? 2. This patch does not solve any bug report. Should I submit a bug report= ? The patch is a unified diff to lib/rdoc/parsers/parse_rb.rb against the latest CVS version (1.42). I understand you are all busy but I would appreciate an acknowledge of this and my previous patch. Just a note to let me know someone who can approve them into the CVS tree has seen them and will process them. Thanks, c. --- parse_rb.rb=092006-03-30 19:55:09.000000000 -0600 +++ parse_rb.new=092006-03-30 19:53:19.000000000 -0600 @@ -1845,9 +1845,9 @@ case tk when TkSEMICOLON break - when TkLPAREN, TkfLPAREN + when TkLPAREN, TkfLPAREN, TkLBRACE, TkLBRACK, TkDO nest +=3D 1 - when TkRPAREN + when TkRPAREN, TkRBRACE, TkRBRACK, TkEND nest -=3D 1 when TkCOMMENT if nest <=3D 0 && @scanner.lex_state =3D=3D EXPR_END @@ -1855,7 +1855,8 @@ break end when TkNL - if (@scanner.lex_state =3D=3D EXPR_END and nest <=3D 0) || !@scanner.continue +# if (@scanner.lex_state =3D=3D EXPR_END and nest <=3D 0) || !@scanner.continue + if (nest <=3D 0) && ((@scanner.lex_state =3D=3D EXPR_END) || (!@scanner.continue)) unget_tk(tk) break end ------=_Part_7866_2882727.1143770485710 Content-Type: application/octet-stream; name=rdoc_multiline_comments.udiff Content-Transfer-Encoding: 7bit X-Attachment-Id: f_lndycw Content-Disposition: attachment; filename="rdoc_multiline_comments.udiff" --- parse_rb.rb 2006-03-30 19:55:09.000000000 -0600 +++ parse_rb.new 2006-03-30 19:53:19.000000000 -0600 @@ -1845,9 +1845,9 @@ case tk when TkSEMICOLON break - when TkLPAREN, TkfLPAREN + when TkLPAREN, TkfLPAREN, TkLBRACE, TkLBRACK, TkDO nest += 1 - when TkRPAREN + when TkRPAREN, TkRBRACE, TkRBRACK, TkEND nest -= 1 when TkCOMMENT if nest <= 0 && @scanner.lex_state == EXPR_END @@ -1855,7 +1855,8 @@ break end when TkNL - if (@scanner.lex_state == EXPR_END and nest <= 0) || !@scanner.continue +# if (@scanner.lex_state == EXPR_END and nest <= 0) || !@scanner.continue + if (nest <= 0) && ((@scanner.lex_state == EXPR_END) || (!@scanner.continue)) unget_tk(tk) break end ------=_Part_7866_2882727.1143770485710--