|
14 | 14 | * |
15 | 15 | * History |
16 | 16 | * |
| 17 | + * bengsig 25-may-2023 - Use rwlscanstring.c |
17 | 18 | * bengsig 15-may-2023 - statisticsonly |
18 | 19 | * bengsig 8-mar-2023 - Normal Distributed random |
19 | 20 | * bengsig 9-jan-2023 - CQN Project |
|
49 | 50 |
|
50 | 51 | #define YYSTYPE RWLZSTYPE |
51 | 52 | #define YY_DECL sb4 rwlzlex(void *yylval_param, void *yyscanner) |
| 53 | +#define RWL_IN_DILEX // make rwlscanstring.c do the right thing |
52 | 54 |
|
53 | 55 | %} |
54 | 56 |
|
|
64 | 66 | } |
65 | 67 |
|
66 | 68 | /*LEXTAG:RWL_Z_STRING_CONST*/ |
67 | | -\"(\\.|[^\\"])*\" { // mostly like rwllexer.l |
68 | | - text *in, *ut; |
69 | | - /* copy string and remove " at ends */ |
70 | | - rwm->sval = rwlstrdup(rwm, (text *)yytext+1); |
71 | | - if ('"' == yytext[yyleng-1]) |
72 | | - { |
73 | | - rwm->sval[yyleng-2] = 0; |
74 | | - } |
75 | | - /* handle \ escapes */ |
76 | | - for (ut=in=rwm->sval; *in; ut++, in++) |
77 | | - { |
78 | | - if ('\n' == *in) |
79 | | - rwm->loc.lineno++; |
80 | | - if (*in == '\\') |
81 | | - { |
82 | | - in++; |
83 | | - switch (*in) |
84 | | - { |
85 | | - case '\\': *ut='\\'; break; |
86 | | - case '\"': *ut='\"'; break; |
87 | | - case 'n': *ut='\n'; break; |
88 | | - case 't': *ut='\t'; break; |
89 | | - case 'r': *ut='\r'; break; |
90 | | - case 'e': *ut='\e'; break; |
91 | | - case 0: goto end_of_string; |
92 | | - default: |
93 | | - *ut= *in; |
94 | | - rwlerror(rwm, RWL_ERROR_INVALID_ESCAPE_NO_POS, *in); |
95 | | - break; |
96 | | - } |
97 | | - } |
98 | | - else |
99 | | - *ut = *in; |
100 | | - } |
101 | | - end_of_string: |
102 | | - *ut = 0; |
103 | | - rwm->slen = rwlstrlen(rwm->sval); |
104 | | - if (rwm->slen>RWL_MAX_STRING_LENGTH) |
105 | | - { |
106 | | - rwlerror(rwm, RWL_ERROR_STRING_TOO_LONG, RWL_MAX_STRING_LENGTH); |
107 | | - rwm->slen=RWL_MAX_STRING_LENGTH; |
108 | | - rwm->sval[rwm->slen] = 0; |
109 | | - } |
110 | | - return RWL_Z_STRING_CONST; |
| 69 | +\"(\\.|[^\\"])*\" { |
| 70 | +// Use this tag in vi: rwlscanstring |
| 71 | +#include "rwlscanstring.c" |
111 | 72 | } |
112 | 73 |
|
113 | 74 | /*LEXTAG:RWL_Z_DOUBLE_CONST*/ |
|
0 commit comments