lava-oushudb-dt-sql-parser/build/antlr4.js

32 lines
751 B
JavaScript
Raw Normal View History

2020-08-28 13:29:47 +08:00
const path = require('path');
const exec = require('child_process').exec;
const grammars = path.resolve(__dirname, '../src/grammar');
const languages = [
'generic',
'mysql',
// 'oracle',
// 'flink',
// 'hive',
// 'impala',
// 'libra',
// 'spark',
// 'tidb'
];
languages.forEach(language => {
exec(`npx antlr4-tool -l ts -o ${grammars}/${language}/parser ${grammars}/${language}/*.g4`, (error) => {
console.log('error:', error)
})
// const compiledResults = antlr4Tool.compile({
// language: 'ts', // Only support for JavaScript & TypeScript
// grammarFiles: [`${grammars}/${language}/*.g4`],
// outputDirectory: `${grammars}/${language}/parser`
// });
})