[prev in list] [next in list] [prev in thread] [next in thread] 

List:       antlr-interest
Subject:    [antlr-interest] How to add catch section to the lexer ?
From:       "Ahmed Hamouda" <ahmedh () horizonssoftware ! com>
Date:       2008-04-24 14:48:49
Message-ID: 2E91F09A8F13BE4BACAA46759CA49915501641 () hs-srv-01 ! horizonssoftware ! com
[Download RAW message or body]

Hi all,

My ask today is how to add catch section to all lexer functions through
antlr ? My target language is C#.

I have added catch section to all parser function by adding this code in
antlr

 

@rulecatch {

catch (RecognitionException re) 

{

    throw new BusinessValidationException(13100101);

}

}

 

Now I want to make the same on the lexer.

 

Thank you all.

 

 

Best Regards

 

Ahmed Hamouda (MCTS)

Software Engineer

Horizons Software

Address: 93 Haroun Al Rasheed Street, Heliopolis, Cairo, Egypt. 11351. 

Tel:         +202-2644-3709

Mobile:    +2010-33-55-879

Fax:        +202-2632-0661

Website:   www.horizonssoftware.com <http://www.horizonssoftware.com/> 

 


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Verdana;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
	{font-family:Vivaldi;
	panose-1:3 2 6 2 5 5 6 9 8 4;}
@font-face
	{font-family:"Kunstler Script";
	panose-1:3 3 4 2 2 6 7 13 13 6;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal>Hi all,<o:p></o:p></p>

<p class=MsoNormal>My ask today is how to add catch section to all lexer
functions through antlr ? My target language is C#.<o:p></o:p></p>

<p class=MsoNormal>I have added catch section to all parser function by adding
this code in antlr<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>@rulecatch {<o:p></o:p></p>

<p class=MsoNormal>catch (RecognitionException re) <o:p></o:p></p>

<p class=MsoNormal>{<o:p></o:p></p>

<p class=MsoNormal>&nbsp;&nbsp;&nbsp; throw new \
BusinessValidationException(13100101);<o:p></o:p></p>

<p class=MsoNormal>}<o:p></o:p></p>

<p class=MsoNormal>}<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Now I want to make the same on the lexer.<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Thank you all.<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><span style='font-size:14.0pt;font-family:Vivaldi;
color:#333399'>Best Regards<o:p></o:p></span></p>

<p class=MsoNormal><b><span \
style='font-size:8.0pt;font-family:"Verdana","sans-serif"; \
color:#1F497D'><o:p>&nbsp;</o:p></span></b></p>

<p class=MsoNormal><b><span style='font-size:20.0pt;font-family:"Kunstler Script";
color:#548DD4'>Ahmed Hamouda</span></b><b><span style='font-size:8.0pt;
font-family:"Verdana","sans-serif";color:#548DD4'> </span></b><b><span
style='font-size:8.0pt;font-family:"Verdana","sans-serif";color:black'>(MCTS)</span></b><b><span
 style='font-size:8.0pt;font-family:"Verdana","sans-serif";color:#548DD4'><o:p></o:p></span></b></p>


<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Verdana","sans-serif";
color:#1F497D'>Software Engineer<o:p></o:p></span></p>

<p class=MsoNormal><b><span \
style='font-size:8.0pt;font-family:"Verdana","sans-serif"; color:blue'>Horizons \
Software<o:p></o:p></span></b></p>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Verdana","sans-serif";
color:#1F497D'>Address:&nbsp;93 Haroun Al Rasheed Street, Heliopolis, Cairo, Egypt.
11351. <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Verdana","sans-serif";
color:#1F497D'>Tel: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +202-</span><span
dir=RTL></span><span lang=AR-SA dir=RTL style='font-size:8.0pt;font-family:
"Arial","sans-serif";color:#1F497D'><span dir=RTL></span>2</span><span \
dir=LTR></span><span \
style='font-size:8.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><span \
dir=LTR></span>644-3709<b><o:p></o:p></b></span></p>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Verdana","sans-serif";
color:#1F497D'>Mobile:&nbsp;&nbsp; &nbsp;+2010-33-55-879<b><o:p></o:p></b></span></p>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Verdana","sans-serif";
color:#1F497D'>Fax:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+202-</span><span
dir=RTL></span><span lang=AR-SA dir=RTL style='font-size:8.0pt;font-family:
"Arial","sans-serif";color:#1F497D'><span dir=RTL></span>2</span><span \
dir=LTR></span><span \
style='font-size:8.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><span \
dir=LTR></span>632-0661<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Verdana","sans-serif";
color:#1F497D'>Website<b>:</b></span><b><span style='font-size:8.0pt;
font-family:"Verdana","sans-serif";color:navy'>&nbsp;&nbsp; </span></b><b><span
style='font-size:8.0pt;font-family:"Verdana","sans-serif";color:blue'><a
href="http://www.horizonssoftware.com/" \
title="http://www.horizonssoftware.com/"><span \
style='color:blue;font-weight:normal'>www.horizonssoftware.com</span></a></span></b><o:p></o:p></p>


<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic