allow paths and dash in command line language (fixed PY-17209, PY-17214)

This commit is contained in:
liana.bakradze
2015-10-20 17:27:13 +03:00
parent 4fa517e03a
commit d83f10be3b
7 changed files with 201 additions and 113 deletions
@@ -15,6 +15,7 @@ public interface CommandLineElementTypes {
IElementType EQ = new IElementType("=", null);
IElementType LITERAL_STARTS_FROM_DIGIT = new IElementType("LITERAL_STARTS_FROM_DIGIT", null);
IElementType LITERAL_STARTS_FROM_LETTER = new IElementType("LITERAL_STARTS_FROM_LETTER", null);
IElementType LITERAL_STARTS_FROM_SYMBOL = new IElementType("LITERAL_STARTS_FROM_SYMBOL", null);
IElementType LONG_OPTION_NAME_TOKEN = new IElementType("LONG_OPTION_NAME_TOKEN", null);
IElementType SHORT_OPTION_NAME_TOKEN = new IElementType("SHORT_OPTION_NAME_TOKEN", null);
@@ -1,17 +1,18 @@
// This is a generated file. Not intended for manual editing.
package com.jetbrains.commandInterface.commandLine;
import com.intellij.lang.ASTNode;
import com.intellij.lang.LightPsiParser;
import com.intellij.lang.PsiBuilder;
import com.intellij.lang.PsiBuilder.Marker;
import com.intellij.lang.PsiParser;
import com.intellij.psi.tree.IElementType;
import static com.jetbrains.commandInterface.commandLine.CommandLineElementTypes.*;
import static com.jetbrains.commandInterface.commandLine.CommandLineParserUtil.*;
import com.intellij.psi.tree.IElementType;
import com.intellij.lang.ASTNode;
import com.intellij.psi.tree.TokenSet;
import com.intellij.lang.PsiParser;
@SuppressWarnings({"SimplifiableIfStatement", "UnusedAssignment"})
public class CommandLineParser implements PsiParser {
public class CommandLineParser implements PsiParser, LightPsiParser {
public ASTNode parse(IElementType t, PsiBuilder b) {
parseLight(t, b);
@@ -42,14 +43,14 @@ public class CommandLineParser implements PsiParser {
}
/* ********************************************************** */
// LITERAL_STARTS_FROM_LETTER | LITERAL_STARTS_FROM_DIGIT
// LITERAL_STARTS_FROM_LETTER | LITERAL_STARTS_FROM_DIGIT | LITERAL_STARTS_FROM_SYMBOL
public static boolean argument(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "argument")) return false;
if (!nextTokenIs(b, "<argument>", LITERAL_STARTS_FROM_DIGIT, LITERAL_STARTS_FROM_LETTER)) return false;
boolean r;
Marker m = enter_section_(b, l, _NONE_, "<argument>");
r = consumeToken(b, LITERAL_STARTS_FROM_LETTER);
if (!r) r = consumeToken(b, LITERAL_STARTS_FROM_DIGIT);
if (!r) r = consumeToken(b, LITERAL_STARTS_FROM_SYMBOL);
exit_section_(b, l, m, ARGUMENT, r, false, null);
return r;
}
@@ -22,8 +22,9 @@ EOL="\r"|"\n"|"\r\n"
LINE_WS=[\ \t\f]
WHITE_SPACE=({LINE_WS}|{EOL})+
LITERAL_STARTS_FROM_LETTER=[:letter:]([a-zA-Z_0-9]|:|\\|"/"|\.)*
LITERAL_STARTS_FROM_DIGIT=[:digit:]([a-zA-Z_0-9]|:|\\\|"/"|\.)*
LITERAL_STARTS_FROM_LETTER=[:letter:]([a-zA-Z_0-9]|:|\\|"/"|\.|-)*
LITERAL_STARTS_FROM_DIGIT=[:digit:]([a-zA-Z_0-9]|:|\\|"/"|\.|-)*
LITERAL_STARTS_FROM_SYMBOL=([/\~\.]([a-zA-Z_0-9]|:|\\|"/"|\.|-)*)
SHORT_OPTION_NAME_TOKEN=-[:letter:]
LONG_OPTION_NAME_TOKEN=--[:letter:](-|[a-zA-Z_0-9])*
@@ -35,6 +36,7 @@ LONG_OPTION_NAME_TOKEN=--[:letter:](-|[a-zA-Z_0-9])*
{LITERAL_STARTS_FROM_LETTER} { return LITERAL_STARTS_FROM_LETTER; }
{LITERAL_STARTS_FROM_DIGIT} { return LITERAL_STARTS_FROM_DIGIT; }
{LITERAL_STARTS_FROM_SYMBOL} { return LITERAL_STARTS_FROM_SYMBOL; }
{SHORT_OPTION_NAME_TOKEN} { return SHORT_OPTION_NAME_TOKEN; }
{LONG_OPTION_NAME_TOKEN} { return LONG_OPTION_NAME_TOKEN; }
@@ -1,4 +1,4 @@
/* The following code was generated by JFlex 1.4.3 on 23.03.15 20:24 */
/* The following code was generated by JFlex 1.4.3 on 10/20/15 5:14 PM */
package com.jetbrains.commandInterface.commandLine;
import com.intellij.lexer.*;
@@ -9,8 +9,8 @@ import static com.jetbrains.commandInterface.commandLine.CommandLineElementTypes
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
* on 23.03.15 20:24 from the specification file
* <tt>C:/Users/ilya.kazakevich/work/ultimate/community/python/gen/com/jetbrains/commandInterface/commandLine/_CommandLineLexer.flex</tt>
* on 10/20/15 5:14 PM from the specification file
* <tt>/Users/liana/IdeaProjects/ultimate/community/python/gen/com/jetbrains/commandInterface/commandLine/_CommandLineLexer.flex</tt>
*/
public class _CommandLineLexer implements FlexLexer {
/** initial size of the lookahead buffer */
@@ -33,68 +33,88 @@ public class _CommandLineLexer implements FlexLexer {
* Translates characters to character classes
*/
private static final String ZZ_CMAP_PACKED =
"\11\0\1\1\1\1\1\0\1\1\1\1\22\0\1\1\14\0\1\13"+
"\1\5\1\7\12\11\1\5\2\0\1\14\3\0\32\4\1\0\1\6"+
"\2\0\1\3\1\0\32\4\1\0\1\12\55\0\1\2\12\0\1\2"+
"\4\0\1\2\5\0\27\2\1\0\37\2\1\0\u013f\2\31\0\162\2"+
"\4\0\14\2\16\0\5\2\11\0\1\2\213\0\1\2\13\0\1\2"+
"\1\0\3\2\1\0\1\2\1\0\24\2\1\0\54\2\1\0\46\2"+
"\1\0\5\2\4\0\202\2\10\0\105\2\1\0\46\2\2\0\2\2"+
"\6\0\20\2\41\0\46\2\2\0\1\2\7\0\47\2\110\0\33\2"+
"\5\0\3\2\56\0\32\2\5\0\13\2\25\0\12\10\4\0\2\2"+
"\1\0\143\2\1\0\1\2\17\0\2\2\7\0\2\2\12\10\3\2"+
"\2\0\1\2\20\0\1\2\1\0\36\2\35\0\3\2\60\0\46\2"+
"\13\0\1\2\u0152\0\66\2\3\0\1\2\22\0\1\2\7\0\12\2"+
"\11\0\1\1\1\1\1\0\1\1\1\1\22\0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2\0\7\2\1\0\7\2\1\0\27\2\1\0\37\2\1\0"+
"\1\2\1\0\4\2\2\0\7\2\1\0\47\2\1\0\23\2\16\0"+
"\11\10\56\0\125\2\14\0\u026c\2\2\0\10\2\12\0\32\2\5\0"+
"\113\2\25\0\15\2\1\0\4\2\16\0\22\2\16\0\22\2\16\0"+
"\15\2\1\0\3\2\17\0\64\2\43\0\1\2\4\0\1\2\3\0"+
"\12\10\46\0\12\10\6\0\130\2\10\0\51\2\127\0\35\2\51\0"+
"\12\10\36\2\2\0\5\2\u038b\0\154\2\224\0\234\2\4\0\132\2"+
"\6\0\26\2\2\0\6\2\2\0\46\2\2\0\6\2\2\0\10\2"+
"\1\0\2\2\1\0\5\2\3\0\1\2\36\0\2\2\1\0\3\2"+
"\4\0\12\10\1\0\1\2\21\0\1\2\1\0\6\2\3\0\3\2"+
"\1\0\4\2\3\0\2\2\1\0\1\2\1\0\2\2\3\0\2\2"+
"\3\0\3\2\3\0\14\2\26\0\1\2\25\0\12\10\25\0\10\2"+
"\1\0\3\2\1\0\27\2\1\0\12\2\1\0\5\2\3\0\1\2"+
"\32\0\2\2\6\0\2\2\4\0\12\10\25\0\10\2\1\0\3\2"+
"\1\0\27\2\1\0\12\2\1\0\5\2\3\0\1\2\40\0\1\2"+
"\1\0\2\2\4\0\12\10\1\0\2\2\22\0\10\2\1\0\3\2"+
"\1\0\51\2\2\0\1\2\20\0\1\2\21\0\2\2\4\0\12\10"+
"\12\0\6\2\5\0\22\2\3\0\30\2\1\0\11\2\1\0\1\2"+
"\2\0\7\2\72\0\60\2\1\0\2\2\14\0\7\2\11\0\12\10"+
"\47\0\2\2\1\0\1\2\2\0\2\2\1\0\1\2\2\0\1\2"+
"\6\0\4\2\1\0\7\2\1\0\3\2\1\0\1\2\1\0\1\2"+
"\2\0\2\2\1\0\4\2\1\0\2\2\11\0\1\2\2\0\5\2"+
"\1\0\1\2\11\0\12\10\2\0\4\2\40\0\1\2\37\0\12\10"+
"\26\0\10\2\1\0\44\2\33\0\5\2\163\0\53\2\24\0\1\2"+
"\12\10\6\0\6\2\4\0\4\2\3\0\1\2\3\0\2\2\7\0"+
"\3\2\4\0\15\2\14\0\1\2\1\0\12\10\6\0\46\2\1\0"+
"\1\2\5\0\1\2\2\0\53\2\1\0\u014d\2\1\0\4\2\2\0"+
"\7\2\1\0\1\2\1\0\4\2\2\0\51\2\1\0\4\2\2\0"+
"\41\2\1\0\4\2\2\0\7\2\1\0\1\2\1\0\4\2\2\0"+
"\17\2\1\0\71\2\1\0\4\2\2\0\103\2\45\0\20\2\20\0"+
"\125\2\14\0\u026c\2\2\0\21\2\1\0\32\2\5\0\113\2\25\0"+
"\15\2\1\0\4\2\16\0\22\2\16\0\22\2\16\0\15\2\1\0"+
"\3\2\17\0\64\2\43\0\1\2\4\0\1\2\3\0\12\10\46\0"+
"\12\10\6\0\130\2\10\0\51\2\1\0\1\2\5\0\106\2\12\0"+
"\35\2\51\0\12\10\36\2\2\0\5\2\13\0\54\2\25\0\7\2"+
"\10\0\12\10\46\0\27\2\11\0\65\2\53\0\12\10\6\0\12\10"+
"\15\0\1\2\135\0\57\2\21\0\7\2\4\0\12\10\51\0\36\2"+
"\15\0\2\2\12\10\54\2\32\0\44\2\34\0\12\10\3\0\3\2"+
"\12\10\44\2\153\0\4\2\1\0\4\2\3\0\2\2\11\0\300\2"+
"\100\0\u0116\2\2\0\6\2\2\0\46\2\2\0\6\2\2\0\10\2"+
"\1\0\1\2\1\0\1\2\1\0\1\2\1\0\37\2\2\0\65\2"+
"\1\0\7\2\1\0\1\2\3\0\3\2\1\0\7\2\3\0\4\2"+
"\2\0\6\2\4\0\15\2\5\0\3\2\1\0\7\2\164\0\1\2"+
"\15\0\1\2\202\0\1\2\4\0\1\2\2\0\12\2\1\0\1\2"+
"\3\0\5\2\6\0\1\2\1\0\1\2\1\0\1\2\1\0\4\2"+
"\1\0\3\2\1\0\7\2\3\0\3\2\5\0\5\2\u0ebb\0\2\2"+
"\52\0\5\2\5\0\2\2\4\0\126\2\6\0\3\2\1\0\132\2"+
"\1\0\4\2\5\0\50\2\4\0\136\2\21\0\30\2\70\0\20\2"+
"\u0200\0\u19b6\2\112\0\u51a6\2\132\0\u048d\2\u0773\0\u2ba4\2\u215c\0\u012e\2"+
"\2\0\73\2\225\0\7\2\14\0\5\2\5\0\1\2\1\0\12\2"+
"\1\0\15\2\1\0\5\2\1\0\1\2\1\0\2\2\1\0\2\2"+
"\1\0\154\2\41\0\u016b\2\22\0\100\2\2\0\66\2\50\0\14\2"+
"\164\0\5\2\1\0\207\2\23\0\12\10\7\0\32\2\6\0\32\2"+
"\13\0\131\2\3\0\6\2\2\0\6\2\2\0\6\2\2\0\3\2"+
"\43\0";
"\15\0\1\2\20\0\15\2\145\0\1\2\4\0\1\2\2\0\12\2"+
"\1\0\1\2\3\0\5\2\6\0\1\2\1\0\1\2\1\0\1\2"+
"\1\0\4\2\1\0\13\2\2\0\4\2\5\0\5\2\4\0\1\2"+
"\64\0\2\2\u0a7b\0\57\2\1\0\57\2\1\0\205\2\6\0\4\2"+
"\3\0\2\2\14\0\46\2\1\0\1\2\5\0\1\2\2\0\70\2"+
"\7\0\1\2\20\0\27\2\11\0\7\2\1\0\7\2\1\0\7\2"+
"\1\0\7\2\1\0\7\2\1\0\7\2\1\0\7\2\1\0\7\2"+
"\120\0\1\2\u01d5\0\2\2\52\0\5\2\5\0\2\2\4\0\126\2"+
"\6\0\3\2\1\0\132\2\1\0\4\2\5\0\51\2\3\0\136\2"+
"\21\0\33\2\65\0\20\2\u0200\0\u19b6\2\112\0\u51cd\2\63\0\u048d\2"+
"\103\0\56\2\2\0\u010d\2\3\0\20\2\12\10\2\2\24\0\57\2"+
"\20\0\31\2\10\0\106\2\61\0\11\2\2\0\147\2\2\0\4\2"+
"\1\0\4\2\14\0\13\2\115\0\12\2\1\0\3\2\1\0\4\2"+
"\1\0\27\2\35\0\64\2\16\0\62\2\34\0\12\10\30\0\6\2"+
"\3\0\1\2\4\0\12\10\34\2\12\0\27\2\31\0\35\2\7\0"+
"\57\2\34\0\1\2\12\10\46\0\51\2\27\0\3\2\1\0\10\2"+
"\4\0\12\10\6\0\27\2\3\0\1\2\5\0\60\2\1\0\1\2"+
"\3\0\2\2\2\0\5\2\2\0\1\2\1\0\1\2\30\0\3\2"+
"\2\0\13\2\7\0\3\2\14\0\6\2\2\0\6\2\2\0\6\2"+
"\11\0\7\2\1\0\7\2\221\0\43\2\15\0\12\10\6\0\u2ba4\2"+
"\14\0\27\2\4\0\61\2\u2104\0\u016e\2\2\0\152\2\46\0\7\2"+
"\14\0\5\2\5\0\1\2\1\0\12\2\1\0\15\2\1\0\5\2"+
"\1\0\1\2\1\0\2\2\1\0\2\2\1\0\154\2\41\0\u016b\2"+
"\22\0\100\2\2\0\66\2\50\0\14\2\164\0\5\2\1\0\207\2"+
"\23\0\12\10\7\0\32\2\6\0\32\2\13\0\131\2\3\0\6\2"+
"\2\0\6\2\2\0\6\2\2\0\3\2\43\0";
/**
* Translates characters to character classes
@@ -107,11 +127,11 @@ public class _CommandLineLexer implements FlexLexer {
private static final int [] ZZ_ACTION = zzUnpackAction();
private static final String ZZ_ACTION_PACKED_0 =
"\1\0\1\1\1\2\1\3\1\4\1\1\1\5\1\0"+
"\1\6\2\0\1\7";
"\1\0\1\1\1\2\1\3\1\4\1\1\1\5\1\6"+
"\1\7\1\0\1\10";
private static int [] zzUnpackAction() {
int [] result = new int[12];
int [] result = new int[11];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
@@ -136,11 +156,11 @@ public class _CommandLineLexer implements FlexLexer {
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
private static final String ZZ_ROWMAP_PACKED_0 =
"\0\0\0\15\0\32\0\47\0\64\0\101\0\15\0\116"+
"\0\15\0\133\0\150\0\165";
"\0\0\0\14\0\30\0\44\0\60\0\74\0\110\0\14"+
"\0\14\0\124\0\140";
private static int [] zzUnpackRowMap() {
int [] result = new int[12];
int [] result = new int[11];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
@@ -163,15 +183,15 @@ public class _CommandLineLexer implements FlexLexer {
private static final int [] ZZ_TRANS = zzUnpackTrans();
private static final String ZZ_TRANS_PACKED_0 =
"\1\2\1\3\1\4\1\2\1\4\3\2\2\5\1\2"+
"\1\6\1\7\16\0\1\3\16\0\5\4\1\0\1\4"+
"\6\0\3\5\1\10\2\0\1\5\5\0\1\11\1\0"+
"\1\11\6\0\1\12\13\0\1\13\4\0\1\14\1\0"+
"\1\14\17\0\1\5\10\0\2\14\4\0\1\14\1\0"+
"\1\14\1\0";
"\1\2\1\3\1\4\1\2\1\4\1\2\1\5\1\6"+
"\2\7\1\5\1\10\15\0\1\3\15\0\5\4\1\0"+
"\1\4\5\0\5\5\1\0\1\5\4\0\1\11\1\0"+
"\1\11\2\0\1\12\7\0\5\7\1\0\1\7\4\0"+
"\1\13\1\0\1\13\12\0\2\13\2\0\1\13\1\0"+
"\1\13\2\0";
private static int [] zzUnpackTrans() {
int [] result = new int[130];
int [] result = new int[108];
int offset = 0;
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
@@ -212,10 +232,10 @@ public class _CommandLineLexer implements FlexLexer {
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\1\0\1\11\4\1\1\11\1\0\1\11\2\0\1\1";
"\1\0\1\11\5\1\2\11\1\0\1\1";
private static int [] zzUnpackAttribute() {
int [] result = new int[12];
int [] result = new int[11];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
@@ -276,19 +296,15 @@ public class _CommandLineLexer implements FlexLexer {
}
/**
* Creates a new scanner
*
* @param in the java.io.Reader to read input from.
*/
public _CommandLineLexer(java.io.Reader in) {
this.zzReader = in;
}
/**
* Creates a new scanner.
* There is also java.io.Reader version of this constructor.
*
* @param in the java.io.Inputstream to read input from.
*/
public _CommandLineLexer(java.io.InputStream in) {
this(new java.io.InputStreamReader(in));
}
/**
* Unpacks the compressed character translation table.
@@ -300,7 +316,7 @@ public class _CommandLineLexer implements FlexLexer {
char [] map = new char[0x10000];
int i = 0; /* index in packed string */
int j = 0; /* index in unpacked array */
while (i < 1222) {
while (i < 1634) {
int count = packed.charAt(i++);
char value = packed.charAt(i++);
do map[j++] = value; while (--count > 0);
@@ -510,34 +526,38 @@ public class _CommandLineLexer implements FlexLexer {
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 4:
case 5:
{ return LITERAL_STARTS_FROM_DIGIT;
}
case 8: break;
case 9: break;
case 1:
{ return com.intellij.psi.TokenType.BAD_CHARACTER;
}
case 9: break;
case 10: break;
case 3:
{ return LITERAL_STARTS_FROM_LETTER;
}
case 10: break;
case 7:
{ return LONG_OPTION_NAME_TOKEN;
}
case 11: break;
case 5:
{ return EQ;
case 8:
{ return LONG_OPTION_NAME_TOKEN;
}
case 12: break;
case 6:
{ return SHORT_OPTION_NAME_TOKEN;
{ return EQ;
}
case 13: break;
case 7:
{ return SHORT_OPTION_NAME_TOKEN;
}
case 14: break;
case 4:
{ return LITERAL_STARTS_FROM_SYMBOL;
}
case 15: break;
case 2:
{ return com.intellij.psi.TokenType.WHITE_SPACE;
}
case 14: break;
case 16: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
@@ -1,13 +1,12 @@
// This is a generated file. Not intended for manual editing.
package com.jetbrains.commandInterface.commandLine.psi;
import java.util.List;
import org.jetbrains.annotations.*;
import com.intellij.psi.PsiElement;
import com.jetbrains.commandInterface.commandLine.CommandLinePart;
import com.jetbrains.commandInterface.command.Argument;
import com.jetbrains.commandInterface.command.Help;
import com.jetbrains.commandInterface.command.Option;
import com.jetbrains.commandInterface.commandLine.CommandLinePart;
import org.jetbrains.annotations.Nullable;
public interface CommandLineArgument extends CommandLinePart {
@@ -17,6 +16,9 @@ public interface CommandLineArgument extends CommandLinePart {
@Nullable
PsiElement getLiteralStartsFromLetter();
@Nullable
PsiElement getLiteralStartsFromSymbol();
@Nullable
Option findOptionForOptionArgument();
@@ -0,0 +1,62 @@
// This is a generated file. Not intended for manual editing.
package com.jetbrains.commandInterface.commandLine.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.jetbrains.commandInterface.command.Argument;
import com.jetbrains.commandInterface.command.Help;
import com.jetbrains.commandInterface.command.Option;
import com.jetbrains.commandInterface.commandLine.CommandLineElement;
import com.jetbrains.commandInterface.commandLine.psi.CommandLineArgument;
import com.jetbrains.commandInterface.commandLine.psi.CommandLineVisitor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import static com.jetbrains.commandInterface.commandLine.CommandLineElementTypes.*;
public class CommandLineArgumentImpl extends CommandLineElement implements CommandLineArgument {
public CommandLineArgumentImpl(ASTNode node) {
super(node);
}
public void accept(@NotNull PsiElementVisitor visitor) {
if (visitor instanceof CommandLineVisitor) ((CommandLineVisitor)visitor).visitArgument(this);
else super.accept(visitor);
}
@Override
@Nullable
public PsiElement getLiteralStartsFromDigit() {
return findChildByType(LITERAL_STARTS_FROM_DIGIT);
}
@Override
@Nullable
public PsiElement getLiteralStartsFromLetter() {
return findChildByType(LITERAL_STARTS_FROM_LETTER);
}
@Override
@Nullable
public PsiElement getLiteralStartsFromSymbol() {
return findChildByType(LITERAL_STARTS_FROM_SYMBOL);
}
@Nullable
public Option findOptionForOptionArgument() {
return CommandLinePsiImplUtils.findOptionForOptionArgument(this);
}
@Nullable
public Argument findRealArgument() {
return CommandLinePsiImplUtils.findRealArgument(this);
}
@Nullable
public Help findBestHelp() {
return CommandLinePsiImplUtils.findBestHelp(this);
}
}
@@ -25,8 +25,9 @@
tokens=[
space='regexp:\s+' // WARNING: Comment out or remove this (space) before generating Flex file! It is here only for live preview.
EQ = '='
LITERAL_STARTS_FROM_LETTER='regexp:\p{Alpha}(\w|:|\\|/|\.)*'
LITERAL_STARTS_FROM_DIGIT='regexp:\p{Digit}(\w|:|\\\|/|\.)*'
LITERAL_STARTS_FROM_LETTER='regexp:\p{Alpha}(\w|:|\\|/|\.|-)*'
LITERAL_STARTS_FROM_DIGIT='regexp:\p{Digit}(\w|:|\\|/|\.|-)*'
LITERAL_STARTS_FROM_SYMBOL='regexp:([/\~\.](\w|:|\\|/|\.|-)*)'
SHORT_OPTION_NAME_TOKEN='regexp:-\p{Alpha}'
LONG_OPTION_NAME_TOKEN='regexp:--\p{Alpha}(-|\w)*'
]
@@ -40,7 +41,6 @@ methods=[ getOptionName isLong findRealOption ]
}
private short_option_name ::= SHORT_OPTION_NAME_TOKEN
private long_option_name ::= LONG_OPTION_NAME_TOKEN
argument ::= LITERAL_STARTS_FROM_LETTER | LITERAL_STARTS_FROM_DIGIT {
argument ::= LITERAL_STARTS_FROM_LETTER | LITERAL_STARTS_FROM_DIGIT | LITERAL_STARTS_FROM_SYMBOL {
methods=[ findOptionForOptionArgument findRealArgument findBestHelp ]
}