unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* HELP, PLEASE! Syntax problem!
@ 2009-11-25 12:58 Alan Mackenzie
  2009-11-25 14:43 ` Stefan Monnier
  2009-11-27  8:16 ` A Soare
  0 siblings, 2 replies; 12+ messages in thread
From: Alan Mackenzie @ 2009-11-25 12:58 UTC (permalink / raw)
  To: Stefan Monnier, emacs-devel

Hello Stefan, Hello Emacs,

In the following fragment of code:

1   int a = foo (
2       1);
3   #define X(A, B)                                 \
4       do {                                        \
5           printf (A, B);                          \
6       } while (0)

7   int a = foo (
8       1);

, there is a C macro between lines 3 and 6.  The syntax-table properties
here have been manipulated (see below).  Putting point at the "(" in L5
and doing C-M-n takes point to after ")" ON LINE 8.  Similar things
happen with C-M-p, C-M-u from various places inside the macro

Evidently, all syntactic properties inside the macro have been
suppressed.  This is not wanted.

The manipulation is as follows:
(i) Every paren/brace/bracket inside the macro has a category text
  property 'c-{}-syntax-in-cpp.  This symbol has a syntax table
  property, value '(1), i.e. "punctuation syntax".  This is intended to
  make the paren invisible to scan-lists, etc.  It does this.  But...

(ii) Over the entire macro is an overlay with a 'syntax-table property.
  This overlay should prevail over the text property, since overlays
  always do.  The value of this 'syntax-table property is the actual
  syntax table currently in use.  The effect of this should be that all
  characters in the macro should appear to have their normal syntax.

[The purpose of this is to assist a low level parsing routine in CC Mode
which needs to ignore parens inside macros, except for the macro
currently containing point.]

So, what am I doing wrong, that the syntax of the parens is invisible?
The parens are equally invisible to parse-partial-sexp.  Alternatively,
could it be that scan-lists is neglecting to take account of the overlay?

Thanks in advance for the help!

-- 
Alan Mackenzie (Nuremberg, Germany).




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-11-27 10:44 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-25 12:58 HELP, PLEASE! Syntax problem! Alan Mackenzie
2009-11-25 14:43 ` Stefan Monnier
2009-11-25 20:30   ` Alan Mackenzie
2009-11-25 21:45     ` Stefan Monnier
2009-11-25 22:13       ` Alan Mackenzie
2009-11-26  0:12         ` Stephen J. Turnbull
2009-11-26  8:53           ` Alan Mackenzie
2009-11-26 15:48             ` Stephen J. Turnbull
2009-11-27  9:16               ` Alan Mackenzie
2009-11-27  9:56                 ` David Kastrup
2009-11-27 10:44                   ` Alan Mackenzie
2009-11-27  8:16 ` A Soare

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).