```python


import re


def parse_option(segment: str) -> list:
    key, eq, raw = segment.partition("=")
    if not eq or re.fullmatch(r"[A-Za-z][A-Za-z0-9_]*", key) is None:
        raise ValueError("malformed option segment: " + segment)
    if len(raw) >= 2 and raw.startswith('"') and raw.endswith('"'):
        raw = raw[1:-1]
    return [key, raw]


def scan_pairs(text: str) -> list:
    if not isinstance(text, str):
        raise ValueError("input must be a string")
    if text == "":
        return []
    
    pairs = []
    key_set = set()
    i = 0
    in_quotes = False

    while i < len(text):
        if text[i] == '"':
            if in_quotes:
                raise ValueError("unterminated quote found")
            in_quotes = True
            i += 1
            continue
        
        if text[i] == ';':
            if not in_quotes:
                j = i
                while j > 0 and text[j - 1].isspace():
                    j -= 1
                if j != i:
                    pairs.append(parse_option(text[j:i]))
                    key_set.add(pairs[-1][0])
                i += 1
                continue
        
        if in_quotes:
            i += 1
            continue
        
        j = i + 1
        while j < len(text) and text[j].isalnum() or text[j] == '_':
            j += 1
        key = text[i:j]
        
        if not re.fullmatch(r"[A-Za-z][A-Za-z0-9_]*", key):
            raise ValueError("malformed option segment: " + text[i:j])
        
        i = j
        
        while i < len(text) and text[i].isspace():
            i += 1
        
        if i == len(text):
            break
        
        if text[i] != '=':
            raise ValueError(f"missing equals sign in {text[j:i]}")
        
        i += 1
        
        j = i
        while j < len(text) and (text[j].isalnum() or text[j] == '_'):
            j += 1
        value = text[i:j]
        
        if in_quotes:
            raise ValueError("trailing quote found")
        
        pairs.append([key, value])
        
        if key in key_set:
            raise ValueError(f"repeated key: {key}")
        
        i = j
    
    return pairs
```