Skip to content

Allow namespace star - #8

Open
lizard-boy wants to merge 1 commit into
masterfrom
allow-namespace-star
Open

Allow namespace star#8
lizard-boy wants to merge 1 commit into
masterfrom
allow-namespace-star

Conversation

@lizard-boy

Copy link
Copy Markdown

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

Closes creditkarma#65

@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 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

Comment thread src/main/parser.ts
return null
}

// NamespaceScope → '*' | Identifier

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 adding a comment explaining the purpose of this function

Comment thread src/main/parser.ts
Comment on lines +401 to +405
if (currentToken().type === SyntaxType.StarToken) {
const loc = currentToken().loc
advance()
return createNamespaceScope('*', loc)
}

Copy link
Copy Markdown

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

Comment thread src/main/parser.ts
`Unable to find scope identifier for namespace`,
)

const scope: NamespaceScope = parseNamespaceScope()

Copy link
Copy Markdown

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