[Top][All Lists]

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

[AUCTeX-devel] Regex best practice

From: Arash Esbati
Subject: [AUCTeX-devel] Regex best practice
Date: Thu, 19 Nov 2015 20:58:01 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5

Hi all,

looking at some packages, the optional arguments for some commands are
getting more and more complex, e.g.

--8<---------------cut here---------------start------------->8---
  key          = value               ,
  name         = {[Optional]Value}   ,
  anothername  = {valu-es[]}]{}      ,
  colframe     = red!75!black        ,
  fonttitle    = \bfseries           ,
  enhanced                           ,
  attach boxed = {yshift=-2mm}       ,
  title        = #2
--8<---------------cut here---------------end--------------->8---

I was thinking about a general regex-solution how to add these kind of
beasts to AUCTeX parser.  My solution is currently:

--8<---------------cut here---------------start------------->8---
\\\\declaresomething[ \t\n\r%]*\\(?:\\[\\(?:[\t\n\r[:print:]]*\\)\\]\\)?[ 
\t\n\r%]*{[ \t\n\r%]*\\([[:print:]]+\\)[ \t\n\r%]*}
--8<---------------cut here---------------end--------------->8---

Any comments?  Admittedly, the last two `[ \t\n\r%]' are excessive, but
you never know.

Best, Arash

reply via email to

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