
  PROCEDURE [INLINE] clp$isolate_text_via_separator
    (    mode: clt$ibt_modes;
         text: clt$command_line;
         start_index: clt$command_line_index;
     VAR end_index: clt$command_line_index);

?? PUSH (LISTEXT := ON) ??

    VAR
      found_char: boolean,
      nesting_level: integer,
      scan_index: integer,
      text_index: clt$command_line_index;

    text_index := start_index;
    nesting_level := 0;
    found_char := TRUE;

  /scan_loop/
    WHILE found_char AND (text_index <= STRLENGTH (text)) DO
      #SCAN (clv$isolate_balanced_text, text (text_index, * ), scan_index,
            found_char);
      text_index := scan_index + text_index - 1;
      IF found_char THEN
        CASE text (text_index) OF
        = '"' =
          IF nesting_level <= 0 THEN
            EXIT /scan_loop/;
          IFEND;
          #SCAN (clv$comment_delimiter, text (text_index + 1, * ), scan_index,
                found_char);
          text_index := scan_index + text_index + $INTEGER (found_char);
        = '''' =
          #SCAN (clv$string_delimiter, text (text_index + 1, * ), scan_index,
                found_char);
          text_index := scan_index + text_index + $INTEGER (found_char);
        = '(' =
          nesting_level := nesting_level + 1;
          text_index := text_index + 1;
        = ')' =
          IF nesting_level <= 0 THEN
            EXIT /scan_loop/;
          IFEND;
          nesting_level := nesting_level - 1;
          text_index := text_index + 1;
          IF (mode = clc$ibt_stop_on_balanced) AND (nesting_level = 0) THEN
            EXIT /scan_loop/;
          IFEND;
        = $CHAR (9) {HT} , ' ', ',', ';' =
          IF nesting_level <= 0 THEN
            EXIT /scan_loop/;
          IFEND;
          text_index := text_index + 1;
        = '.' =
          IF (text_index < STRLENGTH (text)) AND (text (text_index + 1) =
                '.') THEN
            IF nesting_level <= 0 THEN
              EXIT /scan_loop/;
            IFEND;
            text_index := text_index + 2;
          ELSE
            text_index := text_index + 1;
          IFEND;
        = '=', '<', '>' =
          IF (mode = clc$ibt_stop_on_relational) AND (nesting_level <= 0) THEN
            EXIT /scan_loop/;
          IFEND;
          text_index := text_index + 1;
        ELSE
          text_index := text_index + 1;
        CASEND;
      IFEND;
    WHILEND /scan_loop/;
    end_index := text_index;

  PROCEND clp$isolate_text_via_separator;

*copyc clt$command_line
*copyc clt$command_line_index
*copyc clt$ibt_modes
?? POP ??
*copyc clv$comment_delimiter
*copyc clv$isolate_balanced_text
*copyc clv$string_delimiter
