rbuckton / grammarkdown

Markdown-like DSL for defining grammatical syntax for programming languages.
https://rbuckton.github.io/grammarkdown/
MIT License
126 stars 24 forks source link

grammarkdown emitter does not include blank lines between productions wrapped in `<ins>` #80

Closed bakkot closed 2 years ago

bakkot commented 3 years ago

A simple reproduction:

'use strict';
let { CoreAsyncHost, Grammar, GrammarkdownEmitter } = require('grammarkdown');

let source = `
X ::
  Y

<ins>
X ::
  Y
</ins>

X ::
  Y
`;

(async()=>{
  const grammarHost = CoreAsyncHost.forFile(source);
  const grammar = new Grammar([grammarHost.file], {}, grammarHost);
  await grammar.bind();
  (new GrammarkdownEmitter({})).emit(grammar.rootFiles[0], grammar.resolver, grammar.diagnostics, (file, result) => {
    console.log(result);
  });
})().catch(e => {
  console.error(e);
  process.exit(1);
});

This prints

X ::
    Y

<ins>X ::
    Y
</ins>
X ::
    Y

which seems suboptimal.

bakkot commented 3 years ago

Rather than opening a bunch of new issues, I'll just post some other problems with this emitter here:

(I'm content with my workarounds for this for now, so don't feel there's urgency; I just wanted to make sure it was documented.)

rbuckton commented 2 years ago

#id's aren't printed

Can you clarify what you expect to be printed?

Never mind, I think I understand.

rbuckton commented 2 years ago

Published in grammarkdown@3.2.0