-
Notifications
You must be signed in to change notification settings - Fork 19
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
refactor: Use DSL v2 types in place of ScannerDefinitionNode #1003
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left one suggestion. But I think @AntonyBlakey would be a better reviewer for the main changes here.
cf6a6f5
to
583d04e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not clear about the separation between Keyword and Scanner - one is a verb and one a noun, but I don't know if that is true about their roles? This split happened after I left the codebase, so it's my responsibility I know to work it out, but TBH the naming is becoming less self-describing and more an in-group code/shorthand.
crates/codegen/runtime/generator/src/parser/codegen/keyword_scanner_definition.rs
Show resolved
Hide resolved
crates/codegen/runtime/generator/src/parser/codegen/keyword_scanner_definition.rs
Outdated
Show resolved
Hide resolved
crates/codegen/runtime/generator/src/parser/codegen/scanner_definition.rs
Show resolved
Hide resolved
crates/codegen/runtime/generator/src/parser/codegen/scanner_definition.rs
Outdated
Show resolved
Hide resolved
crates/codegen/runtime/generator/src/parser/codegen/scanner_definition.rs
Show resolved
Hide resolved
@AntonyBlakey I've changed some names, let me know if that's okay now 🙏 |
Not 100% happy with the naming in this section of our codebase, but this PR is not the place for that more general argument, so I am approving this now. |
Based on #1002
Part of #638
The DSL v2's
model::Scanner
is almost 1:1 usable with our current parser codegen, with the exception of versioned scanners. In short we:VersionedScanner
that is used in place of the oldScannerDefinitionNode::Versioned
ScannerExt
trait implemented for bothVersionedScanner
and themodel::Scanner
, which is responsible for generating the main scanning logicScannerDefinition
slightly to surface more of the scanner-related logic for trivia/fragment/tokenmodel::{TriviaItem,FragmentItem,TokenItem}
and stores it in the v1 Grammar structmodel::KeywordItem
directly in place of v1'sKeywordScannerDefinition
as they shared the same functionality