diff --git a/python/src/com/jetbrains/commandInterface/commandLine/command_line.bnf b/python/src/com/jetbrains/commandInterface/commandLine/command_line.bnf index eb2fdd15c9dd..26cba405f22b 100644 --- a/python/src/com/jetbrains/commandInterface/commandLine/command_line.bnf +++ b/python/src/com/jetbrains/commandInterface/commandLine/command_line.bnf @@ -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 = '=' diff --git a/python/src/com/jetbrains/commandInterface/commandLine/psi/impl/CommandLinePsiImplUtils.java b/python/src/com/jetbrains/commandInterface/commandLine/psi/impl/CommandLinePsiImplUtils.java index 82f3b205977d..747eb84eb6bb 100644 --- a/python/src/com/jetbrains/commandInterface/commandLine/psi/impl/CommandLinePsiImplUtils.java +++ b/python/src/com/jetbrains/commandInterface/commandLine/psi/impl/CommandLinePsiImplUtils.java @@ -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); diff --git a/python/src/com/jetbrains/python/testing/universalTests/PyTestRunnerUtils.kt b/python/src/com/jetbrains/python/testing/universalTests/PyTestRunnerUtils.kt index 4a69aceaeda3..7ec5c20ac59d 100644 --- a/python/src/com/jetbrains/python/testing/universalTests/PyTestRunnerUtils.kt +++ b/python/src/com/jetbrains/python/testing/universalTests/PyTestRunnerUtils.kt @@ -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 */