Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old November 4th, 2006, 04:29 PM
Millenniumman Millenniumman is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 23 Millenniumman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 34 m 27 sec
Reputation Power: 0
Lex problem

I am having a problem with lex. In the main section with the regular expressions and the code for them, I am having an issue recognizing tokens properly.

First in the list of regular expressions is a few tokens e.g.
SURFACE return SURFACETOKEN;
DESCRIPTION return DESCRIPTIONTOKEN;
Then there is a normal text expression:
([\(\)_''/,&a-zA-Z0-9.-]+[ ]*)+ yylval=strdup(yytext); return TEXT;

I am having a problem where "SURFACE" is being read as "TEXT", which messes my parser up. I know that SURFACE would qualify for the TEXT regular expression, but I had thought that lex would choose the one that came first in the list. Apparently, not. Strangely, sometimes the tokens are read properly, but for the majority of the input file I am using, they are not.

How can I deal with this? Is there any way to tell lex that one expression should be judged before another? Or an efficient way to tell lex that the tokens do not qualify for the normal text expression. I know I could do this in yacc, but I'd prefer to do it in lex, and it seems like it should be possible.

I'd appreciate any advice.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > Lex problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway