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

Allow namespace star #8

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

Allow namespace star #8

wants to merge 1 commit into from

Conversation

lizard-boy
Copy link

** This is a breaking change, it changes the format of the AST **

Closes creditkarma#65

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 introduces a breaking change to the AST format, allowing the use of '*' as a namespace scope in Thrift files.

  • Modified parseNamespaceScope in src/main/parser.ts to handle '*' and identifier tokens
  • Added createNamespaceScope function in src/main/factory.ts for creating NamespaceScope objects
  • Updated src/main/scanner.ts to recognize '*' as a StarToken
  • Introduced NamespaceScope interface in src/main/types.ts, replacing Identifier for namespace scopes
  • Updated test fixtures and solutions in src/tests/parser/ to reflect the new AST structure

6 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings

@@ -394,18 +396,32 @@ export function createParser(
return null
}

// NamespaceScope → '*' | Identifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider adding a comment explaining the purpose of this function

Comment on lines +401 to +405
if (currentToken().type === SyntaxType.StarToken) {
const loc = currentToken().loc
advance()
return createNamespaceScope('*', loc)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Check for SyntaxType.StarToken before consuming

`Unable to find scope identifier for namespace`,
)

const scope: NamespaceScope = parseNamespaceScope()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Add error handling for invalid namespace scopes

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.

Support using namespace *
1 participant