mojoshader_preprocessor.c
changeset 693 0cdfff18820c
parent 692 08a5fca606ff
child 698 a6cd16b3e270
equal deleted inserted replaced
692:08a5fca606ff 693:0cdfff18820c
  1788         {
  1788         {
  1789             if (handle_pp_identifier(ctx))
  1789             if (handle_pp_identifier(ctx))
  1790                 continue;  // pushed the include_stack.
  1790                 continue;  // pushed the include_stack.
  1791         } // else if
  1791         } // else if
  1792 
  1792 
       
  1793         else if (token == ((Token) '\n'))
       
  1794         {
       
  1795             // preprocessor is line-oriented, nothing else gets newlines.
       
  1796             continue;  // get the next thing.
       
  1797         } // else if
       
  1798 
  1793         assert(!skipping);
  1799         assert(!skipping);
  1794         *_token = token;
  1800         *_token = token;
  1795         *_len = state->tokenlen;
  1801         *_len = state->tokenlen;
  1796         return state->token;
  1802         return state->token;
  1797     } // while
  1803     } // while
  1945 
  1951 
  1946         // Microsoft's preprocessor is weird.
  1952         // Microsoft's preprocessor is weird.
  1947         // It ignores newlines, and then inserts its own around certain
  1953         // It ignores newlines, and then inserts its own around certain
  1948         //  tokens. For example, after a semicolon. This allows HLSL code to
  1954         //  tokens. For example, after a semicolon. This allows HLSL code to
  1949         //  be mostly readable, instead of a stream of tokens.
  1955         //  be mostly readable, instead of a stream of tokens.
  1950         if (token == ((Token) '\n'))
  1956         if ( (token == ((Token) '}')) || (token == ((Token) ';')) )
  1951             isnewline = nl;  // this doesn't actually care about '\n' ...
       
  1952 
       
  1953         else if ( (token == ((Token) '}')) || (token == ((Token) ';')) )
       
  1954         {
  1957         {
  1955             if (!out_of_memory)
  1958             if (!out_of_memory)
  1956             {
  1959             {
  1957                 if ( (token == ((Token) '}')) && (indent > 0) )
  1960                 if ( (token == ((Token) '}')) && (indent > 0) )
  1958                     indent--;
  1961                     indent--;