/* Implementation of Fortran lexer
- Copyright (C) 1995-1998 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998, 2001, 2002, 2003
+ Free Software Foundation, Inc.
Contributed by James Craig Burley.
This file is part of GNU Fortran.
#include "lex.h"
#include "malloc.h"
#include "src.h"
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
-#include "flags.j"
-#include "input.j"
-#include "toplev.j"
-#include "tree.j"
-#include "output.j" /* Must follow tree.j so TREE_CODE is defined! */
-#include "ggc.j"
-#endif
-
-#ifdef DWARF_DEBUGGING_INFO
-void dwarfout_resume_previous_source_file (register unsigned);
-void dwarfout_start_new_source_file (register char *);
-void dwarfout_define (register unsigned, register char *);
-void dwarfout_undef (register unsigned, register char *);
-#endif DWARF_DEBUGGING_INFO
+#include "debug.h"
+#include "flags.h"
+#include "input.h"
+#include "toplev.h"
+#include "output.h"
+#include "ggc.h"
static void ffelex_append_to_token_ (char c);
static int ffelex_backslash_ (int c, ffewhereColumnNumber col);
static void ffelex_bad_here_ (int num, ffewhereLineNumber ln0,
ffewhereColumnNumber cn0);
static void ffelex_finish_statement_ (void);
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
static int ffelex_get_directive_line_ (char **text, FILE *finput);
static int ffelex_hash_ (FILE *f);
-#endif
static ffewhereColumnNumber ffelex_image_char_ (int c,
ffewhereColumnNumber col);
static void ffelex_include_ (void);
/* The wf argument of the most recent active ffelex_file_(fixed,free)
function. */
-static ffewhereFile ffelex_current_wf_;
+static GTY (()) ffewhereFile ffelex_current_wf_;
/* TRUE if an INCLUDE statement can be processed (ffelex_set_include
can be called). */
/* Information on the pending INCLUDE file. */
static FILE *ffelex_include_file_;
static bool ffelex_include_free_form_;
-static ffewhereFile ffelex_include_wherefile_;
+static GTY(()) ffewhereFile ffelex_include_wherefile_;
/* Current master line count. */
static ffewhereLineNumber ffelex_linecount_current_;
ffelex_token_->size <<= 1;
assert (ffelex_token_->length < ffelex_token_->size);
}
-#ifdef MAP_CHARACTER
-Sorry, MAP_CHARACTER is not going to work as expected in GNU Fortran,
-please contact fortran@gnu.org if you wish to fund work to
-port g77 to non-ASCII machines.
-#endif
ffelex_token_->text[ffelex_token_->length++] = c;
}
hollerith constants. */
#define wide_flag 0
-#define warn_traditional 0
-#define flag_traditional 0
switch (state)
{
switch (c)
{
case 'x':
- if (warn_traditional)
- {
- ffebad_start_msg_lex ("The meaning of `\\x' (at %0) varies with -traditional",
- FFEBAD_severityWARNING);
- ffelex_bad_here_ (0, line, column);
- ffebad_finish ();
- }
-
- if (flag_traditional)
- return c;
-
code = 0;
count = 0;
nonnull = 0;
return TARGET_BS;
case 'a':
- if (warn_traditional)
- {
- ffebad_start_msg_lex ("The meaning of `\\a' (at %0) varies with -traditional",
- FFEBAD_severityWARNING);
- ffelex_bad_here_ (0, line, column);
- ffebad_finish ();
- }
-
- if (flag_traditional)
- return c;
return TARGET_BELL;
case 'v':
-#if 0 /* Vertical tab is present in common usage compilers. */
- if (flag_traditional)
- return c;
-#endif
return TARGET_VT;
case 'e':
m[0] = c;
m[1] = '\0';
- ffebad_start_msg_lex ("Non-ANSI-C-standard escape sequence `\\%A' at %0",
+ /* xgettext:no-c-format */
+ ffebad_start_msg_lex ("Non-ISO-C-standard escape sequence `\\%A' at %0",
FFEBAD_severityPEDANTIC);
ffelex_bad_here_ (0, line, column);
ffebad_string (m);
m[0] = c;
m[1] = '\0';
+ /* xgettext:no-c-format */
ffebad_start_msg_lex ("Unknown escape sequence `\\%A' at %0",
FFEBAD_severityPEDANTIC);
ffelex_bad_here_ (0, line, column);
}
else if (c == EOF)
{
+ /* xgettext:no-c-format */
ffebad_start_msg_lex ("Unterminated escape sequence `\\' at %0",
FFEBAD_severityPEDANTIC);
ffelex_bad_here_ (0, line, column);
char m[20];
sprintf (&m[0], "%x", c);
+ /* xgettext:no-c-format */
ffebad_start_msg_lex ("Unknown escape sequence `\\' followed by char code 0x%A at %0",
FFEBAD_severityPEDANTIC);
ffelex_bad_here_ (0, line, column);
return c;
case 2:
- if ((c >= 'a' && c <= 'f')
- || (c >= 'A' && c <= 'F')
- || (c >= '0' && c <= '9'))
+ if (ISXDIGIT (c))
{
- code *= 16;
- if (c >= 'a' && c <= 'f')
- code += c - 'a' + 10;
- if (c >= 'A' && c <= 'F')
- code += c - 'A' + 10;
- if (c >= '0' && c <= '9')
- code += c - '0';
+ code = (code * 16) + hex_value (c);
if (code != 0 || count != 0)
{
if (count == 0)
if (! nonnull)
{
+ /* xgettext:no-c-format */
ffebad_start_msg_lex ("\\x used at %0 with no following hex digits",
FFEBAD_severityFATAL);
ffelex_bad_here_ (0, line, column);
&& ((1 << (TYPE_PRECISION (integer_type_node) - (count - 1) * 4))
<= (int) firstdig)))
{
+ /* xgettext:no-c-format */
ffebad_start_msg_lex ("Hex escape at %0 out of range",
FFEBAD_severityPEDANTIC);
ffelex_bad_here_ (0, line, column);
&& TYPE_PRECISION (char_type_node) < HOST_BITS_PER_INT
&& code >= (1 << TYPE_PRECISION (char_type_node)))
{
+ /* xgettext:no-c-format */
ffebad_start_msg_lex ("Escape sequence at %0 out of range for character",
FFEBAD_severityFATAL);
ffelex_bad_here_ (0, line, column);
ffewhere_column_kill (wc0);
}
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
static int
ffelex_getc_ (FILE *finput)
{
return getc (finput);
}
-#endif
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
static int
ffelex_cfebackslash_ (int *use_d, int *d, FILE *finput)
{
switch (c)
{
case 'x':
- if (warn_traditional)
- warning ("the meaning of `\\x' varies with -traditional");
-
- if (flag_traditional)
- return c;
-
code = 0;
count = 0;
nonnull = 0;
while (1)
{
c = getc (finput);
- if (!(c >= 'a' && c <= 'f')
- && !(c >= 'A' && c <= 'F')
- && !(c >= '0' && c <= '9'))
+ if (! ISXDIGIT (c))
{
*use_d = 1;
*d = c;
break;
}
- code *= 16;
- if (c >= 'a' && c <= 'f')
- code += c - 'a' + 10;
- if (c >= 'A' && c <= 'F')
- code += c - 'A' + 10;
- if (c >= '0' && c <= '9')
- code += c - '0';
+ code = (code * 16) + hex_value (c);
if (code != 0 || count != 0)
{
if (count == 0)
return TARGET_BS;
case 'a':
- if (warn_traditional)
- warning ("the meaning of `\\a' varies with -traditional");
-
- if (flag_traditional)
- return c;
return TARGET_BELL;
case 'v':
-#if 0 /* Vertical tab is present in common usage compilers. */
- if (flag_traditional)
- return c;
-#endif
return TARGET_VT;
case 'e':
/* `\%' is used to prevent SCCS from getting confused. */
case '%':
if (pedantic)
- pedwarn ("non-ANSI escape sequence `\\%c'", c);
+ pedwarn ("non-ISO escape sequence `\\%c'", c);
return c;
}
if (c >= 040 && c < 0177)
return c;
}
-#endif
/* A miniature version of the C front-end lexer. */
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
static int
ffelex_cfelex_ (ffelexToken *xtoken, FILE *finput, int c)
{
register unsigned bytes_used = (p - q);
buffer_length *= 2;
- q = (char *)xrealloc (q, buffer_length);
+ if (q == &buff[0])
+ {
+ q = xmalloc (buffer_length);
+ memcpy (q, buff, bytes_used);
+ }
+ else
+ q = xrealloc (q, buffer_length);
p = &q[bytes_used];
r = &q[buffer_length];
}
{
bool done = FALSE;
int use_d = 0;
- int d;
+ int d = 0;
switch (c)
{
case EOF:
case '\n':
- fatal ("Badly formed directive -- no closing quote");
+ error ("badly formed directive -- no closing quote");
done = TRUE;
break;
register unsigned bytes_used = (p - q);
buffer_length = bytes_used * 2;
- q = (char *)xrealloc (q, buffer_length);
+ if (q == &buff[0])
+ {
+ q = xmalloc (buffer_length);
+ memcpy (q, buff, bytes_used);
+ }
+ else
+ q = xrealloc (q, buffer_length);
p = &q[bytes_used];
r = &q[buffer_length];
}
*xtoken = token;
return c;
}
-#endif
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
static void
-ffelex_file_pop_ (char *input_filename)
+ffelex_file_pop_ (const char *filename)
{
if (input_file_stack->next)
{
input_file_stack = p->next;
free (p);
input_file_stack_tick++;
-#ifdef DWARF_DEBUGGING_INFO
- if (debug_info_level == DINFO_LEVEL_VERBOSE
- && write_symbols == DWARF_DEBUG)
- dwarfout_resume_previous_source_file (input_file_stack->line);
-#endif /* DWARF_DEBUGGING_INFO */
+ (*debug_hooks->end_source_file) (input_file_stack->location.line);
}
else
error ("#-lines for entering and leaving files don't match");
/* Now that we've pushed or popped the input stack,
update the name in the top element. */
if (input_file_stack)
- input_file_stack->name = input_filename;
+ input_file_stack->location.file = filename;
}
-#endif
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
static void
-ffelex_file_push_ (int old_lineno, char *input_filename)
+ffelex_file_push_ (int old_lineno, const char *filename)
{
- struct file_stack *p
- = (struct file_stack *) xmalloc (sizeof (struct file_stack));
+ struct file_stack *p = xmalloc (sizeof (struct file_stack));
- input_file_stack->line = old_lineno;
+ input_file_stack->location.line = old_lineno;
p->next = input_file_stack;
- p->name = input_filename;
+ p->location.file = filename;
input_file_stack = p;
input_file_stack_tick++;
-#ifdef DWARF_DEBUGGING_INFO
- if (debug_info_level == DINFO_LEVEL_VERBOSE
- && write_symbols == DWARF_DEBUG)
- dwarfout_start_new_source_file (input_filename);
-#endif /* DWARF_DEBUGGING_INFO */
+
+ (*debug_hooks->start_source_file) (0, filename);
/* Now that we've pushed or popped the input stack,
update the name in the top element. */
if (input_file_stack)
- input_file_stack->name = input_filename;
+ input_file_stack->location.file = filename;
}
-#endif
/* Prepare to finish a statement-in-progress by sending the current
token, if any, then setting up EOS as the current token with the
typical fixed-form cases. */
static void
-ffelex_prepare_eos_ ()
+ffelex_prepare_eos_ (void)
{
if (ffelex_token_->type != FFELEX_typeNONE)
{
}
static void
-ffelex_finish_statement_ ()
+ffelex_finish_statement_ (void)
{
if ((ffelex_number_of_tokens_ == 0)
&& (ffelex_token_->type == FFELEX_typeNONE))
}
}
-/* Copied from gcc/c-common.c get_directive_line. */
+/* Read a preprocessor directive line from file FINPUT. This function
+ returns either '\n' or EOF to indicate success or failure respectively.
+ Upon return, TEXT points to the contents of the line, which is stripped
+ of initial whitespace. The buffer pointed to by TEXT should not be
+ free'd and is overwritten by subsequent calls to this function. */
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
static int
ffelex_get_directive_line_ (char **text, FILE *finput)
{
if (buffer_length == 0)
{
- directive_buffer = (char *)xmalloc (128);
+ directive_buffer = xmalloc (128);
buffer_length = 128;
}
register unsigned bytes_used = (p - directive_buffer);
buffer_length *= 2;
- directive_buffer
- = (char *)xrealloc (directive_buffer, buffer_length);
+ directive_buffer = xrealloc (directive_buffer, buffer_length);
p = &directive_buffer[bytes_used];
buffer_limit = &directive_buffer[buffer_length];
}
|| c == EOF)
{
if (looking_for != 0)
- fatal ("Bad directive -- missing close-quote");
+ error ("bad directive -- missing close-quote");
*p++ = '\0';
*text = directive_buffer;
char_escaped = (c == '\\' && ! char_escaped);
}
}
-#endif
/* Handle # directives that make it through (or are generated by) the
preprocessor. As much as reasonably possible, emulate the behavior
Returns the next character unhandled, which is always newline or EOF. */
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
-
-#if defined HANDLE_PRAGMA
-/* Local versions of these macros, that can be passed as function pointers. */
-static int
-pragma_getc ()
-{
- return getc (finput);
-}
-
-static void
-pragma_ungetc (arg)
- int arg;
-{
- ungetc (arg, finput);
-}
-#endif /* HANDLE_PRAGMA */
-
static int
ffelex_hash_ (FILE *finput)
{
it and ignore it; otherwise, ignore the line, with an error
if the word isn't `pragma', `ident', `define', or `undef'. */
- if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
+ if (ISALPHA(c))
{
if (c == 'p')
{
&& ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'
|| c == EOF))
{
-#if 0 /* g77 doesn't handle pragmas, so ignores them FOR NOW. */
- static char buffer [128];
- char * buff = buffer;
-
- /* Read the pragma name into a buffer.
- ISSPACE() may evaluate its argument more than once! */
- while (((c = getc (finput)), ISSPACE(c)))
- continue;
-
- do
- {
- * buff ++ = c;
- c = getc (finput);
- }
- while (c != EOF && ! ISSPACE (c) && c != '\n'
- && buff < buffer + 128);
-
- pragma_ungetc (c);
-
- * -- buff = 0;
-#ifdef HANDLE_PRAGMA
- if (HANDLE_PRAGMA (pragma_getc, pragma_ungetc, buffer))
- goto skipline;
-#endif /* HANDLE_PRAGMA */
-#ifdef HANDLE_GENERIC_PRAGMAS
- if (handle_generic_pragma (buffer))
- goto skipline;
-#endif /* !HANDLE_GENERIC_PRAGMAS */
-
- /* Issue a warning message if we have been asked to do so.
- Ignoring unknown pragmas in system header file unless
- an explcit -Wunknown-pragmas has been given. */
- if (warn_unknown_pragmas > 1
- || (warn_unknown_pragmas && ! in_system_header))
- warning ("ignoring pragma: %s", token_buffer);
-#endif /* 0 */
goto skipline;
}
}
-
else if (c == 'd')
{
if (getc (finput) == 'e'
c = ffelex_get_directive_line_ (&text, finput);
-#ifdef DWARF_DEBUGGING_INFO
- if ((debug_info_level == DINFO_LEVEL_VERBOSE)
- && (write_symbols == DWARF_DEBUG))
- dwarfout_define (lineno, text);
-#endif /* DWARF_DEBUGGING_INFO */
+ if (debug_info_level == DINFO_LEVEL_VERBOSE)
+ (*debug_hooks->define) (input_line, text);
goto skipline;
}
c = ffelex_get_directive_line_ (&text, finput);
-#ifdef DWARF_DEBUGGING_INFO
- if ((debug_info_level == DINFO_LEVEL_VERBOSE)
- && (write_symbols == DWARF_DEBUG))
- dwarfout_undef (lineno, text);
-#endif /* DWARF_DEBUGGING_INFO */
+ if (debug_info_level == DINFO_LEVEL_VERBOSE)
+ (*debug_hooks->undef) (input_line, text);
goto skipline;
}
&& getc (finput) == 't'
&& ((c = getc (finput)) == ' ' || c == '\t'))
{
- /* #ident. The pedantic warning is now in cccp.c. */
+ /* #ident. The pedantic warning is now in cpp. */
/* Here we have just seen `#ident '.
A string constant should follow. */
if ((token != NULL)
&& (ffelex_token_type (token) == FFELEX_typeNUMBER))
{
- int old_lineno = lineno;
- char *old_input_filename = input_filename;
+ location_t old_loc = input_location;
ffewhereFile wf;
/* subtract one, because it is the following line that
if (c == '\n' || c == EOF)
{
/* No more: store the line number and check following line. */
- lineno = l;
+ input_line = l;
if (!ffelex_kludge_flag_)
{
ffewhere_file_set (NULL, TRUE, (ffewhereLineNumber) l);
goto skipline;
}
- lineno = l;
+ input_line = l;
if (ffelex_kludge_flag_)
- input_filename = ggc_alloc_string (ffelex_token_text (token), -1);
+ input_filename = ggc_strdup (ffelex_token_text (token));
else
{
wf = ffewhere_file_new (ffelex_token_text (token),
{
/* Update the name in the top element of input_file_stack. */
if (input_file_stack)
- input_file_stack->name = input_filename;
+ input_file_stack->location.file = input_filename;
if (token != NULL)
ffelex_token_kill (token);
if (ffelex_kludge_flag_)
{
- lineno = 1;
- input_filename = old_input_filename;
- fatal ("Use `#line ...' instead of `# ...' in first line");
+ input_line = 1;
+ input_filename = old_loc.file;
+ error ("use `#line ...' instead of `# ...' in first line");
}
if (num == 1)
{
/* Pushing to a new file. */
- ffelex_file_push_ (old_lineno, input_filename);
+ ffelex_file_push_ (old_loc.line, input_filename);
}
else if (num == 2)
{
|| (c != '\n' && c != EOF))
&& ffelex_kludge_flag_)
{
- lineno = 1;
- input_filename = old_input_filename;
- fatal ("Use `#line ...' instead of `# ...' in first line");
+ input_line = 1;
+ input_filename = old_loc.file;
+ error ("use `#line ...' instead of `# ...' in first line");
+ }
+ if (c == '\n' || c == EOF)
+ {
+ if (token != NULL && !ffelex_kludge_flag_)
+ ffelex_token_kill (token);
+ return c;
}
}
else
;
return c;
}
-#endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
/* "Image" a character onto the card image, return incremented column number.
ffelex_bad_line_ = TRUE;
strcpy (&ffelex_card_image_[column], "[\\0]");
ffelex_card_length_ = column + 4;
+ /* xgettext:no-c-format */
ffebad_start_msg_lex ("Null character at %0 -- line ignored",
FFEBAD_severityFATAL);
ffelex_bad_here_ (0, ffelex_linecount_current_, column + 1);
}
static void
-ffelex_include_ ()
+ffelex_include_ (void)
{
ffewhereFile include_wherefile = ffelex_include_wherefile_;
FILE *include_file = ffelex_include_file_;
ffewhereLineNumber linecount_current = ffelex_linecount_current_;
ffewhereLineNumber linecount_offset
= ffewhere_line_filelinenum (current_wl);
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
- int old_lineno = lineno;
- char *old_input_filename = input_filename;
-#endif
+ location_t old_loc = input_location;
if (card_length != 0)
{
ffewhere_file_set (include_wherefile, TRUE, 0);
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
- ffelex_file_push_ (old_lineno, ffewhere_file_name (include_wherefile));
-#endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
+ ffelex_file_push_ (old_loc.line, ffewhere_file_name (include_wherefile));
if (ffelex_include_free_form_)
ffelex_file_free (include_wherefile, include_file);
else
ffelex_file_fixed (include_wherefile, include_file);
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
ffelex_file_pop_ (ffewhere_file_name (current_wf));
-#endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
ffewhere_file_set (current_wf, TRUE, linecount_offset);
if (card_length != 0)
{
-#ifdef REDUCE_CARD_SIZE_AFTER_BIGGY /* Define if occasional large lines. */
-#error "need to handle possible reduction of card size here!!"
-#endif
assert (ffelex_card_size_ >= card_length); /* It shrunk?? */
memcpy (ffelex_card_image_, card_image, card_length);
}
ffelex_card_image_[card_length] = '\0';
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
- input_filename = old_input_filename;
- lineno = old_lineno;
-#endif
+ input_location = old_loc;
ffelex_linecount_current_ = linecount_current;
ffelex_current_wf_ = current_wf;
ffelex_final_nontab_column_ = final_nontab_column;
}
static void
-ffelex_next_line_ ()
+ffelex_next_line_ (void)
{
ffelex_linecount_current_ = ffelex_linecount_next_;
++ffelex_linecount_next_;
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
- ++lineno;
-#endif
+ ++input_line;
}
static void
-ffelex_send_token_ ()
+ffelex_send_token_ (void)
{
++ffelex_number_of_tokens_;
}
static ffelexToken
-ffelex_token_new_ ()
+ffelex_token_new_ (void)
{
ffelexToken t;
++ffelex_total_tokens_;
- t = (ffelexToken) malloc_new_ks (malloc_pool_image (),
- "FFELEX token", sizeof (*t));
+ t = malloc_new_ks (malloc_pool_image (), "FFELEX token", sizeof (*t));
t->id_ = ffelex_token_nextid_++;
return t;
}
static const char *
ffelex_type_string_ (ffelexType type)
{
- static const char *types[] = {
+ static const char *const types[] = {
"FFELEX_typeNONE",
"FFELEX_typeCOMMENT",
"FFELEX_typeEOS",
return FALSE. */
bool
-ffelex_expecting_character ()
+ffelex_expecting_character (void)
{
return (ffelex_raw_mode_ != 0);
}
assert (ffelex_handler_ != NULL);
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
- lineno = 0;
+ input_line = 0;
input_filename = ffewhere_file_name (wf);
-#endif
ffelex_current_wf_ = wf;
disallow_continuation_line = TRUE;
ignore_disallowed_continuation = FALSE;
ffelex_current_wc_ = ffewhere_column_unknown ();
latest_char_in_file = '\n';
- if (ffe_is_null_version ())
- {
- /* Just substitute a "program" directly here. */
-
- char line[] = " call g77__fvers;call g77__ivers;call g77__uvers;end";
- char *p;
-
- column = 0;
- for (p = &line[0]; *p != '\0'; ++p)
- column = ffelex_image_char_ (*p, column);
-
- c = EOF;
-
- goto have_line; /* :::::::::::::::::::: */
- }
-
goto first_line; /* :::::::::::::::::::: */
/* Come here to get a new line. */
beginning_of_line_again: /* :::::::::::::::::::: */
-#ifdef REDUCE_CARD_SIZE_AFTER_BIGGY /* Define if occasional large lines. */
- if (ffelex_card_size_ != FFELEX_columnINITIAL_SIZE_)
- {
- ffelex_card_image_
- = malloc_resize_ks (malloc_pool_image (),
- ffelex_card_image_,
- FFELEX_columnINITIAL_SIZE_ + 9,
- ffelex_card_size_ + 9);
- ffelex_card_size_ = FFELEX_columnINITIAL_SIZE_;
- }
-#endif
-
first_line: /* :::::::::::::::::::: */
c = latest_char_in_file;
while ((c != '\n') && (c != EOF))
c = getc (f);
}
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
else if (lextype == FFELEX_typeHASH)
c = ffelex_hash_ (f);
-#endif
else if (lextype == FFELEX_typeSLASH)
{
/* SIDE-EFFECT ABOVE HAS HAPPENED. */
column = ffelex_final_nontab_column_;
}
- have_line: /* :::::::::::::::::::: */
-
ffelex_card_image_[column] = '\0';
ffelex_card_length_ = column;
assert (ffelex_handler_ != NULL);
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
- lineno = 0;
+ input_line = 0;
input_filename = ffewhere_file_name (wf);
-#endif
ffelex_current_wf_ = wf;
continuation_line = FALSE;
ffelex_token_->type = FFELEX_typeNONE;
|| (c == '#'))
{
if (c == '#')
- {
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
- c = ffelex_hash_ (f);
-#else
- /* Don't skip over # line after all. */
- break;
-#endif
- }
+ c = ffelex_hash_ (f);
comment_line: /* :::::::::::::::::::: */
/* See the code in com.c that calls this to understand why. */
-#if FFECOM_targetCURRENT == FFECOM_targetGCC
void
ffelex_hash_kludge (FILE *finput)
{
/* If you change this constant string, you have to change whatever
code might thus be affected by it in terms of having to use
ffelex_getc_() instead of getc() in the lexers and _hash_. */
- static char match[] = "# 1 \"";
+ static const char match[] = "# 1 \"";
static int kludge[ARRAY_SIZE (match) + 1];
int c;
- char *p;
+ const char *p;
int *q;
/* Read chars as long as they match the target string.
}
}
-#endif
void
-ffelex_init_1 ()
+ffelex_init_1 (void)
{
unsigned int i;
Must be called while lexer is active, obviously. */
bool
-ffelex_is_names_expected ()
+ffelex_is_names_expected (void)
{
return ffelex_names_;
}
ffelex_linecount_current_. */
char *
-ffelex_line ()
+ffelex_line (void)
{
return ffelex_card_image_;
}
Must be called while lexer is active, obviously. */
ffewhereColumnNumber
-ffelex_line_length ()
+ffelex_line_length (void)
{
return ffelex_card_length_;
}
is current. */
ffewhereLineNumber
-ffelex_line_number ()
+ffelex_line_number (void)
{
return ffelex_linecount_current_;
}
/* Make a new EOF token right after end of file. */
ffelexToken
-ffelex_token_new_eof ()
+ffelex_token_new_eof (void)
{
ffelexToken t;
t->uses++;
return t;
}
+
+#include "gt-f-lex.h"