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




_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to