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

Pragmas #6

Closed
Leont opened this issue Jan 13, 2015 · 14 comments
Closed

Pragmas #6

Leont opened this issue Jan 13, 2015 · 14 comments
Labels

Comments

@Leont
Copy link

Leont commented Jan 13, 2015

Perl 5's TAP parser contains a mechanism called pragmas in its TAP13 mode. This basically means that the stream can subtly change some aspects of how it is parsed. The only supported pragma is strict, which causes any unknown lines to be parse errors.

This may be a useful mechanism to standardize.

@Leont Leont changed the title Pragmas? Pragmas Jan 13, 2015
@jonathanKingston
Copy link
Member

+1 definitely this is worth having.

I would like to have another that causes the parser to trigger a fatal exception on first error also. Combined with strict this would stop parsing after the first unknown character.

@kinow
Copy link
Member

kinow commented Jan 13, 2015

I didn't know it existed :D my +1

@Leont
Copy link
Author

Leont commented Jan 14, 2015

I didn't know it existed :D my +1

I haven't seen anything actually use it and it's not documented either: it's barely existent really.

@jonathanKingston
Copy link
Member

I think this mostly answers #4 which is a benefit actually.

@Leont
Copy link
Author

Leont commented Jan 14, 2015

The format currently used seems to be

pragma +strict, -somethingelse

Which is sensible enough to me.

@Leont
Copy link
Author

Leont commented Jan 14, 2015

I think this mostly answers #4 which is a benefit actually.

Yeah, I was about to say just that in that ticket.

@jonathanKingston
Copy link
Member

@Leont @kinow please consider all new additional parse hints as a pragma and mark the tickets accordingly. (We can run with this name I think as there is no opposition and is in current use already)

@jonathanKingston
Copy link
Member

It does however strike me as something that the caller of the c would like to enable over it coming out of the TAP itself - I think we should account for this in that the caller and consumers can override.

Also mentioned in #4 is how the call order happens, should the pragma only be at the top of the document or are these flags able to be used like this:

...
ok 12 - reason
pragma +strict
ok 13 - important test
ok 14 - something
pragma -strict
ok 15 - less important

I would prefer that the pragmas are resolved before the parsing happens for ease of use however I think the question is worth resolving now.

@beatgammit
Copy link

I would prefer that the pragmas are resolved before the parsing happens for ease of use however I think the question is worth resolving now.

I agree. It's easier to allow it later if there's ever a need.

@jonathanKingston
Copy link
Member

@beatgammit I'm not sure it it would be easy to add it in later without breaking a lot of consumers. I am however fairly certain it is hard to see a use for it.

@beatgammit
Copy link

I guess I was more thinking of processing old output, not generating new output. But you're right, it would be easier to go the otherway (allow it everywhere, later restrict it).

@jonathanKingston
Copy link
Member

@Leont so if I am right unknown lines streamed through the TAP parser with the strict parser get converted into errors? Sorry I'm not seeing the functionality immediately from the code itself.

@isaacs
Copy link
Contributor

isaacs commented Mar 4, 2022

#25

@isaacs isaacs closed this as completed Mar 4, 2022
@isaacs
Copy link
Contributor

isaacs commented Mar 4, 2022

node-tap only supports strict at present as well, but I intend to add bail simply because it's the other flag the parser responds to.

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

No branches or pull requests

5 participants