mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
examples: clean up
* examples/c/calc/calc.y: Restore to its original state, with parse.error=detailed instead of parse.error=custom (this example should be simple). * examples/c/calc/calc.test: Check syntax errors. * examples/c/lexcalc/parse.y: Add comments.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Prologue (directives). -*- C++ -*- */
|
||||
/* Prologue (directives). -*- C -*- */
|
||||
|
||||
/* Disable Flex features we don't need, to avoid warnings. */
|
||||
%option nodefault noinput nounput noyywrap
|
||||
@@ -17,10 +17,14 @@
|
||||
|
||||
%%
|
||||
%{
|
||||
// Number of opened parentheses.
|
||||
int nesting = 0;
|
||||
// A buffer storing the text inside the outer parentheses.
|
||||
char *str = NULL;
|
||||
int size = 0;
|
||||
// Its allocated size.
|
||||
int capacity = 0;
|
||||
// Its used size.
|
||||
int size = 0;
|
||||
#define STR_APPEND() \
|
||||
do { \
|
||||
if (capacity < size + yyleng + 1) \
|
||||
|
||||
Reference in New Issue
Block a user