-
Notifications
You must be signed in to change notification settings - Fork 105
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
SourceSpan interference #151
Comments
Sorry, I misunderstood. |
If so, then another similar issue #132 |
Your conclusion looks right to me. Please don't fix this yet, I have students who're dispatched to fix this issue :) |
Alright, here're some thoughts. As usual, this task is much harder that I initially thought. Let me explain. The root cause of the issue is that our formula parser isn't hygienic enough for the predefined formulae. Consider how we parse any simple thing like
@dedok1997 tried to fix the issue in #227 by performing some maneuveres around the atom sources in this particular call, Also, post-parse atom fixup from #227 requires us to make the atoms' sources mutable. This is a big issue: earlier, we had problems because some code (AFAIK the same troublesome There's this interesting comment in the
It looks like the issue is much bigger I even thought when I was writing this comment :) (But we'll fix #132 here, too.) Expected parser behaviorFirst of all, let's state the behavior expected from our parser in cases when it encounters a predefined formula. I believe that, for these cases, it should return an atom that has a How to achieve thatTo me it is now obvious that we should create a special parser mode, hygienic parsing, when it saves no source information at all. Only the hygienic parsers should be used when parsing any of the predefined formula stuff, and the root source for the resulting atom should be forcibly set to the one we want to use. The situation is slightly complicated by the fact that our parsing itself sometimes may rely on proper There's another big issue: how to set the The new hygienic parsing mode will probably require some architectural solution to make sure we're not leaking any source information: e.g. we could pass a |
The Plan(Thanks to @gsomix for a productive discussion.) After thinking about that more, I think I've found the solution which is good (i.e. non-duggy), follows the modern practices regarding text editor implementation and won't require us to write much code. I think that it's okay to include source information from additional text sources (e.g. macro text or predefined formula or whatever): we just need to mark these sources accordingly!
|
Currently if you try to select a predefined function like sin (\sin) in the example project's Textbox, it doesn't get selected. It can only get selected when you place at least 8 characters before it (which is equal to the number of characters of the functions' actual leading characters, which in this case is "\mathrm{\sin}". After that you have to select the characters that precede the function. Try this after clearing the textbox's content "TRYTHISFxn\cos^2(\theta) + \sin^2(\theta)=1".
Here the cos and sin seem to be bound together.
The text was updated successfully, but these errors were encountered: