l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
October 7: Social gathering
Next Installfest:
TBD
Latest News:
Aug. 18: Discounts to "Velocity" in NY; come to tonight's "Photography" talk
Page last updated:
2001 Dec 30 17:14

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] how to get yacc/bison to say "i'm confused"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] how to get yacc/bison to say "i'm confused"



newbie here.

i'm using flex/bison for processing a program's user input, and have a
list of rules that define the user input grammar.

after bison processes all it's input, is there a way of telling it:

   if no rule matched the input, take your input and feed it to
   ParseError(const char *error)?

the problem i'm having is typically:

	ruleset:    TOK_RULESET NUMBER    { ChangeRuleset($2); }
		|        TOK_RULESET           { ChangeRuleset(-1); }

if the user types something like "ruleset asdf", it'll match
"TOK_RULESET", and (i think) "asdf" gets put back into the buffer since
it's not a NUMBER, and is processed the next time the user inputs
something.  in other words, bison gets out of sync and confused.

i have a rule like:

	(snip)
	WORD    { ParseError($1); }
	;

and this handles truly garbled input, like "qwerty", but doesn't handle
the situation i outlined above.


thanks,
pete

-- 
PGP Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
PGP Public Key:  finger p@dirac.org
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.