Thanks John,

I'll be adding assorted compiler-specific cases at [1].

Kind regards,
Antonio


[1]
https://github.com/vieiro/cnd.nextapt/blob/master/cnd.apt.antlr4/src/test/resources/org/netbeans/modules/cnd/nextapt/antlr4/c/regressions.c

On 11/05/2021 17:41, John Kostaras wrote:
#define  CMPLX(__real,__imag) \
     _Pragma("clang diagnostic push") \
*    _Pragma("clang diagnostic ignored \"-Wcomplex-component-init\"") \*
     (double _Complex){(__real),(__imag)} \
     _Pragma("clang diagnostic pop")

line 59 being the highlighted one.

After pulling, building, re-running: java -Dlexer.print=false -jar
target/cnd.apt.antlr4-1.0-SNAPSHOT-jar-with-dependencies.jar /usr/include

I get

-- /usr/include/complex.h --
Syntax error on 59:12 token recognition error at: '"clang diagnostic
ignored \"'
Please report this error on the dev mailing list, including the line where
the error happeened.%n



On Mon, 10 May 2021 at 23:58, antonio <[email protected]> wrote:

Hi John,

Thanks for the report! It seems we weren't lexing '#error' yet (that's
probably what is on line 59 in "/usr/include/complex.h", right?
Otherwise send me the line 59).

The newest version should detect #error properly (and also checks for
ends of directives, and *.hpp/*.cpp).

Talking about antlr4, it seems the AST is analyzed using the visitor
pattern (that approach is also used in libclang) but NetBeans <= 8.2
expects the whole AST in memory, so it seems we have a long refactoring
road ahead (all this after successfully migrating the CXXParser.g to
antlr4, which reads >3300 lines long).

In parallel I'm giving libclang [1] a run. It seems quite powerful (it
provides completion, precompiled headers, reparsing, diagnostics, AST)
but it may require an extra +30Mb download on Windows (linux users may
apt-get install libclang, though). More on this in a few days.

Thanks again,
Antonio

[1]
https://clang.llvm.org/doxygen/group__CINDEX.html

El 10/5/21 a las 21:39, John Kostaras escribió:
+1 cnd.nextapt

java -Dlexer.print=false -jar
target/cnd.apt.antlr4-1.0-SNAPSHOT-jar-with-dependencies.jar /usr/include
....
-- /usr/include/complex.h --
Syntax error on 59:12 token recognition error at: '"clang diagnostic
ignored \"'

Will also take a look. Thanks Antonio. Great initiative.

P.S. I guess .hpp/.cpp files are next?

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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






---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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



Reply via email to