Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/langium-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ Schema:
out: string
// Whether to print diagrams all into a single html file or in separate svg files (optional)
mode: 'html' | 'svg'
}
},
// Enable generating a BNF-style grammar file
bnf: {
// Output path to BNF grammar file
out: string
},
// Configure the chevrotain parser for a single language
chevrotainParserConfig: IParserConfig
}[]
Expand Down
1 change: 1 addition & 0 deletions packages/langium-cli/src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ export async function runGenerator(config: LangiumConfig, options: GenerateOptio
commentStyle: languageConfig.bnf.comment
});
const bnfPath = path.resolve(relPath, languageConfig.bnf.out ?? `${grammar.name ?? 'grammar'}.gbnf`);
log('log', options, `Writing BNF grammar to ${chalk.white.bold(bnfPath)}`);
await writeWithFail(bnfPath, genBnf, options);
}
}
Expand Down