[whatwg] adoption agency parse errors

Ian Hickson ian at hixie.ch
Mon Jun 18 20:30:27 PDT 2007


On Sun, 14 Jan 2007, Anne van Kesteren wrote:
>
> Is it correct that:
> 
>  <!doctype html><i><p><b></i>
> 
> throws exactly two parse errors because of step 1, paragraph 3 of the 
> adoption agency algorithm. (Since you need to iterate two times through 
> it the </i> will hit there twice.) Some of the submitted testcases from 
> Google to html5lib assume a single error.

My parser explicitly avoided reporting that particular error more than 
once per invokation of the AAA. Exactly how many parse errors are reported 
is up to the implementation, so long as it fits this criteria:

# Conformance checkers must report at least one parse error condition to 
# the user if one or more parse error conditions exist in the document and 
# must not report parse error conditions if none exist in the document. 
# Conformance checkers may report more than one parse error condition if 
# more than one parse error conditions exist in the document. Conformance 
# checkers are not required to recover from parse errors.

Generally speaking, from a UI point of view, you want to only report one 
error per correction that the user has to make. For example, if the user 
omitted a quote mark in a string in a script and that caused the string's 
contents to be treated as code, you'd ideally just want the compiler to 
say "missing quote mark", not start listing all the contents of the string 
and say how each part in turn isn't valid script. Sadly, this is often 
quite difficult to achieve!

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



More information about the whatwg mailing list