The debugger starts processing each line according to the rules of the LKEYWORD lexical state. It recognizes the longest lexeme it can, according to these rules. After recognizing the lexeme, it may stay in the same state, or it may change to a different lexical state with different rules.
The debugger moves between the following lexical states as it recognizes the lexemes:
Lexical State |
Description |
---|---|
LBPT | Breakpoint commands have lexemes that change the lexical state to LBPT. |
LEXPORT | The command export changes the lexical state to LEXPORT. This state recognizes an environment variable identifier. |
LFILE | Commands that require file names have lexemes that change the lexical state to LFILE so that things like mysrc/foo.txt are recognized as a file name, and not as a variable mysrc being divided by a structure data member foo.txt. |
LFINT | Commands that require either a file name or a process ID have lexemes to change the lexical state to LFINT. |
LKEYWORD | All but one of the debugger commands begin with one or more keywords. The exception is the examine command. The debugger recognizes the '{' and ';' lexemes that must precede a command, and uses those to reset to the LKEYWORD state for the beginning of the next command. |
LLINE | Commands that require arbitrary character input have lexemes that change the lexical state to LLINE. |
LNORM | Language expressions involve language-specific lexemes. The lexemes that precede an expression change the lexical state to LNORM, and then LNORM recognizes the language-specific lexemes. |
LSETENV | The command setenv changes the lexical state to LSETENV. This state recognizes an environment variable identifier. |
LSIGNAL | Commands that require signal names have lexemes that change the lexical state to LSIGNAL. |
LWORD | Commands that require shell words have lexemes that change the lexical state to LWORD. |
The rules that each lexical state uses are described in the following sections, in a format known as a lex regular expression. Rather than repeating some of descriptions, a set of common subrules is described first. After the common subrules, we describe the initial state, the rules, and for each recognized token, the next lexical state.