Re: Precedence Rules for '$' and '^'

Joachim Durchholz <jo@durchholz.org>
Thu, 13 Sep 2007 23:06:50 +0200

          From comp.compilers

Related articles
Precedence Rules for '$' and '^' jamin.hanson@googlemail.com (2007-09-12)
Re: Precedence Rules for '$' and '^' jo@durchholz.org (Joachim Durchholz) (2007-09-13)
Re: Precedence Rules for '$' and '^' jo@durchholz.org (Joachim Durchholz) (2007-09-13)
Re: Precedence Rules for '$' and '^' jamin.hanson@googlemail.com (2007-09-14)
Re: Precedence Rules for '$' and '^' rsc@swtch.com (Russ Cox) (2007-09-14)
Re: Precedence Rules for '$' and '^' jo@durchholz.org (Joachim Durchholz) (2007-09-15)
Re: Precedence Rules for '$' and '^' cfc@shell01.TheWorld.com (Chris F Clark) (2007-09-17)
Re: Precedence Rules for '$' and '^' jamin.hanson@googlemail.com (2007-09-17)
| List of all articles for this month |

From: Joachim Durchholz <jo@durchholz.org>
Newsgroups: comp.compilers
Date: Thu, 13 Sep 2007 23:06:50 +0200
Organization: 1&1 Internet AG
References: 07-09-035 07-09-037
Keywords: lex

John Levine wrote:
> [I don't understand it either. My understanding of typical REs is
> that they special case ^ at the beginning of a pattern or chunk
> that could match at the beginning, and $ at the end. -John]


That's just implementation; the OP was after precedences.


Assigning a precedence to ^ and $ does make sense. For example,


      ^asd|jkl


could mean "asd at the beginning of the text, or jkl anywhere in the
text", or it could mean "asd or jkl at the beginning of the text".
PCRE says it's either ^asd or jkl, so it assigns a higher precedence to
^ than to |.


Regards,
Jo


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.