* Copyright (c) 1983 The Regents of the University of California.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
static char sccsid[] = "@(#)commands.y 5.6 (Berkeley) 6/1/90";
* Yacc grammar for debugger commands.
private String curformat = "X";
ALIAS AND ASSIGN AT CALL CATCH CONT DEBUG DELETE DIV DOWN DUMP
EDIT FILE FUNC GRIPE HELP IF IGNORE IN LIST MOD NEXT NEXTI NIL NOT OR
PRINT PSYM QUIT RERUN RETURN RUN SET SH SKIP SOURCE STATUS STEP STEPI
STOP STOPI TRACE TRACEI UNALIAS UNSET UP USE
WHATIS WHEN WHERE WHEREIS WHICH
%term INT CHAR REAL NAME STRING
%binary '<' '=' '>' '!' IN
%left '*' '/' DIV MOD AND
%left NOT '(' '[' '.' '^' ARROW
%type <y_long> INT count signal
%type <y_string> STRING redirectout filename opt_filename mode
%type <y_name> ALIAS AND ASSIGN AT CALL CATCH CONT
%type <y_name> DEBUG DELETE DIV DOWN DUMP
%type <y_name> EDIT FILE FUNC GRIPE HELP IF IGNORE IN LIST MOD
%type <y_name> NEXT NEXTI NIL NOT OR
%type <y_name> PRINT PSYM QUIT RERUN RETURN RUN SET SH SKIP SOURCE STATUS
%type <y_name> STEP STEPI STOP STOPI TRACE TRACEI
%type <y_name> UNALIAS UNSET UP USE WHATIS WHEN WHERE WHEREIS WHICH
%type <y_name> name NAME keyword
%type <y_node> opt_qual_symbol symbol
%type <y_node> command rcommand cmd step what where examine
%type <y_node> event opt_exp_list opt_cond
%type <y_node> exp_list exp term boolean_exp constant address
%type <y_node> integer_list alias_command list_command line_number
%type <y_cmdlist> actions
%type <y_list> sourcepath name_list
* Non-redirectable commands.
$$ = build(O_ASSIGN, unrval($2), $4);
$$ = build(O_CONT, (long) DEFSIG);
$$ = build(O_DELETE, $2);
$$ = build(O_DOWN, build(O_LCON, (long) 1));
$$ = build(O_DOWN, build(O_LCON, (long) $2));
EDIT shellmode opt_filename
FILE shellmode opt_filename
$$ = build(O_CHFILE, $3);
$$ = build(O_IGNORE, $2);
$$ = build(O_PSYM, unrval($2));
$$ = build(O_RETURN, nil);
$$ = build(O_RETURN, $2);
$$ = build(O_SET, build(O_NAME, $2), $4);
$$ = build(O_SET, build(O_NAME, $2), nil);
$$ = build(O_SET, nil, nil);
SOURCE shellmode filename
$$ = build(O_SOURCE, $3);
$$ = build($1, nil, $2, $3);
$$ = build($1, $2, nil, $3);
$$ = build($1, nil, nil, $3);
trace what where opt_cond
$$ = build($1, $2, $3, $4);
$$ = build($1, nil, $2, $3);
$$ = build($1, $2, nil, $3);
$$ = build($1, nil, nil, $2);
$$ = build(O_UNALIAS, build(O_NAME, $2));
$$ = build(O_UNSET, build(O_NAME, $2));
$$ = build(O_UP, build(O_LCON, (long) 1));
$$ = build(O_UP, build(O_LCON, (long) $2));
if (list_size($3) == 0) {
foreach (String, dir, sourcepath)
foreach (String, dir, sourcepath)
list_delete(list_curitem(sourcepath), sourcepath);
$$ = build(O_WHATIS, $2);
WHEN event '{' actions '}'
$$ = build(O_ADDEVENT, $2, $4);
$$ = build(O_WHEREIS, build(O_SYM, lookup($2)));
build(O_LCON, (long) '/'),
build(O_SCON, strdup(scanner_linebuf))
build(O_LCON, (long) '?'),
build(O_SCON, strdup(scanner_linebuf))
$$ = siglookup(ident($1));
$$ = build(O_STEP, true, false);
$$ = build(O_STEP, false, false);
$$ = build(O_STEP, true, true);
$$ = build(O_STEP, false, true);
list_append(list_item(ident($2)), nil, $$);
CALL term '(' opt_exp_list ')'
$$ = build(O_CALLPROC, $2, $4);
$$ = build(O_DEBUG, -$3);
$$ = build(O_DUMP, build(O_SYM, curfunc));
$$ = build(O_ALIAS, build(O_NAME, $2), build(O_NAME, $3));
$$ = build(O_ALIAS, build(O_NAME, $2), build(O_SCON, $3));
ALIAS name '(' name_list ')' STRING
build(O_COMMA, build(O_NAME, $2), (Node) $4),
$$ = build(O_ALIAS, build(O_NAME, $2), nil);
$$ = build(O_ALIAS, nil, nil);
list_append(list_item($3), nil, $$);
list_append(list_item($1), nil, $$);
$$ = build(O_QLINE, build(O_SCON, $1), $3);
$$ = build(O_QLINE, build(O_SCON, strdup(cursource)), $2);
AT STRING ':' line_number
$$ = build(O_QLINE, build(O_SCON, $2), $4);
build(O_LCON, (long) cursrcline),
build(O_LCON, (long) cursrcline + srcwindowlen() - 1)
$$ = build(O_LIST, $2, $2);
LIST line_number ',' line_number
$$ = build(O_LIST, $2, $4);
$$ = build(O_LIST, $2, $2);
$$ = build(O_COMMA, build(O_LCON, $1), $2);
$$ = build(O_LCON, (long) LASTLINE);
$$ = build(O_EXAMINE, $4, $1, nil, $3);
address ',' address '/' mode
$$ = build(O_EXAMINE, $5, $1, $3, 0);
$$ = build(O_EXAMINE, $3, $1, nil, 0);
$$ = build(O_LCON, (long) prtaddr);
$$ = build(O_ADD, $1, $3);
$$ = build(O_SUB, $1, $3);
$$ = build(O_MUL, $1, $3);
'*' address %prec UNARYSIGN
'-' address %prec UNARYSIGN
$$ = unrval(dot($1, $3));
$$ = unrval(dot($1, $3));
$$ = unrval(subscript($1, $3));
$$ = build(O_COMMA, $1, nil);
$$ = build(O_COMMA, $1, $3);
$$ = subscript(unrval($1), $3);
$$ = build(O_TYPERENAME, $1, $3);
exp '\\' '&' opt_qual_symbol %prec '\\'
$$ = build(O_CALL, unrval($1), $3);
$$ = build(O_ADD, $1, $3);
$$ = build(O_SUB, $1, $3);
$$ = build(O_MUL, $1, $3);
$$ = build(O_DIVF, $1, $3);
$$ = build(O_DIV, $1, $3);
$$ = build(O_MOD, $1, $3);
$$ = build(O_AND, $1, $3);
$$ = build(O_OR, $1, $3);
$$ = build(O_LT, $1, $3);
$$ = build(O_LE, $1, $4);
$$ = build(O_GT, $1, $3);
$$ = build(O_GE, $1, $4);
$$ = build(O_EQ, $1, $3);
$$ = build(O_EQ, $1, $4);
$$ = build(O_NE, $1, $4);
$$ = build(O_NE, $1, $4);
$$ = build(O_SYM, which($1));
$$ = dot(build(O_SYM, program), $2);
ALIAS | AND | ASSIGN | AT | CALL | CATCH | CONT | DEBUG | DELETE | DIV |
DOWN | DUMP | EDIT | FILE | FUNC | GRIPE | HELP | IGNORE | IN | LIST |
MOD | NEXT | NEXTI | NIL | NOT | OR | PRINT | PSYM | QUIT |
RERUN | RETURN | RUN | SET | SH | SKIP | SOURCE | STATUS | STEP | STEPI |
STOP | STOPI | TRACE | TRACEI | UNALIAS | UNSET | UP | USE |
WHATIS | WHEN | WHERE | WHEREIS | WHICH