[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX-devel] Regex best practice
From: |
Mosè Giordano |
Subject: |
Re: [AUCTeX-devel] Regex best practice |
Date: |
Sat, 21 Nov 2015 19:39:29 +0100 |
Hi Arash,
2015-11-19 20:58 GMT+01:00 Arash Esbati <address@hidden>:
> 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---
> \declaresomething[%
> key = value ,
> name = {[Optional]Value} ,
> anothername = {valu-es[]}]{} ,
> colframe = red!75!black ,
> fonttitle = \bfseries ,
> enhanced ,
> attach boxed = {yshift=-2mm} ,
> title = #2
> ]
> {
> some1thing
> }
> --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.
Ehm, sorry but I didn't get what you want to match (re-builder
highlights "some1thing") and where you want to add this regex.
Bye,
Mosè