Skip to content

Commit

Permalink
Preprocessor now traps newlines.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Feb 24, 2009
1 parent 14ebc92 commit c21579c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions mojoshader_preprocessor.c
Expand Up @@ -1790,6 +1790,12 @@ static inline const char *_preprocessor_nexttoken(Preprocessor *_ctx,
continue; // pushed the include_stack.
} // else if

else if (token == ((Token) '\n'))
{
// preprocessor is line-oriented, nothing else gets newlines.
continue; // get the next thing.
} // else if

assert(!skipping);
*_token = token;
*_len = state->tokenlen;
Expand Down Expand Up @@ -1947,10 +1953,7 @@ const MOJOSHADER_preprocessData *MOJOSHADER_preprocess(const char *filename,
// It ignores newlines, and then inserts its own around certain
// tokens. For example, after a semicolon. This allows HLSL code to
// be mostly readable, instead of a stream of tokens.
if (token == ((Token) '\n'))
isnewline = nl; // this doesn't actually care about '\n' ...

else if ( (token == ((Token) '}')) || (token == ((Token) ';')) )
if ( (token == ((Token) '}')) || (token == ((Token) ';')) )
{
if (!out_of_memory)
{
Expand Down

0 comments on commit c21579c

Please sign in to comment.