private static Sequence checkForPascalAsciiSequence(MemBuffer buf, Sequence sequence,
			int offset) {
		int pascalLengthOffset = (int) sequence.getStart() + offset;
		if (pascalLengthOffset < 0) {
			return null;
		}
		int length = getShort(buf, pascalLengthOffset);
		int sequenceLength = sequence.getLength() - offset - PASCAL_LENGTH_SIZE;
		if (sequence.isNullTerminated()) {
			sequenceLength -= 1;
			if (length == sequenceLength) {
				return new Sequence(pascalLengthOffset, sequence.getEnd() - ASCII_CHAR_WIDTH,
					PascalStringDataType.dataType, false);
			}
		}
		else if (length == sequenceLength) {
			return new Sequence(pascalLengthOffset, sequence.getEnd(),
				PascalStringDataType.dataType, false);
		}
		return null;
	}
Looks for Pascal strings given a sequence of bytes that represent a sequence of ascii chars.
@param buf the Memory buffer containing the bytes that make up the string.
@param sequence the sequence that specifies the start, end, and type of ascii sequence (i.e. ascii,
unicode16).  This method looks for both 2 byte and 1 byte leading pascal lengths both before
and at the beginning of the given sequence.

@return a new sequence that has been adjusted  to represent a pascal string or null if
a pascal string was not found.
Ghidra/Features/Base/src/main/java/ghidra/program/util/string/PascalUtil.java