grammarkdown icon indicating copy to clipboard operation
grammarkdown copied to clipboard

Feature request: Extract grammarkdown source from ecmarkup

Open Alhadis opened this issue 3 years ago • 1 comments

I see there's a grammar for ECMAScript 2020. It'd be nice if grammarkdown provided an option for emitting Grammarkdown source from an Ecmarkup file. Something to the effect of:

$ wget https://raw.githubusercontent.com/tc39/ecma262/es2022/spec.html
$ grammarkdown --extract spec.html
@ line 5012 file:///Users/Alhadis/Desktop/spec.html

  StringNumericLiteral :::
    StrWhiteSpace?
    StrWhiteSpace? StrNumericLiteral StrWhiteSpace?

   StrWhiteSpace :::
     StrWhiteSpaceChar StrWhiteSpace?

   StrWhiteSpaceChar :::
     WhiteSpace
     LineTerminator
⋮

Alhadis avatar Oct 26 '22 10:10 Alhadis

grammarkdown only has very minimal support for HTML. This is actually something I'd rather see ecmarkup support itself. It's one of the reasons I added @line directives in the first place, though that was primarily motivated by an ecmarkup VS code extension I was working on a few years ago (but have yet to finish, unfortunately).

rbuckton avatar Jun 17 '23 02:06 rbuckton