Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does ixml have to match the whole input? #24

Closed
cmsmcq opened this issue Jan 11, 2022 · 4 comments
Closed

Does ixml have to match the whole input? #24

cmsmcq opened this issue Jan 11, 2022 · 4 comments

Comments

@cmsmcq
Copy link
Contributor

cmsmcq commented Jan 11, 2022

Is an ixml processor obliged to match the whole input against the specified grammar and flag an error otherwise? Can a conforming processor match a prefix of the input and return success? See

and ensuing threads.

@cmsmcq
Copy link
Contributor Author

cmsmcq commented Feb 7, 2022

It may be helpful, in discussions of this issue, to bear in mind what the spec currently says about it. The last item in the spec's definition of processor conformance reads:

  • The processor must by default parse the input in its entirety against the grammar and return either a parse tree or a failure document. Processors may provide user options for other behaviors, such as parsing the largest, or smallest, prefix of the input that is described by the grammar, or supporting invocation with input streams of indeterminate length.

That suggests to this reader that the question Steven asked when raising this issue already has an answer. He asked:

If a parse succeeds without using all the available input, should that be reported as a parse error, or as an ixml:state="incomplete" (or something similar).

According to the current spec, I think the answer is:

  1. The processor may provide a user option for handling cases of success over part of the input as a parse with ixml:state="incomplete" or something similar.
  2. The processor need not do so.
  3. Unless the processor has provided and the user activated such a user option, the parser should report a parsing failure.

Given that as the status quo, I suppose Steven's question (and thus this issue) should be read as a suggestion that we change some aspect of these rules, but without a specific proposal for what to change. None of the changes I have been able to imagine seem to me an improvement on the status quo, but I may be persuadable.

@spemberton
Copy link
Member

My question was indeed a suggestion.

My proposal is to add a distinguishing "fail" state, for instance "incomplete" or "prefix" that indicates that while the input was not fully consumed, there was a prefix of the input that satisfied the grammar (and here is the tree for that input).

So "fail" gets split into two:
fail: no parse
incomplete: a prefix of the input succeeded.

@cmsmcq
Copy link
Contributor Author

cmsmcq commented Feb 14, 2022

This issue was discussed on the call of 8 February. The upshot was that it should continue to be legal for processors to offer a user option to report matches against a prefix of the input string, and that it should continue not to be required. The marking ixml:status="prefix" (or possibly some other keyword value, tbd) should be defined for use in this situation.

spemberton added a commit that referenced this issue Feb 22, 2022
This involved the proposed text and discussion at https://www.w3.org/2022/02/15-ixml-minutes.html#t04 
It also adds proposed text for @ handling on the root node.
@spemberton
Copy link
Member

New adopted text added to the spec, and issue closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants