Skip to content

Commit

Permalink
fix: #351 antlr4 command optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxy0551 authored and LuckyFBB committed Jan 8, 2025
1 parent 74be81c commit 74d6435
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/antlr4.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ const { cleanComment } = require('./cleanComment');
const grammarsPath = path.resolve(__dirname, '../src/grammar');
const outputPath = path.resolve(__dirname, '../src/lib');

const languageEntries = fs.readdirSync(grammarsPath);
const languageEntries = fs.readdirSync(grammarsPath).filter((language) => {
return fs.statSync(path.join(grammarsPath, language)).isDirectory();
});

const baseCmd = 'antlr4ng -Dlanguage=TypeScript -visitor -listener -Xexact-output-dir -o';

Expand Down Expand Up @@ -65,7 +67,7 @@ function main() {
languageEntries.forEach((language) => {
compile(language);
});
} else if (argv.lang) {
} else if (argv.lang && typeof argv.lang === 'string') {
// compile single: yarn antlr4 --lang=mysql
const supportedLanguage = languageEntries.find((language) =>
language.startsWith(argv.lang)
Expand Down

0 comments on commit 74d6435

Please sign in to comment.