Refactor/better parsing#30
Merged
Merged
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
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.
Brace conditionals + block-tree rewrite (v2.0.0.0)
Replaces the old
:if/:else/:endifsigil conditionals with brace blocks and reworks the execution model to match. This is a breaking syntax change (existing aliases are migrated automatically on load), so it bumps to 2.0.0.0.Syntax
if (condition) {…}, withelse {andelse if (condition) {on their own lines (Allman style).else iffor chained conditions (first true branch wins), and a new:returnstatement that halts the whole alias (early exit / guard).:set/:wait/:untilstay as:statements. The rule is now: sigil = single-line statement, braces = block.Architecture
BlockParserparses an alias into a small node tree (LineNode/IfNode/Branch) and returns structuralDiagnostics (unclosed/extra braces, orphanelse, bad conditions) with line numbers.CommandHandler.ExecuteAsyncparses to the tree and walks it recursively instead of the old streamingBlockInterpreterstack. The active-branch bookkeeping is gone (only taken branches are visited);:returnunwinds the recursion.BlockInterpreteris reduced to static line helpers; theIf/Else/EndIfBlockKindcases and the instance stack +Blockclass are removed. Condition parsing is non-throwing throughout (Condition.TryParse).Editor / validation
ValidateBlocksnow delegates toBlockParser, so brace/paren/condition errors surface in the editor.if/else if/else/:return, reds bad conditions and malformed brace heads, and leaves the braces and parens uncolored.MultilineCommandstoggle andCommandEntry.Deletego with it). DalamudTextEdit submodule bumped for Tab / Shift+Tab indent and dedent.Migration (config v2 → v3)
:if X→if (X) {,:else→}+else {,:endif→}, wrapping conditions in parens and re-indenting by nesting depth. A backup is saved first (Silkstring.v2.backup.json). Only touches aliases containing the old sigils; brace aliases are left untouched, so it's safe to re-run.Tests
BlockParserTests(tree shapes + every diagnostic) andConfigMigratorTests(if/else/endif, nested, passthrough).AliasValidatorTestsandBlockInterpreterTestsupdated for the new syntax and trigger checks.Docs
v2.0.0.0, README (conditionals, editor, settings), and the Help window's Conditionals and Editor tabs all updated to the brace syntax.