l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
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:

	WORD    { ParseError($1); }

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


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

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
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:
EDGE Tech Corp.
For donating some give-aways for our meetings.