leex newbie question

SEUNG BONG HAN seungbong_han@REDACTED
Tue Jan 6 13:28:23 CET 2004


Hi.
 
I just started to learn leex and  I have a hard time figure out how to write the scanner.
 
Here is my simple test lex grammar :
 
test1.xrl :
 
Definitions.
D = [0-9]
H = [0-9a-fA-F]
WS = [\000-\040]
A = [a-zA-Z@REDACTED]
Rules.
{D}+\.{D}+((E|e)(\+|\-)?{D}+)? : {token,{float,YYline,YYtext}}.
{D}+  : {token, {integer, YYline, YYtext}}.
0[xX]{H}+ : {token, {hex, YYline, YYtext}}.
([a-z]({A}*)) : {token, {word, YYline, YYtext}}.
[!?/;:,.*+#()[\]|<>={}-] : {token,{list_to_atom(YYtext),YYline}}.
{WS}+ : .
 
After generate the scanner and execute the function test1:string("hello")
I expected to see {ok, [{word, 1, "hello"}],1}.
 
However, I got {error, {1,test1, {illegal, "hello"}.
 
What did I do wrong?
 
regards.
 




---------------------------------
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20040106/a78e3e54/attachment.htm>


More information about the erlang-questions mailing list