mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-08 16:49:38 +02:00
Adding common parser for headerMode
This commit is contained in:
@@ -141,12 +141,19 @@ function generateAntlrFiles(grammar: GrammarInfo): void {
|
||||
cleanGeneratedDir(outputDir);
|
||||
ensureGeneratedDir(outputDir);
|
||||
|
||||
// Determine common header lib path for imported grammars
|
||||
const cwd = process.cwd();
|
||||
const commonLibPath = cwd.endsWith('/packages/mermaid')
|
||||
? 'src/diagrams/common/parser/antlr'
|
||||
: 'packages/mermaid/src/diagrams/common/parser/antlr';
|
||||
|
||||
// Generate ANTLR files
|
||||
const command = [
|
||||
'antlr-ng',
|
||||
'-Dlanguage=TypeScript',
|
||||
'-l',
|
||||
'-v',
|
||||
`--lib "${commonLibPath}"`,
|
||||
`-o "${outputDir}"`,
|
||||
`"${lexerFile}"`,
|
||||
`"${parserFile}"`,
|
||||
|
Reference in New Issue
Block a user