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: Alan Mackenzie
Subject: Re: RFR cc-langs.el: change syntax for @ in Java
Date: Thu, 8 Apr 2021 10:15:31 +0000

Hello again, Filipp

On Wed, Apr 07, 2021 at 23:41:09 +0300, Filipp Gunbin wrote:
> Hi Alan, are you ok if I make this small change?  Prefix is better
> syntax for @ in Java, because it just denotes that the following is
> an annotation interface name (but is not part of it).

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.
Again, what's the reason for this change?  There must be a test case
where the current CC Mode handles some Java source code badly.

> Thanks.
> Filipp

> diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
> index fa4e73087e..e2c1c6099f 100644
> --- a/lisp/progmodes/cc-langs.el
> +++ b/lisp/progmodes/cc-langs.el
> @@ -378,12 +378,14 @@ c-make-mode-syntax-table
>         (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)))

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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