unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* DXL mode: c-guess-basic-syntax missing some vsemi
@ 2011-04-06  5:29 Vincent Belaïche
  0 siblings, 0 replies; only message in thread
From: Vincent Belaïche @ 2011-04-06  5:29 UTC (permalink / raw)
  To: Stefan Monnier, acm; +Cc: emacs-devel

Hello,

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,

  Vincent.

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

http://vincentbelaiche.pagesperso-orange.fr/boite/cc-mode.tgz

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
>



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-04-06  5:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-06  5:29 DXL mode: c-guess-basic-syntax missing some vsemi Vincent Belaïche

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).