This is an automated email from the ASF dual-hosted git repository.

lkishalmi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 9bc15b1fd0 Rust: More precise parser error markings in the Editor
9bc15b1fd0 is described below

commit 9bc15b1fd039fdf08eda7ea81fe1ce5c5a33eaa2
Author: Laszlo Kishalmi <laszlo.kisha...@gmail.com>
AuthorDate: Wed Jul 26 17:55:02 2023 -0700

    Rust: More precise parser error markings in the Editor
---
 .../src/org/netbeans/modules/rust/grammar/ast/RustAST.java        | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/rust/rust.grammar/src/org/netbeans/modules/rust/grammar/ast/RustAST.java 
b/rust/rust.grammar/src/org/netbeans/modules/rust/grammar/ast/RustAST.java
index 52eb050961..5ed3b9f750 100644
--- a/rust/rust.grammar/src/org/netbeans/modules/rust/grammar/ast/RustAST.java
+++ b/rust/rust.grammar/src/org/netbeans/modules/rust/grammar/ast/RustAST.java
@@ -103,9 +103,9 @@ public final class RustAST {
             if (offendingSymbol instanceof Token) {
                 Token offendingToken = (Token) offendingSymbol;
                 errorStartIndex = offendingToken.getStartIndex();
-                errorStopIndex = offendingToken.getStopIndex();
+                errorStopIndex = offendingToken.getStopIndex() + 1;
             }
-            errors.add(new DefaultError(null, msg, null, fileObject, 
errorStartIndex, errorStopIndex, Severity.ERROR));
+            errors.add(new DefaultError(null, msg, null, fileObject, 
errorStartIndex, errorStopIndex, errorStartIndex != errorStopIndex, 
Severity.ERROR));
         }
     }
 
@@ -127,8 +127,8 @@ public final class RustAST {
             String msg = sb.toString();
             RecognitionException ex = new RecognitionException(msg, 
recognizer, recognizer.getInputStream(), recognizer.getContext());
             int start = e.getOffendingToken().getStartIndex();
-            int stop = e.getOffendingToken().getStopIndex();
-            errors.add(new DefaultError(null, msg, null, fileObject, start, 
stop, Severity.ERROR));
+            int stop = e.getOffendingToken().getStopIndex() + 1;
+            errors.add(new DefaultError(null, msg, null, fileObject, start, 
stop, false, Severity.ERROR));
         }
 
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to