INIT
UTF8 0
WANTPARSER

!Basic text
PUSH "hello"
  text 0x68, 0x65, 0x6c, 0x6c, 0x6f

!C0
PUSH "\x03"
  control 3

PUSH "\x1f"
  control 0x1f

!C1 8bit
PUSH "\x83"
  control 0x83

PUSH "\x9f"
  control 0x9f

!C1 7bit
PUSH "\e\x43"
  control 0x83

PUSH "\e\x5f"
  control 0x9f

!High bytes
PUSH "\xa0\xcc\xfe"
  text 0xa0, 0xcc, 0xfe

!Mixed
PUSH "1\n2"
  text 0x31
  control 10
  text 0x32

!Escape
PUSH "\e="
  escape "="

!Escape 2-byte
PUSH "\e(X"
  escape "(X"

!Split write Escape
PUSH "\e("
PUSH "Y"
  escape "(Y"

!Escape cancels Escape, starts another
PUSH "\e(\e)Z"
  escape ")Z"

!CAN cancels Escape, returns to normal mode
PUSH "\e(\x{18}AB"
  text 0x41, 0x42

!C0 in Escape interrupts and continues
PUSH "\e(\nX"
  control 10
  escape "(X"

!CSI 0 args
PUSH "\e[a"
  csi 0x61 *

!CSI 1 arg
PUSH "\e[9b"
  csi 0x62 9

!CSI 2 args
PUSH "\e[3;4c"
  csi 0x63 3,4

!CSI 1 arg 1 sub
PUSH "\e[1:2c"
  csi 0x63 1+,2

!CSI many digits
PUSH "\e[678d"
  csi 0x64 678

!CSI leading zero
PUSH "\e[007e"
  csi 0x65 7

!CSI qmark
PUSH "\e[?2;7f"
  csi 0x66 L=3f 2,7

!CSI greater
PUSH "\e[>c"
  csi 0x63 L=3e *

!CSI SP
PUSH "\e[12 q"
  csi 0x71 12 I=20

!Mixed CSI
PUSH "A\e[8mB"
  text 0x41
  csi 0x6d 8
  text 0x42

!Split write
PUSH "\e"
PUSH "[a"
  csi 0x61 *
PUSH "foo\e["
  text 0x66, 0x6f, 0x6f
PUSH "4b"
  csi 0x62 4
PUSH "\e[12;"
PUSH "3c"
  csi 0x63 12,3

!Escape cancels CSI, starts Escape
PUSH "\e[123\e9"
  escape "9"

!CAN cancels CSI, returns to normal mode
PUSH "\e[12\x{18}AB"
  text 0x41, 0x42

!C0 in Escape interrupts and continues
PUSH "\e[12\n;3X"
  control 10
  csi 0x58 12,3

!OSC BEL
PUSH "\e]1;Hello\x07"
  osc "1;Hello"

!OSC ST (7bit)
PUSH "\e]1;Hello\e\\"
  osc "1;Hello"

!OSC ST (8bit)
PUSH "\x{9d}1;Hello\x9c"
  osc "1;Hello"

!Escape cancels OSC, starts Escape
PUSH "\e]Something\e9"
  escape "9"

!CAN cancels OSC, returns to normal mode
PUSH "\e]12\x{18}AB"
  text 0x41, 0x42

!C0 in OSC interrupts and continues
PUSH "\e]2;\nBye\x07"
  control 10
  osc "2;Bye"

!DCS BEL
PUSH "\ePHello\x07"
  dcs "Hello"

!DCS ST (7bit)
PUSH "\ePHello\e\\"
  dcs "Hello"

!DCS ST (8bit)
PUSH "\x{90}Hello\x9c"
  dcs "Hello"

!Escape cancels DCS, starts Escape
PUSH "\ePSomething\e9"
  escape "9"

!CAN cancels DCS, returns to normal mode
PUSH "\eP12\x{18}AB"
  text 0x41, 0x42

!C0 in OSC interrupts and continues
PUSH "\ePBy\ne\x07"
  control 10
  dcs "Bye"

!NUL ignored
PUSH "\x{00}"

!NUL ignored within CSI
PUSH "\e[12\x{00}3m"
  csi 0x6d 123

!DEL ignored
PUSH "\x{7f}"

!DEL ignored within CSI
PUSH "\e[12\x{7f}3m"
  csi 0x6d 123

!DEL inside text"
PUSH "AB\x{7f}C"
  text 0x41,0x42
  text 0x43
