Hallo Antonio,

so, basically the error is that it cannot handle escape characters, e.g. \".


Here are some tests:

Syntax error on 7613:20 token recognition error at: '"  <?xml version=\"'

Syntax error on 3743:20 token recognition error at: '"upd_cmd desc: \"'

Syntax error on 523:3 token recognition error at: '"Error opening file.
PATH: \"'

    sprintf (trace_msg,

            "Error opening file. PATH: \"%s\" FILE: \"%s\"",

            getenv ((char *) PATH), afilename);



Syntax error on 628:37 token recognition error at: '"Cannot get total
number of bytes from message \"'

    snprintf(errMsg, MY_ERR_LEN, "Cannot get total number of bytes from
message \"%s\"", sizBuf);



Syntax error on 856:8 token recognition error at: '"<dto-ref ID = \"'

Syntax error on 80:22 token recognition error at: '"Object 1:
Name: \"'

    str[0] = (char *) "Object 1:               Name: \"OS\"\n";

Syntax error on 29:9 token recognition error at: '"HTML <h3><li><a name=\"'

Syntax error on 388:6 token recognition error at: '"%s DATA
user_id          = \"'

Syntax error on 180:12 token recognition error at: '"first line = \"'

Syntax error on 155:8 token recognition error at: '"#include \"'

   fputs("#include \"common_types.h\"\n", errorMsg);

Syntax error on 245:3 token recognition error at: '"Host list: \"'

Syntax error on 499:11 token recognition error at: '"\CreateUser (\"'

Syntax error on 67:9 token recognition error at: '"uptime |awk '{print \"'

Syntax error on 51:14 token recognition error at: '"s=\"'

Syntax error on 41:55 token recognition error at: '"00\"'

Syntax error on 3040:4 token recognition error at: '"  \"'

Kind regards,

John.

On Wed, 12 May 2021 at 00:11, antonio <[email protected]> wrote:

> 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