Syntax based recognition of comments




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



Relevant Pages

  • Re: Referencing password protected Workbook
    ... > Whats the syntax for opening the file with the password? ... from the Excel menu and save it that way from the Visual Basic Editor. ...
    (microsoft.public.excel.programming)
  • Re: sed problem
    ... Alan Connor wrote: ... >>without opening a file. ... >>The following syntax won't work for sed. ... Regards, ...
    (comp.unix.shell)
  • Re: sed problem
    ... > without opening a file. ... > The following syntax won't work for sed. ... cat file | sed <<EOF ...
    (comp.unix.shell)
  • Re: opening a file
    ... santosh wrote: ... Can any one tell me the syntax for opening and closing a file in ...
    (comp.lang.c)
  • Re: forgetting my DCL: what am I missing?
    ... The CLI version supports the UN*X-like syntax as well. ... It does if the first character is "-". ... this is not necessarily the case with the unix syntax. ...
    (comp.os.vms)