On Tue, 24 Jan 2006, Lachlan Hunt wrote:
> 
> As for how to parse it, I'll use these test cases to demonstrate what I 
> consider to be the most sane way to handle comments.  (Assume EOF at the 
> end of each one)
> 
> Test Case                          | Comment Content          | Output
> -----------------------------------|--------------------------|--------------
> PA<!>SS                            | ""                       | PASS
> PA<! ->SS                          | " -"                     | PASS
> PA<! -->SS                         | " "                      | PASS
> PA<!->SS                           | "-"                      | PASS
> PA<!- ->SS                         | "- -"                    | PASS
> PA<!- ->SS -->                     | "- -"                    | PASS -->

Agreed.


> PA<!- <!-->SS -->                  | "- <!"                   | PASS -->

Comment should be "- <!--" IMHO. It's still a bogus comment (in HTML5 
nomenclature), the "--" part is irrelevant.


> PA<!- <!-- ->SS -->                | "- <!-- -"               | PASS -->

Agreed.


> PA<!- -->SS                        | "- "                     | PASS
> PA<!- -- >SS                       | "- "                     | PASS

These are bogus comments, so again, they should be "- --" and "- -- " 
respectively, IMHO.


> PA<!-- FAIL -->SS                  | " FAIL "                 | PASS
> PA<!--> FAIL -->SS                 | "> FAIL "                | PASS
> PA<!--> FAIL <!-- -->SS            | "> FAIL <!-- "           | PASS
> PA<!--> FAIL <!-- -- -->SS         | "> FAIL <!-- -- "        | PASS

Agreed.


> PA<!-- > FAIL -- >SS               | " > FAIL "               | PASS

Disagree. The terminator should be "-->", not "-- S* >". I don't see any 
good reason to have "-- S* >".


> P<!-- -- >AS<!-- -->S              | " " (2 comments)         | PASS

Disagree (same reason). " -- >AS<!-- " is the comment, output is PS.


> PA<!-- FAIL -- FAIL -->SS          | " FAIL -- FAIL "         | PASS
> P<!-- -- -->AS<!-- -- -->S         | " -- " (2 comments)      | PASS
> PA<!-- -- -- -->SS                 | " -- -- "                | PASS
> PA<!-- FAIL -- FAIL -- FAIL -->SS  | " FAIL -- FAIL -- FAIL " | PASS
> PA<!--- FAIL -->SS                 | "- FAIL "                | PASS
> PA<!--- FAIL --->SS                | "- FAIL -"               | PASS
> <!-- ->FAIL                        | " ->FAIL"                |
> <!--- ->FAIL                       | "- ->FAIL"               |
> PA<!--->-->SS                      | "->"                     | PASS

Agreed.


> <!-- --- ->                        | (not sure)               |

Comment text is " --- ->".


> PA<!-- --- -->SS                   | " --- "                  | PASS
> PA<!--- --- --->SS                 | "- --- -"                | PASS

Agreed.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Reply via email to