PY-23279, PY-9963: fixed according to IDEA-CR-19921

This commit is contained in:
Ilya.Kazakevich
2017-04-12 01:34:23 +03:00
parent 7509993c64
commit 2093653511
3 changed files with 8 additions and 1 deletions
@@ -22,6 +22,10 @@
elementTypeClass = 'com.jetbrains.commandInterface.commandLine.CommandLineElementType'
//TODO: I would suggest making this pattern negative rather than positive in order to support all the characters like ? and others
//TODO: This lexer doesn't support multi-line arguments and options. LabelsReplyCreate issue
//TODO: This lexer doesn't support escaping.
//TODO: This parser doesn't support - --no-option - -nonoption.
tokens=[
space='regexp:\s+' // WARNING: Comment out or remove this (space) before generating Flex file! It is here only for live preview.
EQ = '='
@@ -84,6 +84,9 @@ final class CommandLinePsiImplUtils {
@NotNull
static String getValueNoQuotes(@NotNull final CommandLineArgument argument) {
final char[] chars = argument.getText().toCharArray();
if (chars.length == 0) {
return "";
}
final char firstChar = chars[0];
if (firstChar == chars[chars.length - 1] && firstChar == '"' || firstChar == '\'') {
return argument.getText().substring(1, argument.getTextLength() - 1);
@@ -117,7 +117,7 @@ private fun findVFSItemRoot(virtualFile: VirtualFile, project: Project): Virtual
/**
* Emulates command line processor by parsing command line to arguments that can be provided as argv.
* Emulates command line processor (cmd, bash) by parsing command line to arguments that can be provided as argv.
* Escape chars are not supported but quotes work.
* @throws ExecutionException if can't be parsed
*/