Ghidra is a software reverse engineering (SRE) framework
GP-2090 - Decompiler - Added actions to allow users to navigate braces by using the keyboard.
dragonmacher951f34a00741
diff --git a/Ghidra/Features/Decompiler/src/main/doc/decompileplugin.xml b/Ghidra/Features/Decompiler/src/main/doc/decompileplugin.xmlindex f2529f9e2e..b1c40a8fa0 100644--- a/Ghidra/Features/Decompiler/src/main/doc/decompileplugin.xml+++ b/Ghidra/Features/Decompiler/src/main/doc/decompileplugin.xml@@ -3981,7 +3981,8 @@<listitem><para>Double-clicking a '{' or '}' token, causes the window to navigate to the <emphasis>matching</emphasis> bracewithin the window. The cursor is set and the window view is adjusted if- necessary to ensure that the matching brace is visible.+ necessary to ensure that the matching brace is visible. Braces may also be navigated via+ the keyboard.</para></listitem></varlistentry></variablelist>@@ -4321,6 +4322,19 @@</para></sect2>+<sect2 id="GoToBrace">+ <title>Go To Next/Previous Brace</title>+ <para>+ These actions are available from the keyboard.+ <emphasis role="bold">Shift-Open Bracket</emphasis> will go to the previous enclosing+ open brace. <emphasis role="bold">Shift-Close Bracket</emphasis> will go to the+ next enclosing closing brace. These key bindings can be changes via the tool options.+ </para>+ <para>+ Paired braces can also be navigated by double-clicking.+ </para>+</sect2>+<sect2 id="ActionHighlight"><title>Highlight</title><para>diff --git a/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerWindow.html b/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerWindow.htmlindex c45a94b81c..47663e62c1 100644--- a/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerWindow.html+++ b/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerWindow.html@@ -451,7 +451,12 @@Double-clicking a '{' or '}' token, causes the window to navigate to the <span class="emphasis"><em>matching</em></span> bracewithin the window. The cursor is set and the window view is adjusted ifnecessary to ensure that the matching brace is visible.- </p></dd>+ </p>+ <p>+ Braces may also be navigated+ <a class="xref" href="DecompilerWindow.html#GoToBrace" title="Go To Brace">via the keyboard</a>.+ </p>+ </dd></dl></div></div><p>@@ -807,6 +812,24 @@</p></div>+++<div class="sect2">+<div class="titlepage"><div><div><h3 class="title">+<a name="GoToBrace"></a>Go To Next/Previous Brace</h3></div></div></div>++ <p>+ These actions are available from the keyboard.+ <span class="bold"><strong>Shift-Open Bracket</strong></span> will go to the previous enclosing+ open brace. <span class="bold"><strong>Shift-Close Bracket</strong></span> will go to the+ next enclosing closing brace. These key bindings can be changes via the tool options.+ </p>+ <p>+ Paired braces can also be navigated by double-clicking.+ </p>+</div>++<div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="ActionHighlight"></a>Highlight</h3></div></div></div>diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerPanel.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerPanel.javaindex b2d4b81490..83575b4733 100644--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerPanel.java+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerPanel.java@@ -564,7 +564,7 @@ public class DecompilerPanel extends JPanel implements FieldMouseListener, Field}}- private void goToToken(ClangToken token) {+ public void goToToken(ClangToken token) {ClangLine line = token.getLineParent();diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerUtils.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerUtils.javaindex 3279a998fe..44f2dcea4d 100644--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerUtils.java+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerUtils.java@@ -560,6 +560,73 @@ public class DecompilerUtils {return null;}+ /**+ * Starts at the given token and finds the next enclosing brace, depending on the given+ * direction. If going forward, the next unpaired closing brace will be returned; if going+ * backward, the next enclosing open brace will be found. If no enclosing braces exist,+ * then null is returned.+ *+ * @param startToken the starting token+ * @param forward true for forward; false for backward+ * @return the next enclosing brace or null+ */+ public static ClangSyntaxToken getNextBrace(ClangToken startToken, boolean forward) {++ ClangNode parent = startToken.Parent();+ List<ClangNode> list = new ArrayList<>();++ ClangNode node = parent;+ while (node != null) {+ parent = node;+ node = node.Parent();+ }++ parent.flatten(list);++ String desiredBrace = "}"; // going down/forward, look for the containing closing brace+ if (!forward) {+ desiredBrace = "{"; // going up/backward, look for the containing closing brace+ Collections.reverse(list);+ }++ ClangSyntaxToken brace = moveToNextBrace(startToken, list, desiredBrace, forward);+ return brace;+ }++ private static ClangSyntaxToken moveToNextBrace(ClangToken startToken,+ List<ClangNode> list, String targetBrace, boolean forward) {++ int balance = 0;+ int index = list.indexOf(startToken);+ int start = index + 1;+ for (int i = start; i < list.size(); i++) {++ ClangToken token = (ClangToken) list.get(i);+ if (!(token instanceof ClangSyntaxToken)) {+ continue;+ }++ ClangSyntaxToken syntaxToken = (ClangSyntaxToken) token;+ if (!isBrace(syntaxToken)) {+ continue;+ }++ String nextBrace = syntaxToken.getText();+ if (!targetBrace.equals(nextBrace)) { // opposite brace+ balance++;+ continue;+ }++ // matching brace; see if it is balanced+ if (balance == 0) {+ return syntaxToken; // found an unmatched brace of the type we are seeking+ }+ balance--;+ }++ return null;+ }+public static ClangSyntaxToken getMatchingBrace(ClangSyntaxToken startToken) {ClangNode parent = startToken.Parent();@@ -618,7 +685,7 @@ public class DecompilerUtils {return !brace.equals(otherBrace);}- public static boolean isBrace(ClangSyntaxToken token) {+ public static boolean isBrace(ClangToken token) {String text = token.getText();return "{".equals(text) || "}".equals(text);}diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/DecompilerProvider.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/DecompilerProvider.javaindex c5f1f011f3..c897b38ab3 100644--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/DecompilerProvider.java+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/DecompilerProvider.java@@ -972,6 +972,8 @@ public class DecompilerProvider extends NavigatableComponentProviderAdapterDebugDecompilerAction debugFunctionAction = new DebugDecompilerAction(controller);ExportToCAction convertAction = new ExportToCAction();CloneDecompilerAction cloneDecompilerAction = new CloneDecompilerAction();+ GoToNextBraceAction goToNextBraceAction = new GoToNextBraceAction();+ GoToPreviousBraceAction goToPreviousBraceAction = new GoToPreviousBraceAction();addLocalAction(refreshAction);addLocalAction(selectAllAction);@@ -1018,6 +1020,8 @@ public class DecompilerProvider extends NavigatableComponentProviderAdapteraddLocalAction(findReferencesAction);addLocalAction(propertiesAction);addLocalAction(cloneDecompilerAction);+ addLocalAction(goToNextBraceAction);+ addLocalAction(goToPreviousBraceAction);graphServiceAdded();}diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/GoToNextBraceAction.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/GoToNextBraceAction.javanew file mode 100644index 0000000000..0425428aa1--- /dev/null+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/GoToNextBraceAction.java@@ -0,0 +1,59 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.app.plugin.core.decompile.actions;++import java.awt.event.InputEvent;+import java.awt.event.KeyEvent;++import docking.action.KeyBindingData;+import ghidra.app.decompiler.ClangSyntaxToken;+import ghidra.app.decompiler.ClangToken;+import ghidra.app.decompiler.component.DecompilerPanel;+import ghidra.app.decompiler.component.DecompilerUtils;+import ghidra.app.plugin.core.decompile.DecompilerActionContext;+import ghidra.app.util.HelpTopics;+import ghidra.util.HelpLocation;++/**+ * Go to the next enclosing closing brace in the forward direction.+ */+public class GoToNextBraceAction extends AbstractDecompilerAction {++ public GoToNextBraceAction() {+ super("Go To Next Brace");++ setHelpLocation(new HelpLocation(HelpTopics.DECOMPILER, "GoToBrace"));+ setKeyBindingData(+ new KeyBindingData(KeyEvent.VK_CLOSE_BRACKET, InputEvent.SHIFT_DOWN_MASK));+ }++ @Override+ protected boolean isEnabledForDecompilerContext(DecompilerActionContext context) {+ return true;+ }++ @Override+ protected void decompilerActionPerformed(DecompilerActionContext context) {++ ClangToken token = context.getTokenAtCursor();+ ClangSyntaxToken brace = DecompilerUtils.getNextBrace(token, true);+ if (brace != null) {+ DecompilerPanel panel = context.getDecompilerPanel();+ panel.goToToken(brace);+ }+ }++}diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/GoToPreviousBraceAction.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/GoToPreviousBraceAction.javanew file mode 100644index 0000000000..2c3adfbd96--- /dev/null+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/GoToPreviousBraceAction.java@@ -0,0 +1,58 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.app.plugin.core.decompile.actions;++import java.awt.event.InputEvent;+import java.awt.event.KeyEvent;++import docking.action.KeyBindingData;+import ghidra.app.decompiler.ClangSyntaxToken;+import ghidra.app.decompiler.ClangToken;+import ghidra.app.decompiler.component.DecompilerPanel;+import ghidra.app.decompiler.component.DecompilerUtils;+import ghidra.app.plugin.core.decompile.DecompilerActionContext;+import ghidra.app.util.HelpTopics;+import ghidra.util.HelpLocation;++/**+ * Go to the previous enclosing opening brace in the backward direction.+ */+public class GoToPreviousBraceAction extends AbstractDecompilerAction {++ public GoToPreviousBraceAction() {+ super("Go To Previous Brace");++ setHelpLocation(new HelpLocation(HelpTopics.DECOMPILER, "GoToBrace"));+ setKeyBindingData(new KeyBindingData(KeyEvent.VK_OPEN_BRACKET, InputEvent.SHIFT_DOWN_MASK));+ }++ @Override+ protected boolean isEnabledForDecompilerContext(DecompilerActionContext context) {+ return true;+ }++ @Override+ protected void decompilerActionPerformed(DecompilerActionContext context) {++ ClangToken token = context.getTokenAtCursor();+ ClangSyntaxToken brace = DecompilerUtils.getNextBrace(token, false);+ if (brace != null) {+ DecompilerPanel panel = context.getDecompilerPanel();+ panel.goToToken(brace);+ }+ }++}diff --git a/Ghidra/Features/Decompiler/src/test.slow/java/ghidra/app/decompiler/component/DecompilerClang2Test.java b/Ghidra/Features/Decompiler/src/test.slow/java/ghidra/app/decompiler/component/DecompilerClang2Test.javanew file mode 100644index 0000000000..b79974b7b0--- /dev/null+++ b/Ghidra/Features/Decompiler/src/test.slow/java/ghidra/app/decompiler/component/DecompilerClang2Test.java@@ -0,0 +1,283 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.app.decompiler.component;++import org.junit.Before;+import org.junit.Test;++import docking.action.DockingActionIf;+import ghidra.app.decompiler.ClangToken;+import ghidra.app.decompiler.DecompileOptions.NamespaceStrategy;+import ghidra.app.plugin.core.decompile.AbstractDecompilerTest;+import ghidra.framework.options.ToolOptions;+import ghidra.framework.plugintool.util.OptionsService;++public class DecompilerClang2Test extends AbstractDecompilerTest {++ @Override+ @Before+ public void setUp() throws Exception {++ super.setUp();+ OptionsService service = provider.getTool().getService(OptionsService.class);+ ToolOptions opt = service.getOptions("Decompiler");+ opt.setEnum("Display.Display Namespaces", NamespaceStrategy.Never);+ }++ @Override+ protected String getProgramName() {+ return "Winmine__XP.exe.gzf";+ }++ @Test+ public void testGoToNextBrace() {++ /*++ void FUN_01002ed5(void)++ {+ int iVar1;+ int iVar2;+ int iVar3;+ undefined *puVar5;+ undefined *puVar6;+ int iVar7;+ int iVar4;++ iVar4 = 0x360;+ do {+ iVar2 = iVar4 + -1;+ *(undefined *)(iVar4 + 0x100533f) = 0xf;+ iVar7 = DAT_01005338;+ iVar1 = DAT_01005334;+ iVar4 = iVar2;+ } while (iVar2 != 0);+ if (DAT_01005334 + 2 != 0) {+ iVar2 = DAT_01005338 * 0x20;+ iVar4 = DAT_01005334 + 2;+ do {+ iVar3 = iVar4 + -1;+ *(undefined *)(iVar4 + 0x100533f) = 0x10;+ (&DAT_01005360)[iVar3 + iVar2] = 0x10;+ iVar4 = iVar3;+ } while (iVar3 != 0);+ }+ iVar7 = iVar7 + 2;+ if (iVar7 != 0) {+ puVar6 = &DAT_01005340 + iVar7 * 0x20;+ puVar5 = &DAT_01005341 + iVar1 + iVar7 * 0x20;+ do {+ puVar6 = puVar6 + -0x20;+ puVar5 = puVar5 + -0x20;+ iVar7 = iVar7 + -1;+ *puVar6 = 0x10;+ *puVar5 = 0x10;+ } while (iVar7 != 0);+ }+ return;+ }++ */++ //+ // This test will put the cursor on a line that is nested 3 levels deep.+ //++ decompile("01002ed5"); // 'main'++ int line = 26; // iVar3 = iVar4 + -1;+ int charPosition = 2;+ setDecompilerLocation(line, charPosition);++ goToNextBrace();+ assertClosingBrace(29);++ goToNextBrace();+ assertClosingBrace(30);++ goToNextBrace();+ assertClosingBrace(44);++ // at the last brace; no change+ goToNextBrace();+ assertClosingBrace(44);+ }++ @Test+ public void testGoToNextBrace_AlreadyOnBrace() {++ //+ // This test will put the cursor on a line that is nested 3 levels deep.+ //++ decompile("01002ed5"); // 'main'++ int line = 24; // iVar3 = iVar4 + -1;+ int charPosition = 4;+ setDecompilerLocation(line, charPosition);++ goToNextBrace();+ assertClosingBrace(29);++ goToNextBrace();+ assertClosingBrace(30);++ goToNextBrace();+ assertClosingBrace(44);++ // at the last brace; no change+ goToNextBrace();+ assertClosingBrace(44);+ }++ @Test+ public void testGoToPreviousBrace() {++ /*++ void FUN_01002ed5(void)++ {+ int iVar1;+ int iVar2;+ int iVar3;+ undefined *puVar5;+ undefined *puVar6;+ int iVar7;+ int iVar4;++ iVar4 = 0x360;+ do {+ iVar2 = iVar4 + -1;+ *(undefined *)(iVar4 + 0x100533f) = 0xf;+ iVar7 = DAT_01005338;+ iVar1 = DAT_01005334;+ iVar4 = iVar2;+ } while (iVar2 != 0);+ if (DAT_01005334 + 2 != 0) {+ iVar2 = DAT_01005338 * 0x20;+ iVar4 = DAT_01005334 + 2;+ do {+ iVar3 = iVar4 + -1;+ *(undefined *)(iVar4 + 0x100533f) = 0x10;+ (&DAT_01005360)[iVar3 + iVar2] = 0x10;+ iVar4 = iVar3;+ } while (iVar3 != 0);+ }+ iVar7 = iVar7 + 2;+ if (iVar7 != 0) {+ puVar6 = &DAT_01005340 + iVar7 * 0x20;+ puVar5 = &DAT_01005341 + iVar1 + iVar7 * 0x20;+ do {+ puVar6 = puVar6 + -0x20;+ puVar5 = puVar5 + -0x20;+ iVar7 = iVar7 + -1;+ *puVar6 = 0x10;+ *puVar5 = 0x10;+ } while (iVar7 != 0);+ }+ return;+ }++ */++ //+ // This test will put the cursor on a line that is nested 3 levels deep.+ //++ decompile("01002ed5"); // 'main'++ int line = 26; // iVar3 = iVar4 + -1;+ int charPosition = 2;+ setDecompilerLocation(line, charPosition);++ goToPreviousBrace();+ assertOpeningBrace(24);++ goToPreviousBrace();+ assertOpeningBrace(21);++ goToPreviousBrace();+ assertOpeningBrace(4);++ // at the first brace; no change+ goToPreviousBrace();+ assertOpeningBrace(4);+ }++ @Test+ public void testGoToPreviousBrace_AlreadyOnBrace() {++ decompile("01002ed5"); // 'main'++ int line = 29; // iVar3 = iVar4 + -1;+ int charPosition = 0;+ setDecompilerLocation(line, charPosition);++ goToPreviousBrace();+ assertOpeningBrace(24);++ goToPreviousBrace();+ assertOpeningBrace(21);++ goToPreviousBrace();+ assertOpeningBrace(4);++ // at the first brace; no change+ goToPreviousBrace();+ assertOpeningBrace(4);+ }++ private void goToNextBrace() {+ DockingActionIf action = getAction(decompiler, "Go To Next Brace");+ performAction(action, provider.getActionContext(null), true);+ waitForDecompiler();+ }++ private void goToPreviousBrace() {+ DockingActionIf action = getAction(decompiler, "Go To Previous Brace");+ performAction(action, provider.getActionContext(null), true);+ waitForDecompiler();+ }++ private void assertOpeningBrace(int line) {++ waitForCondition(() -> {+ ClangToken token = getToken();+ int actualLine = token.getLineParent().getLineNumber();+ if (line != actualLine) {+ return false;+ }+ String text = token.getText();+ return "{".equals(text);+ }, "Cursor is not on opening brace at line " + line);+ }++ private void assertClosingBrace(int line) {++ waitForCondition(() -> {+ ClangToken token = getToken();+ int actualLine = token.getLineParent().getLineNumber();+ if (line != actualLine) {+ return false;+ }+ String text = token.getText();+ return "}".equals(text);+ }, "Cursor is not on closing brace at line " + line);+ }++}diff --git a/Ghidra/Features/Decompiler/src/test.slow/java/ghidra/app/decompiler/component/DecompilerClangTest.java b/Ghidra/Features/Decompiler/src/test.slow/java/ghidra/app/decompiler/component/DecompilerClangTest.javaindex 60eebdface..844ce66f58 100644--- a/Ghidra/Features/Decompiler/src/test.slow/java/ghidra/app/decompiler/component/DecompilerClangTest.java+++ b/Ghidra/Features/Decompiler/src/test.slow/java/ghidra/app/decompiler/component/DecompilerClangTest.java@@ -1131,14 +1131,11 @@ public class DecompilerClangTest extends AbstractDecompilerTest {String hlText = "_printf";Color hlColor = Color.PINK;- CTokenHighlightMatcher hlMatcher = new CTokenHighlightMatcher() {- @Override- public Color getTokenHighlight(ClangToken token) {- if (token.getText().contains(hlText)) {- return hlColor;- }- return null;+ CTokenHighlightMatcher hlMatcher = token -> {+ if (token.getText().contains(hlText)) {+ return hlColor;}+ return null;};SpyCTokenHighlightMatcher spyMatcher = new SpyCTokenHighlightMatcher(hlMatcher);DecompilerHighlightService hlService = getHighlightService();@@ -1184,14 +1181,11 @@ public class DecompilerClangTest extends AbstractDecompilerTest {String hlText = "_printf";Color hlColor = Color.PINK;- CTokenHighlightMatcher hlMatcher = new CTokenHighlightMatcher() {- @Override- public Color getTokenHighlight(ClangToken token) {- if (token.getText().contains(hlText)) {- return hlColor;- }- return null;+ CTokenHighlightMatcher hlMatcher = token -> {+ if (token.getText().contains(hlText)) {+ return hlColor;}+ return null;};SpyCTokenHighlightMatcher spyMatcher = new SpyCTokenHighlightMatcher(hlMatcher);DecompilerHighlightService hlService = getHighlightService();@@ -1249,14 +1243,11 @@ public class DecompilerClangTest extends AbstractDecompilerTest {String hlText = "_printf";Color hlColor = Color.PINK;- CTokenHighlightMatcher hlMatcher = new CTokenHighlightMatcher() {- @Override- public Color getTokenHighlight(ClangToken token) {- if (token.getText().contains(hlText)) {- return hlColor;- }- return null;+ CTokenHighlightMatcher hlMatcher = token -> {+ if (token.getText().contains(hlText)) {+ return hlColor;}+ return null;};SpyCTokenHighlightMatcher spyMatcher = new SpyCTokenHighlightMatcher(hlMatcher);DecompilerHighlightService hlService = getHighlightService();@@ -1314,14 +1305,11 @@ public class DecompilerClangTest extends AbstractDecompilerTest {String hlText = "_printf";Color hlColor = Color.PINK;- CTokenHighlightMatcher hlMatcher = new CTokenHighlightMatcher() {- @Override- public Color getTokenHighlight(ClangToken token) {- if (token.getText().contains(hlText)) {- return hlColor;- }- return null;+ CTokenHighlightMatcher hlMatcher = token -> {+ if (token.getText().contains(hlText)) {+ return hlColor;}+ return null;};SpyCTokenHighlightMatcher spyMatcher = new SpyCTokenHighlightMatcher(hlMatcher);DecompilerHighlightService hlService = getHighlightService();@@ -1365,14 +1353,11 @@ public class DecompilerClangTest extends AbstractDecompilerTest {String hlText1 = "_printf";Color hlColor1 = Color.PINK;- CTokenHighlightMatcher hlMatcher1 = new CTokenHighlightMatcher() {- @Override- public Color getTokenHighlight(ClangToken token) {- if (token.getText().contains(hlText1)) {- return hlColor1;- }- return null;+ CTokenHighlightMatcher hlMatcher1 = token -> {+ if (token.getText().contains(hlText1)) {+ return hlColor1;}+ return null;};SpyCTokenHighlightMatcher spyMatcher1 = new SpyCTokenHighlightMatcher(hlMatcher1);DecompilerHighlightService hlService = getHighlightService();@@ -1386,14 +1371,11 @@ public class DecompilerClangTest extends AbstractDecompilerTest {String hlText2 = "name";Color hlColor2 = Color.GREEN;- CTokenHighlightMatcher hlMatcher2 = new CTokenHighlightMatcher() {- @Override- public Color getTokenHighlight(ClangToken token) {- if (token.getText().contains(hlText2)) {- return hlColor2;- }- return null;+ CTokenHighlightMatcher hlMatcher2 = token -> {+ if (token.getText().contains(hlText2)) {+ return hlColor2;}+ return null;};SpyCTokenHighlightMatcher spyMatcher2 = new SpyCTokenHighlightMatcher(hlMatcher2);DecompilerHighlighter highlighter2 = hlService.createHighlighter(spyMatcher2);@@ -1443,14 +1425,11 @@ public class DecompilerClangTest extends AbstractDecompilerTest {String hlText = "_printf";Color hlColor1 = Color.PINK;- CTokenHighlightMatcher hlMatcher1 = new CTokenHighlightMatcher() {- @Override- public Color getTokenHighlight(ClangToken token) {- if (token.getText().contains(hlText)) {- return hlColor1;- }- return null;+ CTokenHighlightMatcher hlMatcher1 = token -> {+ if (token.getText().contains(hlText)) {+ return hlColor1;}+ return null;};SpyCTokenHighlightMatcher spyMatcher1 = new SpyCTokenHighlightMatcher(hlMatcher1);DecompilerHighlightService hlService = getHighlightService();@@ -1458,14 +1437,11 @@ public class DecompilerClangTest extends AbstractDecompilerTest {highlighter1.applyHighlights();Color hlColor2 = Color.GREEN;- CTokenHighlightMatcher hlMatcher2 = new CTokenHighlightMatcher() {- @Override- public Color getTokenHighlight(ClangToken token) {- if (token.getText().contains(hlText)) {- return hlColor2;- }- return null;+ CTokenHighlightMatcher hlMatcher2 = token -> {+ if (token.getText().contains(hlText)) {+ return hlColor2;}+ return null;};SpyCTokenHighlightMatcher spyMatcher2 = new SpyCTokenHighlightMatcher(hlMatcher2);DecompilerHighlighter highlighter2 = hlService.createHighlighter(spyMatcher2);@@ -1510,14 +1486,11 @@ public class DecompilerClangTest extends AbstractDecompilerTest {String hlText = "_printf";Color hlColor = Color.PINK;- CTokenHighlightMatcher hlMatcher = new CTokenHighlightMatcher() {- @Override- public Color getTokenHighlight(ClangToken token) {- if (token.getText().contains(hlText)) {- return hlColor;- }- return null;+ CTokenHighlightMatcher hlMatcher = token -> {+ if (token.getText().contains(hlText)) {+ return hlColor;}+ return null;};SpyCTokenHighlightMatcher spyMatcher = new SpyCTokenHighlightMatcher(hlMatcher);DecompilerHighlightService hlService = getHighlightService();@@ -1560,14 +1533,11 @@ public class DecompilerClangTest extends AbstractDecompilerTest {String hlText = "_printf";Color hlColor = Color.PINK;- CTokenHighlightMatcher hlMatcher = new CTokenHighlightMatcher() {- @Override- public Color getTokenHighlight(ClangToken token) {- if (token.getText().contains(hlText)) {- return hlColor;- }- return null;+ CTokenHighlightMatcher hlMatcher = token -> {+ if (token.getText().contains(hlText)) {+ return hlColor;}+ return null;};SpyCTokenHighlightMatcher spyMatcher1 = new SpyCTokenHighlightMatcher(hlMatcher);DecompilerHighlightService hlService = getHighlightService();@@ -1621,14 +1591,11 @@ public class DecompilerClangTest extends AbstractDecompilerTest {String hlText = "_printf";Color hlColor = Color.PINK;- CTokenHighlightMatcher hlMatcher = new CTokenHighlightMatcher() {- @Override- public Color getTokenHighlight(ClangToken token) {- if (token.getText().contains(hlText)) {- return hlColor;- }- return null;+ CTokenHighlightMatcher hlMatcher = token -> {+ if (token.getText().contains(hlText)) {+ return hlColor;}+ return null;};SpyCTokenHighlightMatcher spyMatcher = new SpyCTokenHighlightMatcher(hlMatcher);DecompilerHighlightService hlService = getHighlightService();@@ -1672,14 +1639,11 @@ public class DecompilerClangTest extends AbstractDecompilerTest {String hlText = "_printf";Color hlColor = Color.PINK;- CTokenHighlightMatcher hlMatcher = new CTokenHighlightMatcher() {- @Override- public Color getTokenHighlight(ClangToken token) {- if (token.getText().contains(hlText)) {- return hlColor;- }- return null;+ CTokenHighlightMatcher hlMatcher = token -> {+ if (token.getText().contains(hlText)) {+ return hlColor;}+ return null;};SpyCTokenHighlightMatcher spyMatcher = new SpyCTokenHighlightMatcher(hlMatcher);DecompilerHighlightService hlService = getHighlightService();@@ -1725,14 +1689,11 @@ public class DecompilerClangTest extends AbstractDecompilerTest {String hlText = "_printf";Color hlColor = Color.PINK;- CTokenHighlightMatcher hlMatcher = new CTokenHighlightMatcher() {- @Override- public Color getTokenHighlight(ClangToken token) {- if (token.getText().contains(hlText)) {- return hlColor;- }- return null;+ CTokenHighlightMatcher hlMatcher = token -> {+ if (token.getText().contains(hlText)) {+ return hlColor;}+ return null;};SpyCTokenHighlightMatcher spyMatcher = new SpyCTokenHighlightMatcher(hlMatcher);DecompilerHighlightService hlService = getHighlightService();@@ -1776,14 +1737,11 @@ public class DecompilerClangTest extends AbstractDecompilerTest {String hlText = "_printf";Color hlColor = Color.PINK;- CTokenHighlightMatcher hlMatcher = new CTokenHighlightMatcher() {- @Override- public Color getTokenHighlight(ClangToken token) {- if (token.getText().contains(hlText)) {- return hlColor;- }- return null;+ CTokenHighlightMatcher hlMatcher = token -> {+ if (token.getText().contains(hlText)) {+ return hlColor;}+ return null;};SpyCTokenHighlightMatcher spyMatcher = new SpyCTokenHighlightMatcher(hlMatcher);DecompilerHighlightService hlService = getHighlightService();