Skip to content

Fix block comment parsing - #9

Open
lizard-boy wants to merge 1 commit into
masterfrom
fix-empty-block-comments
Open

Fix block comment parsing#9
lizard-boy wants to merge 1 commit into
masterfrom
fix-empty-block-comments

Conversation

@lizard-boy

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

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 in src/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 and scanner.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

Comment on lines +72 to +74
"value": [
""
],

Copy link
Copy Markdown

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'

Copy link
Copy Markdown

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'

Comment on lines +23 to +29
function saveSolution(fileName: string, obj: any) {
fs.writeFileSync(
path.join(__dirname, `./solutions/${fileName}.solution.json`),
JSON.stringify(obj, null, 4),
'utf-8',
)
}

Copy link
Copy Markdown

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": "",

Copy link
Copy Markdown

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

empty BlockComment breaks parser

1 participant