```python
def scan_pairs(text: str) -> list:
    if not isinstance(text, str):
        raise ValueError("Input must be a string.")
    
    if text == "":
        return []
    
    def is_bare_identifier(s: str) -> bool:
        return s.isidentifier() and not s.startswith("_")
    
    pairs = []
    current_key = None
    
    i = 0
    while i < len(text):
        if text[i] == '"':
            # Handle quoted strings
            j = i + 1
            quotes_opened = 1
            while j < len(text) and (text[j] == '"' or quotes_opened > 0):
                if text[j] == '"':
                    quotes_opened += 1
                elif quotes_opened > 0:
                    quotes_opened -= 1
                j += 1
            
            # Check for unterminated quote
            if quotes_opened > 0:
                raise ValueError("Unterminated quoted value.")
            
            # Parse the quoted value, stripping double quotes
            value = text[i + 1:j - 1]
            i = j - 1
        
        elif text[i] == '=' and current_key is None:
            # Found a key without a previous one
            raise ValueError("Key before equals sign.")
        
        elif text[i].isspace():
            # Skip whitespace
            i += 1
            continue
        
        elif current_key is None:
            # Start of new segment
            current_key = ""
        
        else:
            # Continue building the key or value
            if text[i] == ';':
                # End of segment; parse and add to pairs
                if not is_bare_identifier(current_key):
                    raise ValueError(f"Invalid key {current_key}.")
                
                pairs.append([current_key, value])
                current_key = None
                i += 1
                continue
        
        i += 1
    
    # Handle any trailing segment
    if current_key is not None:
        if not is_bare_identifier(current_key):
            raise ValueError(f"Invalid key {current_key}.")
        
        pairs.append([current_key, value])
    
    return pairs

def parse_option(segment: str) -> list:
    parts = segment.split('=')
    if len(parts) != 2:
        raise ValueError("Option must be a key=value pair.")
    
    key = parts[0].strip()
    value = parts[1]
    
    # Strip double quotes from the value
    if value.startswith('"') and value.endswith('"'):
        value = value[1:-1]
    
    return [key, value]
```