-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix block comment parsing #9
base: master
Are you sure you want to change the base?
Conversation
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.
PR Summary
This PR addresses issue creditkarma#66 by improving block comment parsing in the Thrift parser, particularly for empty block comments and single-line block comments.
- Rewrote
multilineComment
function insrc/main/scanner.ts
to handle empty comments and improve newline handling - Added new test fixtures (
empty-comments.thrift
,comment-block-empty.txt
,comment-block-line.txt
) to validate parsing of various comment types - Updated parser and scanner test suites in
parser.spec.ts
andscanner.spec.ts
with new test cases for empty and single-line block comments - Introduced
saveSolution
utility function in test files for easier management of solution files
12 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings
"value": [ | ||
"" | ||
], |
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.
style: Empty array for comment value might be inconsistent with other parsers' output
/** | ||
* | ||
*/ | ||
const string test = 'test' |
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.
style: Consider using a more descriptive variable name than 'test'
function saveSolution(fileName: string, obj: any) { | ||
fs.writeFileSync( | ||
path.join(__dirname, `./solutions/${fileName}.solution.json`), | ||
JSON.stringify(obj, null, 4), | ||
'utf-8', | ||
) | ||
} |
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.
style: This function is not used in the current file. Consider removing it if not needed elsewhere, or add a comment explaining its purpose.
}, | ||
{ | ||
"type": "EqualToken", | ||
"text": "", |
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.
style: EqualToken has empty text, consider adding '=' for clarity
Fixes creditkarma#66