code: @Override
      public void leavingState(ParsingContext ctx) throws CommandFormatException {
          final String stateId = ctx.getState().getId();
          //System.out.println("left " + stateId + " '" + ctx.getCharacter() + "'");
  
          if(ArgumentValueState.ID.equals(stateId) ||
                  CompositeState.OBJECT.equals(stateId) || CompositeState.LIST.equals(stateId)) {
              if (!currentState.isOnSeparator()) {
                  if (stack != null && stack.peek() != null) {
                      stack.peek().addChild(currentState);
                      currentState = stack.pop();
                      if (!currentState.isComposite()) {
                          if (stack.peek() != null) {
                              stack.peek().addChild(currentState);
                              currentState = stack.pop();
                          }
                      }
                  }
              }
          } else if(QuotesState.ID.equals(stateId)) {
              flag ^= QUOTES;
              currentState.quoted();
          } else if(EscapeCharacterState.ID.equals(stateId)) {
              flag ^= ESCAPE;
          }
      }
docs: /* (non-Javadoc)
  @see org.jboss.as.cli.parsing.ParsingStateCallbackHandler#leavingState(org.jboss.as.cli.parsing.ParsingContext)