Skip to content

Commit

Permalink
Generate a type alias for the terminal names
Browse files Browse the repository at this point in the history
  • Loading branch information
aabounegm committed Jul 24, 2024
1 parent c6e0513 commit 573f0b9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/langium-cli/src/generator/ast-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ function generateTerminalConstants(grammars: Grammar[], config: LangiumConfig):
export const ${config.projectName}Terminals = {
${joinToNode(Object.entries(collection), ([name, regexp]) => `${name}: ${regexp.toString()},`, { appendNewLineIfNotEmpty: true })}
};
export type ${config.projectName}TerminalNames = keyof typeof ${config.projectName}Terminals;
`.appendNewLine();
}

0 comments on commit 573f0b9

Please sign in to comment.