114 const char *string_start;
130 string_start = bytes;
134#define ENTER_STATE(st) do { vt->parser.state = st; string_start = NULL; } while(0)
135#define ENTER_NORMAL_STATE() ENTER_STATE(NORMAL)
137#define IS_STRING_STATE() (vt->parser.state >= OSC_COMMAND)
139 for( ; pos < len; pos++) {
140 unsigned char c = bytes[pos];
141 bool c1_allowed = !
vt->
mode.utf8;
143 if(c == 0x00 || c == 0x7f) {
146 string_start = bytes + pos + 1;
152 if(c == 0x18 || c == 0x1a) {
178 string_start = bytes + pos + 1;
183 size_t string_len = bytes + pos - string_start;
189 c >= 0x40 && c < 0x60 &&
206 if(c >= 0x3c && c <= 0x3f) {
222 if(c >=
'0' && c <=
'9') {
252 else if(c >= 0x40 && c <= 0x7e) {
263 if(c >=
'0' && c <=
'9') {
268 vt->
parser.v.osc.command += c -
'0';
273 string_start = bytes + pos + 1;
278 string_start = bytes + pos;
287 if(c >= 0x40 && c<= 0x7e) {
288 string_start = bytes + pos + 1;
299 if(c == 0x07 || (c1_allowed && c == 0x9c)) {
311 else if(c >= 0x30 && c < 0x7f) {
317 DEBUG_LOG(
"TODO: Unhandled byte %02x in Escape\n", c);
321 if(c1_allowed && c >= 0x80 && c < 0xa0) {
331 string_start = bytes + pos + 1;
341 string_start = bytes + pos + 1;
347 string_start = bytes + pos + 1;
353 string_start = bytes + pos + 1;
364 eaten = (*
vt->
parser.callbacks->text)(bytes + pos, len - pos,
vt->
parser.cbdata);
367 DEBUG_LOG(
"libvterm: Text callback did not consume any input\n");
379 size_t string_len = bytes + pos - string_start;