Hi Jim,
Thanks for the solution..
But I am facing one problem.
If I say
expr: SET VALUE ( i = Int { setValue($i.getText());} |
v = SPL_CHARS+ {
displayErrorMessage($v.getText());})
;
SPL_CHARS : ('\U0000' .. '\UFFFF')+;
When I give some non numeric input and call the method
displayErrorMessage($v.getText()) , I get a null pointer exception. It says
that v is null.
What should I do?
I need to capture this value and display the error message..
PS: It is not a simple grammar for SET command. In our product, we are
migrating from manual parsing to ANTLR Parser. So I don't think it is an
over kill :)
On Fri, May 20, 2011 at 9:34 PM, Jim Idle <[email protected]> wrote:
> SPL_CHARS : ('\U0000' .. '\UFFFF')+;
>
>
> The '+' in this means match everything and keep matching everything. You
> cannot use + here, you need:
>
> SPL_CHARS : .;
>
> Then use SPL_CHARS+ in your grammar not (.)+
>
> Though I think you would be better writing a small piece of code to
> process this really; ANTLR is a bit overkill for "set x y"
>
> Jim
>
> > -----Original Message-----
> > From: [email protected] [mailto:antlr-interest-
> > [email protected]] On Behalf Of preitz sharma
> > Sent: Friday, May 20, 2011 1:28 AM
> > To: [email protected]
> > Subject: [antlr-interest] Error in the method
> > specialStateTransition(int, IntStream)
> >
> > Hi,
> > I need to develop a grammar with the following structure:
> >
> > set <Param-Name> <Param-Val>
> >
> > The grammar which I have developed is working fine except for one
> > Problem:
> >
> > -> If the Param-Val does not match the constraints defined for certain
> > Param_Name, then I need to throw an error.
> >
> > I am doing it like this:
> >
> > command: SET ARRAYSIZE ( Int {/*Process the arraysize*/}
> > | (.)+ {/*Display eror message*/})
> > ;
> > Int: ('0'..'9')+;
> > Char: ('a'..'z');
> > SPL_CHARS : ('\U0000' .. '\UFFFF')+;
> >
> > The problem is that I am getting an error: "The code of method
> > specialStateTransition(int, IntStream) is exceeding the 65535 bytes
> > limit"
> > What should I do?
> > PS: The grammar which I have to write is pretty big.. If I make
> > SPL_CHARS
> > : ('\U0000' .. '\UFFFF') then its working fine Please suggest some
> > solution..
> >
> > Thanks
> > Preeti Sharma
> >
> > List: http://www.antlr.org/mailman/listinfo/antlr-interest
> > Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> > email-address
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
--
Regards
Preeti Sharma
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.