Text-CPP
view release on metacpan or search on metacpan
pfile->cur_run = next_tokenrun (pfile->cur_run);
pfile->cur_token = pfile->cur_run->base;
}
if (pfile->lookaheads)
{
pfile->lookaheads--;
result = pfile->cur_token++;
}
else
result = _cpp_lex_direct (pfile);
if (result->flags & BOL)
{
/* Is this a directive. If _cpp_handle_directive returns
false, it is an assembler #. */
if (result->type == CPP_HASH
/* 6.10.3 p 11: Directives in a list of macro arguments
gives undefined behavior. This implementation
handles the directive as normal. */
&& pfile->state.parsing_args != 1
&& _cpp_handle_directive (pfile, result->flags & PREV_WHITE))
continue;
if (pfile->cb.line_change && !pfile->state.skipping)
(*pfile->cb.line_change)(pfile, result, pfile->state.parsing_args);
}
/* We don't skip tokens in directives. */
if (pfile->state.in_directive)
break;
/* Outside a directive, invalidate controlling macros. At file
EOF, _cpp_lex_direct takes care of popping the buffer, so we never
get here and MI optimisation works. */
pfile->mi_valid = false;
if (!pfile->state.skipping || result->type == CPP_EOF)
break;
}
return result;
}
/* A NUL terminates the current buffer. For ISO preprocessing this is
EOF, but for traditional preprocessing it indicates we need a line
refill. Returns TRUE to continue preprocessing a new buffer, FALSE
to return a CPP_EOF to the caller. */
static bool
continue_after_nul (pfile)
cpp_reader *pfile;
{
cpp_buffer *buffer = pfile->buffer;
bool more = false;
buffer->saved_flags = BOL;
if (CPP_OPTION (pfile, traditional))
{
if (pfile->state.in_directive)
return false;
_cpp_remove_overlay (pfile);
more = _cpp_read_logical_line_trad (pfile);
_cpp_overlay_buffer (pfile, pfile->out.base,
pfile->out.cur - pfile->out.base);
pfile->line = pfile->out.first_line;
}
else
{
/* Stop parsing arguments with a CPP_EOF. When we finally come
back here, do the work of popping the buffer. */
if (!pfile->state.parsing_args)
{
if (buffer->cur != buffer->line_base)
{
/* Non-empty files should end in a newline. Don't warn
for command line and _Pragma buffers. */
if (!buffer->from_stage3)
cpp_error (pfile, DL_PEDWARN, "no newline at end of file");
handle_newline (pfile);
}
/* Similarly, finish an in-progress directive with CPP_EOF
before popping the buffer. */
if (!pfile->state.in_directive && buffer->prev)
{
more = !buffer->return_at_eof;
_cpp_pop_buffer (pfile);
}
}
}
return more;
}
#define IF_NEXT_IS(CHAR, THEN_TYPE, ELSE_TYPE) \
do { \
if (get_effective_char (pfile) == CHAR) \
result->type = THEN_TYPE; \
else \
{ \
BACKUP (); \
result->type = ELSE_TYPE; \
} \
} while (0)
/* Lex a token into pfile->cur_token, which is also incremented, to
get diagnostics pointing to the correct location.
Does not handle issues such as token lookahead, multiple-include
optimisation, directives, skipping etc. This function is only
suitable for use by _cpp_lex_token, and in special cases like
lex_expansion_token which doesn't care for any of these issues.
When meeting a newline, returns CPP_EOF if parsing a directive,
otherwise returns to the start of the token buffer if permissible.
Returns the location of the lexed token. */
cpp_token *
_cpp_lex_direct (pfile)
cpp_reader *pfile;
{
cppchar_t c;
cpp_buffer *buffer;
const unsigned char *comment_start;
( run in 1.109 second using v1.01-cache-2.11-cpan-39bf76dae61 )