Skip to content
Myr

stb_c_lexer: fix NUL eof test so it compiles

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sean Barrett · committed by Sean Barrett · parent 08e4b18 · Browse files · 2 files+49 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+49 added−2 removed

  • tests:+48 added−1 removed
  • other:+1 added−1 removed

2 files+49 added−2 removed

modified:tests/test_cpp_compilation.cpp+48 added-1 removed
5 unmodified lines
6#include "stb_truetype.h"7#include "stb_image_write.h"8#include "stb_perlin.h"9#include "stb_dxt.h"10#include "stb_c_lexer.h"10#include "stb_divide.h"11#include "stb_herringbone_wang_tile.h"12#include "stb_ds.h"13#include "stb_hexwave.h"
167 unmodified lines
181 stb_textedit_key(0,0,0);182 stb_textedit_initialize_state(0,0);183 stb_textedit_paste(0,0,0,0);184}185186#define STB_C_LEX_C_DECIMAL_INTS Y // "0|[1-9][0-9]*" CLEX_intlit187#define STB_C_LEX_C_HEX_INTS Y // "0x[0-9a-fA-F]+" CLEX_intlit188#define STB_C_LEX_C_OCTAL_INTS Y // "[0-7]+" CLEX_intlit189#define STB_C_LEX_C_DECIMAL_FLOATS Y // "[0-9]*(.[0-9]*([eE][-+]?[0-9]+)?) CLEX_floatlit190#define STB_C_LEX_C99_HEX_FLOATS N // "0x{hex}+(.{hex}*)?[pP][-+]?{hex}+ CLEX_floatlit191#define STB_C_LEX_C_IDENTIFIERS Y // "[_a-zA-Z][_a-zA-Z0-9]*" CLEX_id192#define STB_C_LEX_C_DQ_STRINGS Y // double-quote-delimited strings with escapes CLEX_dqstring193#define STB_C_LEX_C_SQ_STRINGS N // single-quote-delimited strings with escapes CLEX_ssstring194#define STB_C_LEX_C_CHARS Y // single-quote-delimited character with escape CLEX_charlits195#define STB_C_LEX_C_COMMENTS Y // "/* comment */"196#define STB_C_LEX_CPP_COMMENTS Y // "// comment to end of line\n"197#define STB_C_LEX_C_COMPARISONS Y // "==" CLEX_eq "!=" CLEX_noteq "<=" CLEX_lesseq ">=" CLEX_greatereq198#define STB_C_LEX_C_LOGICAL Y // "&&" CLEX_andand "||" CLEX_oror199#define STB_C_LEX_C_SHIFTS Y // "<<" CLEX_shl ">>" CLEX_shr200#define STB_C_LEX_C_INCREMENTS Y // "++" CLEX_plusplus "--" CLEX_minusminus201#define STB_C_LEX_C_ARROW Y // "->" CLEX_arrow202#define STB_C_LEX_EQUAL_ARROW N // "=>" CLEX_eqarrow203#define STB_C_LEX_C_BITWISEEQ Y // "&=" CLEX_andeq "|=" CLEX_oreq "^=" CLEX_xoreq204#define STB_C_LEX_C_ARITHEQ Y // "+=" CLEX_pluseq "-=" CLEX_minuseq205 // "*=" CLEX_muleq "/=" CLEX_diveq "%=" CLEX_modeq206 // if both STB_C_LEX_SHIFTS & STB_C_LEX_ARITHEQ:207 // "<<=" CLEX_shleq ">>=" CLEX_shreq208209#define STB_C_LEX_PARSE_SUFFIXES N // letters after numbers are parsed as part of those numbers, and must be in suffix list below210#define STB_C_LEX_DECIMAL_SUFFIXES "" // decimal integer suffixes e.g. "uUlL" -- these are returned as-is in string storage211#define STB_C_LEX_HEX_SUFFIXES "" // e.g. "uUlL"212#define STB_C_LEX_OCTAL_SUFFIXES "" // e.g. "uUlL"213#define STB_C_LEX_FLOAT_SUFFIXES "" //214215#define STB_C_LEX_0_IS_EOF Y // if Y, ends parsing at '\0'; if N, returns '\0' as token216#define STB_C_LEX_INTEGERS_AS_DOUBLES N // parses integers as doubles so they can be larger than 'int', but only if STB_C_LEX_STDLIB==N217#define STB_C_LEX_MULTILINE_DSTRINGS N // allow newlines in double-quoted strings218#define STB_C_LEX_MULTILINE_SSTRINGS N // allow newlines in single-quoted strings219#define STB_C_LEX_USE_STDLIB Y // use strtod,strtol for parsing #s; otherwise inaccurate hack220#define STB_C_LEX_DOLLAR_IDENTIFIER Y // allow $ as an identifier character221#define STB_C_LEX_FLOAT_NO_DECIMAL Y // allow floats that have no decimal point if they have an exponent222223#define STB_C_LEX_DEFINE_ALL_TOKEN_NAMES N // if Y, all CLEX_ token names are defined, even if never returned224 // leaving it as N should help you catch config bugs225226#define STB_C_LEX_DISCARD_PREPROCESSOR Y // discard C-preprocessor directives (e.g. after prepocess227 // still have #line, #pragma, etc)228229//#define STB_C_LEX_ISWHITE(str) ... // return length in bytes of whitespace characters if first char is whitespace230231#define STB_C_LEXER_DEFINITIONS // This line prevents the header file from replacing your definitions232#include "stb_c_lexer.h"
modified:stb_c_lexer.h+1 added-1 removed
606 unmodified lines
607608 // check for EOF609 STB_C_LEX_0_IS_EOF(610 if (*p == 0)611 return stb__clex_eof(tok);611 return stb__clex_eof(lexer);612 )613614 single_char:615 // not an identifier, return the character as itself
351 unmodified lines