Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

lizard-boy
Copy link

Copy link

@greptile-apps greptile-apps bot left a 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 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

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

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

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

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