! LSE$PARSER.TPU ! !************************************************************************* ! * ! © Copyright 2005 Hewlett-Packard Development Company, L.P. * ! * ! Confidential computer software. Valid license from HP required for * ! possession, use or copying. Consistent with FAR 12.211 and 12.212, * ! Commercial Computer Software, Computer Software Documentation, and * ! Technical Data for Commercial Items are licensed to the U.S. * ! Government under vendor's standard commercial license. * ! * !************************************************************************* ! !++ ! FACILITY: ! VAX Language-Sensitive Editor ! ! ABSTRACT: ! This file contains TPU procedures for LSE that relate to command ! parsing and the contents of the EVE$PARSER.TPU file. ! ! ENVIRONMENT: ! VAX/VMS ! ! Author: Duane A. Smith ! ! CREATION DATE: 30-Jan-1989 ! ! MODIFIED BY: ! ! X2.3-0 DAS 30-Jan-89 Enabled LSE parser... ! X2.3-1 DAS 15-Feb-89 Removed eve$clear_message from exit_command_window ! X2.3-2 DAS 20-Feb-89 Added optional argument to LSE$DO_COMMAND. ! X2.3-3 DAS 22-Feb-89 Modified exit command window to replace learn window ! X2.3-4 DAS 10-Mar-89 Modified keywords passed on LSE$DO_COMMAND builtin. ! X2.3-5 DAS 17-Mar-89 Better CTRL/C trapping when using prompt line ! X2.3-6 DAS 11-Jul-89 Fixed prompt going away after commands like spawn ! and positioning to beginning of line before doing ! the command. ! X2.3-7 GHL 11-Jul-89 Move code that deletes null commands from command ! buffer. It was deleting the command entered ! before the null command. ! X3.0-1 DAS 28-Jul-89 Only map learn window if current window is not the ! command window. This fixes issuing GOTO COMMAND at ! LSE Command> prompt while learning. ! X3.0-2 PBP 04-Aug-89 Merge changes from EVE V2.4 into eve procedures. ! X3.0-3 PBP 15-Aug-89 Make command buffer modifible for erase_line. ! X3.0-4 PBP 30-Aug-89 Merger with EVE V2.4 ! X3.0-5 PBP 06-Sep-89 Add move_vertical(-1) after split_line to remove ! $COMMAND blank lines in eve$$exit_command_window ! X3.1-1 DAS 27-Dec-89 Moved all EVE superceded procedures to the module ! LSE$EVE_PARSER.TPU. ! X3.2 DAS 25-May-90 Rid the editor of LSE$$X_PROMPT_TERMINATORS and ! rely on EVE$$X_PROMPT_TERMINATORS. ! X3.2-1 DAS 24-Aug-90 Integrating new grammar ! X3.2-2 DAS 30-Oct-90 Adding variable LSE$$X_PARSER_PROMPTING ! X3.2-3 SHE 06-Dec-90 Added documentation header ! X3.2-4 DAS 07-Dec-90 Use new PARSER/PARSER_PROMPTING builtins ! X3.2-5 SAA 15-Feb-91 Modify lse$$x_prefix variables for new eve$$parse ! X4.0 SHE 01-Aug-91 Moved UPDATE in lse$parser_process_command to ! within 'if' body. ! X4.0-1 WC3 12-Dec-91 Removed the MODULE/ENDMODULE construct !-- procedure lse$parser_module_ident return "X4.0-1"; endprocedure; ! ! This is the procedure that implements the parsing... If this procedure ! returns FALSE, then EVE will attempt to parse the command after us. ! procedure lse$parser_process_command (new_do_line) ! !doc_begin ! ! ONE LINE DEFINITION: ! «TBS» ! ! DESCRIPTION: ! «TBS» ! ! RELATED COMMANDS: ! «TBS» ! ! EXAMPLE: ! «TBS» ! ! CATEGORY: ! «TBS» ! !doc_end ! ! This routine will only be called from VMS. Therefore, the use of ! lse$do_commands is okay. local saved_window, saved_mark, cont_line, def_line, do_command_status; on_error [OTHERWISE]: lse$do_command ("", ctrl_z_key); ! This handles submode terminate if get_info (COMMAND_LINE, 'display') ! windows only when /display then if saved_window <> tpu$k_unspecified then eve$$restore_position (saved_window); update (saved_window); endif; endif; lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$parser_process_command "); endon_error; saved_window := current_window; saved_mark := mark (FREE_CURSOR); if get_info (COMMAND_LINE, 'display') ! windows only when /display then eve$goto_command_window; endif; ! Move cursor to beginning of line for visual feedback to prompt terminator key. ! position (line_begin); update (current_window); position (saved_window); position (saved_mark); ! ! If we are using the portable grammar, then return a FALSE indicating to let ! EVE do the parsing (using our facility). ! if get_info (lse$system, 'lse$cli_parser') = FALSE then return false; endif; ! ! Default the command status to success ! do_command_status := 1; ! ! Execute the command last in case the command itself switches the buffers. ! Only do it if it was not terminated with CTRL/Z. ! if (new_do_line <> "") then if (last_key <> ctrl_z_key) then do_command_status := lse$do_command (new_do_line, command_line); endif; endif; ! ! If the command status was 5, then that means that the DCL parser is waiting ! for more command... Let's just pretend that the user hit the DO key again, ! but change the prompt and then change it back... ! loop exitif do_command_status <> 5; cont_line := eve$prompt_line("_LSE Command> ", eve$$x_prompt_terminators, ""); if ((cont_line = 0) or (last_key = ctrl_z_key)) then do_command_status := lse$do_command ("", ctrl_z_key); exitif; endif; do_command_status := lse$do_command (cont_line, command_line); endloop; ! ! If the command status was 7, then that means that we are in the middle of ! processing a DEFINE command. ! loop exitif do_command_status <> 7; def_line := eve$prompt_line("DEF> ", eve$$x_prompt_terminators, ""); if ((def_line = 0) or (last_key = ctrl_z_key)) then do_command_status := lse$do_command ("", ctrl_z_key); exitif; endif; do_command_status := lse$do_command (def_line, command_line); endloop; ! ! Update the command window ! saved_window := current_window; saved_mark := mark (FREE_CURSOR); eve$goto_command_window; position (end_of (eve$command_buffer)); if new_do_line = "" then ! Remove empty command line from buffer so it does not get recalled. ! if mark (NONE) <> beginning_of (eve$command_buffer) then move_vertical (-1); set (RECORD_ATTRIBUTE, mark (none), MODIFIABLE, ON); erase_line; update (eve$command_window); endif; endif; position (saved_window); position (saved_mark); ! ! End of routine ! return (TRUE); endprocedure;