com.jetbrains.commandInterface.commandLine.psi.ValidationResultImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of python-community Show documentation
Show all versions of python-community Show documentation
A packaging of the IntelliJ Community Edition python-community library.
This is release number 1 of trunk branch 142.
The newest version!
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jetbrains.commandInterface.commandLine.psi;
import com.intellij.openapi.util.Pair;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiWhiteSpace;
import com.intellij.util.containers.hash.HashMap;
import com.jetbrains.commandInterface.commandLine.ValidationResult;
import com.jetbrains.commandInterface.command.Argument;
import com.jetbrains.commandInterface.command.Command;
import com.jetbrains.commandInterface.command.Option;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
/**
* Validation result provider and holder implemented as visitor.
* @author Ilya.Kazakevich
*/
final class ValidationResultImpl extends CommandLineVisitor implements ValidationResult {
/**
* All options [name -> option]
*/
@NotNull
private final Map myOptions = new HashMap();
/**
* Available, but unused options [name -> option]
*/
@NotNull
private final Map myUnusedOptions = new HashMap();
/**
* We always need command to validate args
*/
@NotNull
private final Command myCommand;
/**
* Number of next positional argument. I.e. will be 3 for "my_arg arg_1 arg_2"
*/
private int myCurrentPositionArgument;
/**
* If next arg is supposed to be option arg, then option and number of expected args stored here.
* Null stored otherwise.
*/
@Nullable
private Pair
© 2015 - 2025 Weber Informatics LLC | Privacy Policy