File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,13 @@ static bool is_number_body_char(char c) {
205205Token lexer_next_token (Lexer * lexer ) {
206206 while (!is_at_end (lexer )) {
207207 char c = peek (lexer );
208+ unsigned char uc = (unsigned char )c ;
209+ if (uc > 0x7F ) {
210+ char msg [128 ];
211+ snprintf (msg , sizeof (msg ), "Non-ASCII character in source; raw non-ASCII is disallowed" );
212+ advance (lexer );
213+ return error_token (lexer , msg );
214+ }
208215
209216 if (c == ' ' || c == '\t' ) {
210217 advance (lexer );
@@ -332,6 +339,11 @@ static Token string_token(Lexer* lexer, char quote_char) {
332339
333340 while (!is_at_end (lexer )) {
334341 char c = peek (lexer );
342+ unsigned char uc = (unsigned char )c ;
343+ if (uc > 0x7F ) {
344+ free (value );
345+ return error_token (lexer , "Non-ASCII character in string literal; use escape sequences" );
346+ }
335347
336348 if (c == quote_char ) {
337349 advance (lexer );
You can’t perform that action at this time.
0 commit comments