auctex-devel
[Top][All Lists]
Advanced

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

[AUCTeX-devel] Syntax for describing LaTeX macro arguments


From: Ralf Angeli
Subject: [AUCTeX-devel] Syntax for describing LaTeX macro arguments
Date: Sun, 18 Jun 2006 16:55:34 +0200

The multiline-font-lock branch uses special specifiers for describing
the order and type of macro arguments.  The specifier for \newcommand,
for example, looks like this: "*{}[][]{}"  That means there is a
starred version of the macro and it expects a mandatory argument
followed by two optional arguments and another mandatory argument.

For some macros like \newcommand there is the possibility that one can
use a macro instead of a TeX group as argument.  That means both
\newcommand{\foo}{\bar} and \newcommand\foo{\bar} are valid.  I'm
currently trying to fit this possibility into the syntax for the
specifier.  One possibility for describing the choice would be to use
a pipe symbol representing a logic OR and a backslash for depicting
the macro.  So the above example would become "*{}|\\[][]{}".  This
has the disadvantage that it is becoming more difficult to parse
because one would have to look for pipes after every token.  It would
become easier if tokens were separated e.g. by spaces:
"* {}|\\ [] [] {}"  Then one could use `split-string' on the whole
string for retrieving tokens and subsequently on the tokens for
retrieving alternatives.  The specifier, however, would look a bit
longish then.  Does anybody have alternative ideas?

Keep in mind that this could not only be used for font locking but
also as part of a more general database of TeX commands.  (We might as
well create such a command database before merging the
multiline-font-lock branch with the trunk.)

-- 
Ralf





reply via email to

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