if (ch == '/')
{
/* one line comment */
- haswhite = true;
ch = lex_getch(lex);
if (lex->flags.preprocessing) {
+ haswhite = true;
if (!lex_tokench(lex, '/') ||
!lex_tokench(lex, '/'))
{
if (ch == '*')
{
/* multiline comment */
- haswhite = true;
if (lex->flags.preprocessing) {
+ haswhite = true;
if (!lex_tokench(lex, '/') ||
!lex_tokench(lex, '*'))
{
if (ch == quote)
return TOKEN_STRINGCONST;
- if (ch == '\\') {
+ if (!lex->flags.preprocessing && ch == '\\') {
ch = lex_getch(lex);
if (ch == EOF) {
lexerror(lex, "unexpected end of file");
if (ch == '"')
{
lex->flags.nodigraphs = true;
+ if (lex->flags.preprocessing && !lex_tokench(lex, ch))
+ return TOKEN_FATAL;
lex->tok.ttype = lex_finish_string(lex, '"');
- while (lex->tok.ttype == TOKEN_STRINGCONST)
+ if (lex->flags.preprocessing && !lex_tokench(lex, ch))
+ return TOKEN_FATAL;
+ while (!lex->flags.preprocessing && lex->tok.ttype == TOKEN_STRINGCONST)
{
/* Allow c style "string" "continuation" */
ch = lex_skipwhite(lex);
* Likewise actual unescaping has to be done by the parser.
* The difference is we don't allow 'char' 'continuation'.
*/
- lex->tok.ttype = lex_finish_string(lex, '\'');
- if (!lex_endtoken(lex))
- return (lex->tok.ttype = TOKEN_FATAL);
+ if (lex->flags.preprocessing && !lex_tokench(lex, ch))
+ return TOKEN_FATAL;
+ lex->tok.ttype = lex_finish_string(lex, '\'');
+ if (lex->flags.preprocessing && !lex_tokench(lex, ch))
+ return TOKEN_FATAL;
+ if (!lex_endtoken(lex))
+ return (lex->tok.ttype = TOKEN_FATAL);
/* It's a vector if we can successfully scan 3 floats */
#ifdef WIN32
- if (sscanf_s(lex->tok.value, " %f %f %f ",
- &lex->tok.constval.v.x, &lex->tok.constval.v.y, &lex->tok.constval.v.z) == 3)
+ if (sscanf_s(lex->tok.value, " %f %f %f ",
+ &lex->tok.constval.v.x, &lex->tok.constval.v.y, &lex->tok.constval.v.z) == 3)
#else
- if (sscanf(lex->tok.value, " %f %f %f ",
- &lex->tok.constval.v.x, &lex->tok.constval.v.y, &lex->tok.constval.v.z) == 3)
+ if (sscanf(lex->tok.value, " %f %f %f ",
+ &lex->tok.constval.v.x, &lex->tok.constval.v.y, &lex->tok.constval.v.z) == 3)
#endif
- {
- lex->tok.ttype = TOKEN_VECTORCONST;
- }
+ {
+ lex->tok.ttype = TOKEN_VECTORCONST;
+ }
- return lex->tok.ttype;
+ return lex->tok.ttype;
}
if (isdigit(ch))