File tree Expand file tree Collapse file tree 2 files changed +29
-13
lines changed Expand file tree Collapse file tree 2 files changed +29
-13
lines changed Original file line number Diff line number Diff line change @@ -504,24 +504,33 @@ inline const char * dequote(char * str)
504
504
505
505
inline char * strqchr (const char * str, char key)
506
506
{
507
- while (*str)
507
+ while (*str != ' \0 ' )
508
508
{
509
- if (*str==' "' )
509
+ if (*str == key) { return const_cast <char *>(str); }
510
+ else if (*str == ' "' || *str == ' \' ' )
510
511
{
511
- str++;
512
- while (*str!=' "' )
512
+ // Special case hack for ''', which is currently our official way of handling the ' character.
513
+ // Even though it really stinks.
514
+ if (str[0 ] == ' \' ' && str[1 ] == ' \' ' && str[2 ] == ' \' ' ) { str += 2 ; }
515
+ else
513
516
{
514
- if (!*str) return nullptr ;
515
- str++;
517
+ char delimiter = *str;
518
+
519
+ do
520
+ {
521
+ str++;
522
+
523
+ // If we want to support backslash escapes, we'll have to add that right here.
524
+ } while (*str != delimiter && *str != ' \0 ' );
525
+
526
+ // This feels like a superfluous check, but I can't really find a clean way to avoid it.
527
+ if (*str == ' \0 ' ) { return nullptr ; }
516
528
}
517
- str++;
518
- }
519
- else
520
- {
521
- if (*str==key) return const_cast <char *>(str);
522
- str++;
523
529
}
530
+
531
+ str++;
524
532
}
533
+
525
534
return nullptr ;
526
535
}
527
536
Original file line number Diff line number Diff line change 7
7
;`10 20 30 10
8
8
;`11 21 31 11
9
9
;`42 42
10
+ ;`43 43
10
11
11
12
org $ 008000
12
13
@@ -24,6 +25,12 @@ db "test"
24
25
db 't' , 'e' , 's' , 't'
25
26
db 't' + 1 , 'e' + 1 , 's' + 1 , 't' + 1
26
27
27
- '' ' = $ 42
28
+ '' ' = $ 42 ; Comment after actual line
29
+ ; ''' = $44 ; This line is a comment and should be ignored
28
30
db "' "
29
31
db '' '
32
+
33
+ ';' = $ 43 ; Comment after actual line
34
+ ; ';' = $45 ; This line is a comment and should be ignored
35
+ db ";"
36
+ db ';'
You can’t perform that action at this time.
0 commit comments