emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFR cc-langs.el: change syntax for @ in Java


From: Filipp Gunbin
Subject: Re: RFR cc-langs.el: change syntax for @ in Java
Date: Thu, 08 Apr 2021 20:26:49 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin)

Hi Alan,

On 08/04/2021 10:15 +0000, Alan Mackenzie wrote:

> I've just run the CC Mode test suite with this amendment, and it
> produces the following successes on annotations-1.java:
>
> annotations-1.java:4: Expected analysis ((inclass 1) (topmost-intro 21)), got 
> ((inclass 21) (topmost-intro 21))
> annotations-1.java:4: Expected indentation 0, got 32
> annotations-1.java:5: Expected analysis ((class-close 1)), got ((class-close 
> 21))
>
> ..  So, there are things to sort out before we can apply the change.

I think these breakages are not real breakages, but rather the resfile
could be updated.

This class:

--8<---------------cut here---------------start------------->8---
@NonNull
@TestClass
@FooBar public class Annotations {

}
--8<---------------cut here---------------end--------------->8---

previosly "started" at the @NonNull line, but now "starts" at @FooBar
line, which is absolutely correct.

So here's the updated patch (now against the cc-mode repo).
Thanks.

diff -r 10abd4587dad cc-langs.el
--- a/cc-langs.el       Mon Mar 29 15:20:53 2021 +0000
+++ b/cc-langs.el       Thu Apr 08 20:22:56 2021 +0300
@@ -365,12 +365,14 @@
        (let ((table (make-syntax-table)))
         (c-populate-syntax-table table)
         ;; Mode specific syntaxes.
-        ,(cond ((or (c-major-mode-is 'objc-mode) (c-major-mode-is 'java-mode))
+        ,(cond ((c-major-mode-is 'objc-mode)
                 ;; Let '@' be part of symbols in ObjC to cope with
                 ;; its compiler directives as single keyword tokens.
                 ;; This is then necessary since it's assumed that
                 ;; every keyword is a single symbol.
                 `(modify-syntax-entry ?@ "_" table))
+               ((c-major-mode-is 'java-mode)
+                `(modify-syntax-entry ?@ "'" table))
                ((c-major-mode-is 'pike-mode)
                 `(modify-syntax-entry ?@ "." table)))
         table)))
diff -r 10abd4587dad tests/annotations-1.res
--- a/tests/annotations-1.res   Mon Mar 29 15:20:53 2021 +0000
+++ b/tests/annotations-1.res   Thu Apr 08 20:22:56 2021 +0300
@@ -1,8 +1,8 @@
 ((topmost-intro <0,0>))
 ((annotation-top-cont <1,0>))
 ((annotation-top-cont <1,0>))
-((inclass <3,0>) (topmost-intro <1,0>))
-((class-close <4,0>))
+((inclass <1,0>) (topmost-intro <1,0>))
+((class-close <2,0>))
 ((topmost-intro <1,0>))
 ((topmost-intro <2,0>))
 ((inclass <1,0>) (topmost-intro <1,0>))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]