File: rpnerror.yo

package info (click to toggle)
bisonc%2B%2B 4.09.02-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,412 kB
  • ctags: 2,871
  • sloc: cpp: 9,459; ansic: 1,434; makefile: 1,091; sh: 286; yacc: 84; lex: 60
file content (15 lines) | stat: -rw-r--r-- 843 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
When tt(parse()) detects a em(syntax error), it calls the error reporting
member function tt(error()) to print an error message (usually but not always
em(parse error)). It is up to the programmer to supply an implementation, but
a very bland and simple in-line implementation is provided by b() in the class
header file (see chapter ref(INTERFACE)). This default implementation is
acceptable for tt(rpn).

Once tt(error()) returns, the b() parser may recover from the error and
continue parsing if the grammar contains a suitable error rule (see chapter
ref(RECOVERY)).  Otherwise, the parsing function tt(parse()) returns
nonzero. Not any error rules were included in this example, so any invalid
input will cause the calculator program to exit. This is not clean behavior
for a real calculator, but it is adequate for this first example.