You should have received a copy of the GNU General Public License
along with Bison; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
/*
symval is set to a pointer to the entry found. */
#include <stdio.h>
-#include <ctype.h>
#include "system.h"
#include "files.h"
#include "getopt.h" /* for optarg */
extern int lineno;
extern int translations;
-int parse_percent_token();
+void init_lex PARAMS((void));
+char *grow_token_buffer PARAMS((char *));
+int skip_white_space PARAMS((void));
+int safegetc PARAMS((FILE *));
+int literalchar PARAMS((char **, int *, char));
+void unlex PARAMS((int));
+int lex PARAMS((void));
+int parse_percent_token PARAMS((void));
/* functions from main.c */
-extern char *printable_version();
-extern void fatal();
-extern void warni();
-extern void warn();
+extern char *printable_version PARAMS((int));
+extern void fatal PARAMS((char *));
+extern void warn PARAMS((char *));
+extern void warni PARAMS((char *, int));
+extern void warns PARAMS((char *, char *));
/* Buffer for storing the current token. */
char *token_buffer;
/* Allocated size of token_buffer, not including space for terminator. */
-static int maxtoken;
+int maxtoken;
bucket *symval;
int numval;
void
-init_lex()
+init_lex (void)
{
maxtoken = 100;
token_buffer = NEW2 (maxtoken + 1, char);
}
-static char *
-grow_token_buffer (p)
- char *p;
+char *
+grow_token_buffer (char *p)
{
int offset = p - token_buffer;
maxtoken *= 2;
int
-skip_white_space()
+skip_white_space (void)
{
register int c;
register int inside;
/* do a getc, but give error message if EOF encountered */
int
-safegetc(f)
- FILE *f;
+safegetc (FILE *f)
{
register int c = getc(f);
if (c == EOF)
report error for \n
*/
int
-literalchar(pp, pcode, term)
- char **pp;
- int *pcode;
- char term;
+literalchar (char **pp, int *pcode, char term)
{
register int c;
register char *p;
else if (c == 'r') code = '\r';
else if (c == 'f') code = '\f';
else if (c == 'b') code = '\b';
- else if (c == 'v') code = 013;
+ else if (c == 'v') code = '\013';
else if (c == '\\') code = '\\';
else if (c == '\'') code = '\'';
else if (c == '\"') code = '\"';
so that `\012' and `\n' can be interchangeable. */
p = *pp;
- if (code == '\\') {*p++ = '\\'; *p++ = '\\';}
+ if (code == term && wasquote)
+ *p++ = code;
+ else if (code == '\\') {*p++ = '\\'; *p++ = '\\';}
else if (code == '\'') {*p++ = '\\'; *p++ = '\'';}
else if (code == '\"') {*p++ = '\\'; *p++ = '\"';}
else if (code >= 040 && code < 0177)
void
-unlex(token)
- int token;
+unlex (int token)
{
unlexed = token;
unlexed_symval = symval;
int
-lex()
+lex (void)
{
register int c;
char *p;
/* These would be acceptable, but they do not affect processing */
{"verbose", &verboseflag, NOOP}, /* -v */
{"debug", &debugflag, NOOP}, /* -t */
- /* {"help", <print usage stmt>, NOOP}, /* -h */
- /* {"version", <print version number> , NOOP}, /* -V */
+ /* {"help", <print usage stmt>, NOOP},*/ /* -h */
+ /* {"version", <print version number> , NOOP},*/ /* -V */
#endif
{NULL, NULL, ILLEGAL}
Assumes the % has already been read and discarded. */
int
-parse_percent_token ()
+parse_percent_token (void)
{
register int c;
register char *p;