public void processString(String text) throws BadLocationException {
		sb.append(text);
		Matcher m = CTRL_SEQ.matcher(sb);
		int lastPos = 0;
		while (m.find()) {
			if (m.start() > lastPos) {
				handler.handleString(sb.substring(lastPos, m.start()));
			}

			if (m.group("CSI") != null) {
				handler.handleCSI(m.group("CSIPARAM"), m.group("CSIINTER"), m.group("CSIFINAL"));
			}
			else if (m.group("OSC") != null) {
				handler.handleOSC(m.group("OSCPARAM"));
			}
			else if (m.group("NUL") != null) {
				// Suppress NUL bytes from the output.
				// TTY commands, such as "clear", that see TERM=vt100
				// may append NUL padding to their output, which a real vt100 would need.
			}
			lastPos = m.end();
		}

		m = CTRL_TAIL.matcher(sb);
		if (m.find(lastPos)) {
			if (lastPos < m.start()) {
				handler.handleString(sb.substring(lastPos, m.start()));
			}
			sb.delete(0, m.start());
		}
		else {
			if (lastPos < sb.length()) {
				handler.handleString(sb.substring(lastPos));
			}
			sb.setLength(0);
		}
	}
Process a portion of input text

@param text the portion to process
@throws BadLocationException if there was an issue rendering the portion into a document
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/interpreter/AnsiParser.java