Fix block comment parsing - #9
Conversation
There was a problem hiding this comment.
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
multilineCommentfunction insrc/main/scanner.tsto 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.tsandscanner.spec.tswith new test cases for empty and single-line block comments - Introduced
saveSolutionutility 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.
style: Empty array for comment value might be inconsistent with other parsers' output
| /** | ||
| * | ||
| */ | ||
| const string test = 'test' |
There was a problem hiding this comment.
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.
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.
style: EqualToken has empty text, consider adding '=' for clarity
Fixes creditkarma#66