[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

States in grammar file



My simplified grammar file is as follow:

States
	normal,
	tag,
	element,
	attribute;

Token
	{normal->tag, attribute->tag, tag}
	abc	= 'abc';
	blank	= ' ';
	...

	{tag->attribute, normal->attribute, attribute}
	alink 	= 'alink';
	....

	{element->normal, normal}
	valid_input 	= [[32..127] - [less_than + greater_than]]*;

Productions
	...

When I feed the gerenated parser a file where it contains a string "abc
alink" and the parser is in States tag, shouldn't it match 'abc' as token
abc, '  ' as blank, and 'alink' as token alink?  

Instead, what it interprets string "abc alink" as valid_input. 
valid_input is only suppose to be recognized in State normal. This would
be perfectly understandable if States are not defined(it will goes for the
longest possible match).  Am I not understanding how States work here? 
Any light on this subject would be appreciated.

Jenny
jlam@sojournlabs.com