W3C home > Mailing lists > Public > www-archive@w3.org > October 2014

Re: URL Spec rewrite (bug 25946) and galimatias test results

From: Sam Ruby <rubys@intertwingly.net>
Date: Wed, 29 Oct 2014 06:34:17 -0700
Message-ID: <5450ECD9.7090005@intertwingly.net>
To: Valentin Gosu <valentin.gosu@gmail.com>, Anne van Kesteren <annevk@annevk.nl>
CC: "www-archive@w3.org" <www-archive@w3.org>
On 10/29/14 6:09 AM, Valentin Gosu wrote:
> I think the content at http://intertwingly.net/projects/pegurl/url.html
> would represent a nice addition to https://url.spec.whatwg.org/, but
> can't really replace the parsing steps we already have.

Care to explain why?

> It would be great to have a regex/state-machine like visual
> representation of the url bits (very useful when looking for things that
> are not allowed), but the steps to implement the parsing algorithm are
> also necessary if you're writing a new url-parser or simply debugging
> your own.

I'll note that the diagrams are generated from the same source used by 
my proposed reference implementation, and any additional steps necessary 
are defined immediately after the diagrams.

FYI, all the code is available here:

https://github.com/rubys/url

You can build both the spec and the reference implementation using 
'make'.  Note: please read the top of the Makefile for prerequisite 
information.

For those that would rather not build it themselves, you can see this 
code in action here:

http://intertwingly.net/projects/pegurl/liveview.html

View source to see the code.

What may also be of interest is the following source file:

https://github.com/rubys/url/blob/peg.js/url.pegjs

In it, you will find spec text (inside JavaScript comments), actual 
JavaScript that matches the spec text (inside curly braces), and a 
textual representation of the grammar (in Peg.js format).

> So it would be really good if we could have the same simplified visual
> style in the whatwg spec, and keep the parsing steps as a detailed view.

Eliding the details is definitely a possibility.

- Sam Ruby

> On 29 October 2014 10:19, Anne van Kesteren <annevk@annevk.nl
> <mailto:annevk@annevk.nl>> wrote:
>
>     On Sat, Oct 25, 2014 at 2:36 AM, Sam Ruby <rubys@intertwingly.net
>     <mailto:rubys@intertwingly.net>> wrote:
>      > He suggested that I ask you for feedback on the following:
>      >
>      > http://intertwingly.net/projects/pegurl/url.html
>
>     Valentin, could you have a look at this? What is your impression when
>     you compare the above to the URL parsing algorithm from
>     https://url.spec.whatwg.org/? Thanks!
>
>
>     --
>     https://annevankesteren.nl/
>
>
Received on Wednesday, 29 October 2014 13:34:41 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:35:05 UTC