-
Notifications
You must be signed in to change notification settings - Fork 233
Origin: internally expose possible input #3911
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
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.
LGTM to favor the options from the potential Input (the same should probably be done in textAsInput), but I question the implicit captures as a fallback (I guess that the intent?) to get options if we can't find the Input.
|
||
private[meta] def retokenizeFor( | ||
dialect: Dialect | ||
)(implicit tokenize: Tokenize, tokenizerOptions: Option[TokenizerOptions]): Tokens = this match { |
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.
)(implicit tokenize: Tokenize, tokenizerOptions: Option[TokenizerOptions]): Tokens = this match { | |
)(implicit tokenize: Tokenize): Tokens = this match { |
|
||
private[meta] def retokenize(implicit | ||
tokenize: Tokenize, | ||
dialect: Dialect, | ||
tokenizerOptions: Option[TokenizerOptions] |
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.
tokenizerOptions: Option[TokenizerOptions] |
case Lit.String(value) => | ||
val input = Input.VirtualFile("<InternalTrees.tokens>", value) | ||
Tokens(Array(Constant.String(input, dialect, 0, value.length, value))) | ||
case _ => implicitly[Tokenize].apply(textAsInput, dialect).get | ||
case _ => tokenize(origin.inputOpt.getOrElse(textAsInput), dialect).get | ||
} | ||
|
||
private[meta] def textAsInput(implicit |
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.
not visible in the diff, but another implicit Option[TokenizerOptions]
is captured - it's probably more correct to get it from the input just like above?
In InternalTree, use it to tokenize, before resorting to syntax parsing. Also, if that Input contained any TokenizerOptions, they would naturally be used.
In InternalTree, use it to tokenize, before resorting to syntax parsing. Also, if that Input contained any TokenizerOptions, they would naturally be used. Follow-on to #3786.