Re: Named regexp variables, an extension proposal.

2006-05-14 Thread Paddy
John Machin wrote: On 13/05/2006 7:39 PM, Paddy wrote: [snip] Extension; named RE variables, with arguments === In this, all group definitions in the body of the variable definition reference the literal contents of groups appearing after the variable

Re: Named regexp variables, an extension proposal.

2006-05-14 Thread Paddy
Paul McGuire wrote: Paddy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Proposal: Named RE variables == Hi Paul, please also refer to my reply to John. By contrast, the event declaration expression in the pyparsing Verilog parser is: identLead =

Re: Named regexp variables, an extension proposal.

2006-05-14 Thread Paul McGuire
Paddy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] It's difficult to switch to parsers for me even though examples like pyparsing seem readable, I do want to skip what I am not interested in rather than having to write a parser for everything. But converely, when something skipped

Re: Named regexp variables, an extension proposal.

2006-05-14 Thread Paddy
I have another use case. If you want to match a comma separated list of words you end up writing what constitutes a word twice, i.e: r\w+[,\w+] As what constitues a word gets longer, you have to repeat a longer RE fragment so the fact that it is a match of a comma separated list is lost, e.g:

Re: Named regexp variables, an extension proposal.

2006-05-14 Thread Paul McGuire
Paddy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have another use case. If you want to match a comma separated list of words you end up writing what constitutes a word twice, i.e: r\w+[,\w+] As what constitues a word gets longer, you have to repeat a longer RE fragment so

Re: Named regexp variables, an extension proposal.

2006-05-14 Thread Edward Elliott
Paddy wrote: I have another use case. If you want to match a comma separated list of words you end up writing what constitutes a word twice, i.e: r\w+[,\w+] That matches one or more alphanum characters followed by exactly one comma, plus, or alphanum. I think you meant r'\w+(,\w+)*' or

Named regexp variables, an extension proposal.

2006-05-13 Thread Paddy
Proposal: Named RE variables == The problem I have is that I am writing a 'good-enough' verilog tag extractor as a long regular expression (with the 'x' flag for readability), and find myself both 1) Repeating sections of the RE, and 2) Wanting to add '(?Psome_clarifier...)

Re: Named regexp variables, an extension proposal.

2006-05-13 Thread John Machin
On 13/05/2006 7:39 PM, Paddy wrote: [snip] Extension; named RE variables, with arguments === In this, all group definitions in the body of the variable definition reference the literal contents of groups appearing after the variable name, (but within the

Re: Named regexp variables, an extension proposal.

2006-05-13 Thread Paul McGuire
Paddy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Proposal: Named RE variables == The problem I have is that I am writing a 'good-enough' verilog tag extractor as a long regular expression (with the 'x' flag for readability), and find myself both 1)