[Top][All Lists]

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

DXL mode: c-guess-basic-syntax missing some vsemi

From: Vincent Belaïche
Subject: DXL mode: c-guess-basic-syntax missing some vsemi
Date: Wed, 06 Apr 2011 07:29:19 +0200


You may remember that I needed some DXL edit mode, so I have started to
make some evolution on the cc mode.

Snce then, I have progressed quite a bit. However I have met some
issue. Please consider the following example DXL code:

Regexp re = regexp2 "une expression rationnelle"

  struct toto

The pointer is just afer `toto' and I type <tab>. In that case the
function `c-guess-basic-syntax' will return `((statement-cont 1))' and
this seems to be the reason why `struct toto' is indented like the
continuatio of the previous statement rather than a new statement. 

`struct toto' is not the continutation of `Regexp re = regexp2 "une
expression rationnelle"', and there is a virual colon text property just
at the end of `Regexp re = regexp2 "une expression rationnelle"', so my
vsemi detection works well.

I have investigated what happens, and in function c-guess-basic-syntax,
I am getting to case 5D.5, which cause this kind of return. The reason
why I get there is that case 5D is selected, and this in turn is due to
this that there is a call to `(c-syntactic-skip-backward "^;,=" lim t)'
which returns a non-nil as it finds the `=' sign in `Regexp re = regexp2 "une
expression rationnelle"', and the issue is that
`c-syntactic-skip-backward' does not make any virtual-semi-colon check.

I must say that I am a bit surprised that this kind of issue did not
happen with AWK. But maybe the syntax of DXL is more complex.

Any feedback is welcome,


P.S. for your convenience here is all the code I am using:


this is still very tentative.

>Salut Stéfan,
>Thanks for the feedback.
>For Alan's information, concerning the end of line, I must say that it
>is easilly feasible to test by a single regexp that an end-of-line is
>or is not ending a statement. There is no need to check that there are
>as many closing brackets than opening ones.
>So the following code will cause an error:
>int i = 2*(1 + 2 +
>         3)
>but this code is OK
>int i = b == c ?
>         1 :
>         2

reply via email to

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