Skip to content

Commit

Permalink
Allow debug output directly from the lexer, before preprocessor eats.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Feb 15, 2009
1 parent 2257cf1 commit 3fb7c25
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mojoshader_internal.h
Expand Up @@ -19,9 +19,11 @@

#include "mojoshader.h"

#define DEBUG_LEXER 0
#define DEBUG_PREPROCESSOR 0
#define DEBUG_ASSEMBLY_PARSER 0
#define DEBUG_TOKENIZER ((DEBUG_PREPROCESSOR) || (DEBUG_ASSEMBLY_PARSER))
#define DEBUG_TOKENIZER \
(DEBUG_PREPROCESSOR || DEBUG_ASSEMBLY_PARSER || DEBUG_LEXER)

#if (defined(__APPLE__) && defined(__MACH__))
#define PLATFORM_MACOSX 1
Expand Down
12 changes: 12 additions & 0 deletions mojoshader_preprocessor.c
Expand Up @@ -17,6 +17,18 @@
#define print_debug_token(token, len, val)
#endif

#if DEBUG_LEXER
static Token debug_preprocessor_internal_lexer(IncludeState *s)
{
const Token retval = preprocessor_internal_lexer(s);
MOJOSHADER_print_debug_token("LEXER", s->token,
(unsigned int) (s->source - s->token),
retval);
return retval;
} // debug_preprocessor_internal_lexer
#define preprocessor_internal_lexer(s) debug_preprocessor_internal_lexer(s)
#endif

typedef struct DefineHash
{
MOJOSHADER_preprocessorDefine define;
Expand Down

0 comments on commit 3fb7c25

Please sign in to comment.