-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat: semantic syntax highlights for pattern editor. #2214
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
Open
paxcut
wants to merge
54
commits into
WerWolv:master
Choose a base branch
from
paxcut:Syntaxhighlights
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you set a breakpoint the first time you run the pattern it gets hit. After that subsequent runs will fail to hit the breakpoint. fix: pressing F5 (start pattern execution ) while being in a breakpoint hangs ImHex. The first bug was caused by two factors. - When breakpoint hits evaluation stops before the line with the breakpoint is evaluated. In order to avoid hitting the breakpoint again when evaluation is continues the breakpoint needs to be disabled. Once the line is evaluated the breakpoint needs to be enabled again, but the previous code didn't do that. - Detecting if the line was being evaluated used insufficient information to perform said detection. Because of the way AST nodes are assigned coordinates, Nodes that lie in other lines iof source code may and up sharing the same line number as the Nodes in the breakpoint. To tell them apart one must also use columns The reason for hanging ImHex was that the shortcut procedure was not checking if the pattern was already running, and it attempted to start another one. This makes ImHex wait indefinitely for a lock to be released To fix the first issue both problems were resolved. When evaluation of another line occurs the breakpoint is re-enabled. Note that at this point the full evaluation of the line may not have finish yet. This is of no concern as the second problem prevents triggering the breakpoint erroneously. By using the column of the position of the node we ensure that only valid evaluations of the node trigger the breakpoints. To fix the hanging of ImHex we check the runtime for current evaluation and if detected we stop it. In all cases the evaluation is started again.
…hlights # Conflicts: # plugins/builtin/source/content/views/view_pattern_editor.cpp
…ng cases were now broken and some cases that were not previously considered also didn't work. These changes aim mostly at fixing them. Other changes include removing the color line encoding so that instead of writing the color and the length of the token it simply repeats the color the token length times. This helps to keep the char string and the color string synchronized as editing occurs using the line iterators which work on both strings simultaneously. A new editing changes detection system ensures that lines that were colorized and didn't change are not processed for coloring again in the text editor part of the coloring. When the text editor retrieves the colors for the identifiers ot compares it with the previous version and only makes changes if necessary. The old system of changing only a few lines of the colors was broken because changes to syntax color can propagate and require changes more than a few lines away. In order to avoid data races the pattern parsing and coloring wait fpr each other to finish before starting a new instance. A change in the editor raises a text changed event. The fast syntax coloring will occur simultaneously as the editor changes, but the semantic colors need to wait for the parser to finish so that it can use the resulting identifier types detected by the parser as a starting point to colorize the rest. If more editing changes occur while the syntax highlighting code is running the new parsing task is not started until the colorizing is done so as not to corrupt the data that colorizing takes from the parser. Data races still occur so exception guards are in place to handle the ones that arise. Old code that was commented out or not in use was removed. Changes for the parenthesis matching code is NOT included here but those changes do require these changes to be functional.
Also missing was some of the functionality added to master like printing strings with zeros in the console.
…ght I added were missing.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
allows the ability to assign colors to global placed and non-placed variables, pattern, local and calculated pointer variables, template arguments, function variables and arguments, etc etc etc. It accomplishes this using the parser and the token sequence generated by the lexer. It still uses the original colorizing code but the underlying data holding the pattern has been updated to be easier to use and to debug. The changes are too numerous to cite here.It is a big but necessary step to bring the pattern editor to a somewhat useful state. There may be one commit in the pattern language repo needed to be able to run this code