-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parser cleanup and preparation for improved testing setup #3027
Conversation
These were no different than the generic parser so removing to reduce duplication
These were removed by mistake at some point and this commit reverts that
You can safely ignore the jison files, they're just moved around. Main changes are in tools/jison |
bdc0956
to
4df560d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work,
just a questions and a request for additional clarification for stuff like
.replace(
'loc: yyloc,',
"loc: lexer.yylloc, ruleId: stack.slice(stack.length - 2, stack.length).join(''),"
)
that is hard to grasp for parser mortals.
tools/jison/utils.js
Outdated
|
||
import fs from 'fs'; | ||
|
||
export const listDir = async folder => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the promise versions of fs.readFile, fs.readdir and fs.writeFile instead of creating your own async wrappers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I just copied the functions we had before, I'll switch to the promise versions.
sqlParser: autocomplete ? 'AUTOCOMPLETE' : 'SYNTAX', | ||
parserName, | ||
outputFolder, | ||
afterParse: async contents => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some comments to explain why and what we are replacing here? Or split this up into functions with descriptive names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! Makes sense, I'll add some details.
True. In this particular case it's patching of jison which is sadly not maintained anymore (zaach/jison#356). I'll review and add some additional comments. |
…cture - Improve the readability of the generator tool, switch to async/await and a major cleanup - Move jison files to a subfolder next to the parser being generated, making it easier to develop a parser when it's all in one place. - Remove broken and unused new parser bootstrap tool - Remove generation of dynamic imports (sqlParserRepository.ts), as it's not always the case that the generated file will be the actual parser to use moving forward
In some cases the generated parsers were out of sync with their jison definitions, likely caused by not generating after jison version bump. For Hive, Impala and the generic parsers the only change is the introduction of jsdoc on the parse function.
4df560d
to
3c26e17
Compare
…ion and structure (#3027) - Improve the readability of the generator tool, switch to async/await and a major cleanup - Move jison files to a subfolder next to the parser being generated, making it easier to develop a parser when it's all in one place. - Remove broken and unused new parser bootstrap tool - Remove generation of dynamic imports (sqlParserRepository.ts), as it's not always the case that the generated file will be the actual parser to use moving forward (cherry picked from commit ba3ae3a) (cherry picked from commit cc3fa3e) Change-Id: I630c69f0eef5e958de0034b182e95021ddb8bbb8 (cherry picked from commit 16787e3)
In some cases the generated parsers were out of sync with their jison definitions, likely caused by not generating after jison version bump. For Hive, Impala and the generic parsers the only change is the introduction of jsdoc on the parse function. (cherry picked from commit dbc7631) (cherry picked from commit 7716ce0) Change-Id: I7fb6831757377c2ac784ad1c0205f3cdf39400c4 (cherry picked from commit e5c4723)
…ion and structure (#3027) - Improve the readability of the generator tool, switch to async/await and a major cleanup - Move jison files to a subfolder next to the parser being generated, making it easier to develop a parser when it's all in one place. - Remove broken and unused new parser bootstrap tool - Remove generation of dynamic imports (sqlParserRepository.ts), as it's not always the case that the generated file will be the actual parser to use moving forward (cherry picked from commit ba3ae3a) (cherry picked from commit cc3fa3e) Change-Id: I630c69f0eef5e958de0034b182e95021ddb8bbb8
In some cases the generated parsers were out of sync with their jison definitions, likely caused by not generating after jison version bump. For Hive, Impala and the generic parsers the only change is the introduction of jsdoc on the parse function. (cherry picked from commit dbc7631) (cherry picked from commit 7716ce0) Change-Id: I7fb6831757377c2ac784ad1c0205f3cdf39400c4
This change contains the following improvements:
The main goal of this was to move the jison definitions to a subfolder next to the generated parser but while doing so I also decided that the parser generator needed some improvemnts. Having the jison next to the generated files helps with development and it will also enable us to reduce testing duplication (changes in an upcoming PR).
Tested by: