[antlr-interest] Handling 'finally' in language target that doesn'thave 'finally'

Sam Harwell sharwell at pixelminegames.com
Mon Jan 19 12:00:29 PST 2009


I assume you're trying to write a new target? If so, you can do
something like this, with nested try/catch and a duplication of the
finally code:

try {
  try {
    <tryCode>
  } catch ( ExceptionType1 ) {
    <handler>
  }
} catch ( ... ) {
  <finallyCode>
  throw;
}
<finallyCode>

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Rick Mann
Sent: Monday, January 19, 2009 1:39 PM
To: antlr-interest Interest
Subject: [antlr-interest] Handling 'finally' in language target that
doesn'thave 'finally'

In a language like C++, which stupidly doesn't support "finally",  
what's the right way to write a grammar? To just not use "finally" in  
it, and use init & after? Is there a way to signal to ANTLR (from the  
back-end implementation) that finally should not be allowed?

TIA,
-- 
Rick


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address


More information about the antlr-interest mailing list