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

Railroad diagrams separate files #1208

Merged

Conversation

bjthehun
Copy link
Contributor

Closes #1187

Allows langium-cli to output railroad diagrams for a given language configuration in single SVG files, that can be used e.g. for language documentation. To use this feature, the railroad part of a configuration now contains the mode setting:

  1. When mode === 'svg', output each grammar rule named Rule into single files with the path out/Rule.svg.
  2. When mode is missing or mode === 'html', output all grammar rules into a single HTML file with the path out, as is the current behavior.

@msujew msujew added cli CLI related issue railroad Syntax diagram relate issue labels Sep 28, 2023
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @bjthehun thank you for your contribution. I have a few comments on the code, please see below.

packages/langium-cli/src/generate.ts Outdated Show resolved Hide resolved
packages/langium-railroad/src/grammar-railroad.ts Outdated Show resolved Hide resolved
packages/langium-railroad/src/grammar-railroad.ts Outdated Show resolved Hide resolved
packages/langium-cli/src/package.ts Show resolved Hide resolved
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me 👍

@msujew msujew merged commit a4c7a58 into eclipse-langium:main Oct 3, 2023
3 checks passed
@msujew msujew added this to the v2.1.0 milestone Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli CLI related issue railroad Syntax diagram relate issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Railroad Diagrams in separate files
2 participants