mojoshader_preprocessor.c
changeset 941 405a57d342a1
parent 940 bc2a5efade5e
child 944 9f9fa9650772
equal deleted inserted replaced
940:bc2a5efade5e 941:405a57d342a1
  1754 //  identifiers that aren't resolved as macros become zero. Anything we
  1754 //  identifiers that aren't resolved as macros become zero. Anything we
  1755 //  don't explicitly expect becomes a parsing error.
  1755 //  don't explicitly expect becomes a parsing error.
  1756 // returns 1 (true), 0 (false), or -1 (error)
  1756 // returns 1 (true), 0 (false), or -1 (error)
  1757 static int reduce_pp_expression(Context *ctx)
  1757 static int reduce_pp_expression(Context *ctx)
  1758 {
  1758 {
       
  1759     IncludeState *orig_state = ctx->include_stack;
  1759     RpnTokens output[128];
  1760     RpnTokens output[128];
  1760     Token stack[64];
  1761     Token stack[64];
  1761     Token previous_token = TOKEN_UNKNOWN;
  1762     Token previous_token = TOKEN_UNKNOWN;
  1762     size_t outputsize = 0;
  1763     size_t outputsize = 0;
  1763     size_t stacksize = 0;
  1764     size_t stacksize = 0;
  1799             ctx->recursion_count = 0;
  1800             ctx->recursion_count = 0;
  1800 
  1801 
  1801         switch (token)
  1802         switch (token)
  1802         {
  1803         {
  1803             case TOKEN_EOI:
  1804             case TOKEN_EOI:
       
  1805                 if (state != orig_state)  // end of a substate, or the expr?
       
  1806                 {
       
  1807                     pop_source(ctx);
       
  1808                     continue;  // substate, go again with the parent state.
       
  1809                 } // if
       
  1810                 done = 1;  // the expression itself is done.
       
  1811                 break;
       
  1812 
  1804             case ((Token) '\n'):
  1813             case ((Token) '\n'):
  1805                 done = 1;
  1814                 done = 1;
  1806                 break;  // we're done!
  1815                 break;  // we're done!
  1807 
  1816 
  1808             case TOKEN_IDENTIFIER:
  1817             case TOKEN_IDENTIFIER: