Syntax based recognition of comments
- From: Alain Ketterlin <alain@xxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 29 Mar 2007 14:36:10 +0200
Hello,
I'm writing some elisp code that needs to scan a line of text and
count opening and closing parentheses. All of it is based on the
syntax table (parens actually are curly braces). I can test for parens
with char-syntax, which returns ?\( and ?\). That's fine.
My problem is with comments, which of course have to be skipped. Even
though the syntax table is ok (at least font-lock thinks so), it
appears that there is no way to learn via char-syntax that a character
is the first character of an opening comment sequence.
So what's the "canonical" way to recognize comments? Should I use
looking-at and comment-start/comment-end? Is there any way to access
syntax table info? I would prefer to stick with syntax-based scanning
and avoid having to use variables containing regexps (and duplicate
mode-specific information).
Also, it looks like forward-comment can use the syntax table. My
problem is to find when to call it... Am I missing the obvious?
Thanks in advance for comments and ideas.
-- Alain.
.
- Prev by Date: Help with perl->check syntax
- Next by Date: Re: How to configure SLIME in Xemacs with windows XP?
- Previous by thread: Help with perl->check syntax
- Next by thread: Change in compilation buffer behavior?
- Index(es):
Relevant Pages
|