help-bison
[Top][All Lists]
Advanced

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

Re: Matching start and end


From: Hans Aberg
Subject: Re: Matching start and end
Date: Tue, 28 Jul 2009 12:05:02 +0200

On 27 Jul 2009, at 17:59, Alex Duller wrote:

I'm trying to parse the following bit of code and want to check that the yIDENTIFIER words are the same (in the following case yIDENTIFIER is TestFir). The regular expression for an yIDENTIFIER is [a-zA-Z_][a-zA-Z0-9_$]*

entity TestFir is
end entity TestFir;

The rule for parsing the above is:
yENTITY yIDENTIFIER yIS
...
yEND yENTITY yIDENTIFIER ';'

Put begin and end in the same rule, and check it in the actions:
  named_environment:
begin name ... end name ... { // Check $2 = $k, where $k is the second name }

  Hans






reply via email to

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