dcsimg
urgent: distinguish bw a value and a list of values
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Lucian_Ciufudean
Posted On:   Tuesday, January 15, 2002 09:50 AM

Example: key value11 key value21 value22 I need to return to the PARSER "value11" and then "value21 value22", i.e. return the longest string available after a key. I tried smth like: VALUE : LETTER; VALUES {StringBuffer sb = new StringBuffer();} :(v:(VALUE)+ { sb.append(v); } )+; Even tried to return from VALUES. Please help.    More>>

Example:



			
key value11

key value21 value22





I need to return to the PARSER "value11" and then "value21 value22", i.e. return the longest string available after a key.


I tried smth like:


VALUE

: LETTER;



VALUES {StringBuffer sb = new StringBuffer();}


:(v:(VALUE)+


{ sb.append(v); }

)+;



Even tried to return from VALUES.



Please help.

   <<Less

Re: urgent: distinguish bw a value and a list of values

Posted By:   Terence_Parr  
Posted On:   Tuesday, January 22, 2002 10:17 AM

Hi Lucian. You VALUES rule does not handle whitespace in between value21 and value22. I would suggest though that you recognize sequences of things in the parser not in the lexer unless you have a lot of experience. Make a lexer rule that matches a single value and then have a parser rule that matches ""key"" followed by a single or multiple values.
About | Sitemap | Contact