aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpphash.h
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2001-09-11 07:00:12 +0000
committerNeil Booth <neil@gcc.gnu.org>2001-09-11 07:00:12 +0000
commit5fddcffc8aa65cbf1695d95605a19b4d5d8f43a7 (patch)
tree943c0f0881bcaf2f5425616b1754f072979eb4b6 /gcc/cpphash.h
parent75dcd8fe99a9b22bf81705c4c898241b042c0873 (diff)
downloadgcc-5fddcffc8aa65cbf1695d95605a19b4d5d8f43a7.zip
gcc-5fddcffc8aa65cbf1695d95605a19b4d5d8f43a7.tar.gz
gcc-5fddcffc8aa65cbf1695d95605a19b4d5d8f43a7.tar.bz2
cpphash.h (struct tokenrun): New.
* cpphash.h (struct tokenrun): New. (struct cpp_context): New member bol. (struct cpp_reader): New members. (_cpp_init_tokenrun): New. * cppinit.c (cpp_create_reader): Set up the token runs. * cpplex.c (lex_directive, lex_token, next_tokenrun): New. (lex_token): New internalised version of _cpp_lex_token. Don't handle directives or the multiple include opimisation here any more. Simply lex a token. * cpplib.c (run_directive): Clear bol. (_cpp_pop_buffer): Set bol. * cppmacro.c (funlike_invocation_p): Keep tokens whilst parsing arguments. From-SVN: r45534
Diffstat (limited to 'gcc/cpphash.h')
-rw-r--r--gcc/cpphash.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/cpphash.h b/gcc/cpphash.h
index a313683..4224e91 100644
--- a/gcc/cpphash.h
+++ b/gcc/cpphash.h
@@ -102,6 +102,13 @@ struct toklist
cpp_token *limit;
};
+typedef struct tokenrun tokenrun;
+struct tokenrun
+{
+ tokenrun *next;
+ cpp_token *base, *limit;
+};
+
typedef struct cpp_context cpp_context;
struct cpp_context
{
@@ -124,6 +131,9 @@ struct lexer_state
/* True if we are skipping a failed conditional group. */
unsigned char skipping;
+ /* Nonzero if next token is the start of a line. */
+ unsigned char bol;
+
/* Nonzero if in a directive that takes angle-bracketed headers. */
unsigned char angled_headers;
@@ -258,6 +268,13 @@ struct cpp_reader
const cpp_hashnode *mi_ind_cmacro;
bool mi_valid;
+ /* Lexing. */
+ cpp_token *cur_token;
+ tokenrun base_run, *cur_run;
+
+ /* Non-zero prevents the lexer from re-using the token runs. */
+ unsigned int keep_tokens;
+
/* Token lookahead. */
struct cpp_lookahead *la_read; /* Read from this lookahead. */
struct cpp_lookahead *la_write; /* Write to this lookahead. */
@@ -397,6 +414,7 @@ extern int _cpp_parse_expr PARAMS ((cpp_reader *));
extern void _cpp_lex_token PARAMS ((cpp_reader *, cpp_token *));
extern int _cpp_equiv_tokens PARAMS ((const cpp_token *,
const cpp_token *));
+extern void _cpp_init_tokenrun PARAMS ((tokenrun *, unsigned int));
extern void _cpp_init_pool PARAMS ((cpp_pool *, unsigned int,
unsigned int, unsigned int));
extern void _cpp_free_pool PARAMS ((cpp_pool *));