Skip to content

Commit d056fa0

Browse files
User Constants with square brackets in name #161
1 parent 0502481 commit d056fa0

File tree

11 files changed

+133
-32
lines changed

11 files changed

+133
-32
lines changed

CURRENT/c-sharp/exe-lib-tests/Run-Tests-Reg/RunTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
namespace mxparser.runtests {
66
class RunTestsReg {
77
static void Main(string[] args) {
8-
RunTest.Start("api");
8+
//RunTest.Start("api");
99
//RunTest.Start("syn");
10-
//RunTest.Start("reg");
10+
RunTest.Start("reg");
1111
mXparser.consolePrintln(".NET CLR version:" + Environment.Version);
1212
mXparser.consolePrintln(".NET version:" + System.Diagnostics.FileVersionInfo.GetVersionInfo(typeof(int).Assembly.Location).ProductVersion);
1313
#if PCL

CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Constant.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* @(#)Constant.cs 4.3.0 2018-12-12
2+
* @(#)Constant.cs 4.3.0 2019-01-18
33
*
44
* You may use this software under the condition of "Simplified BSD License"
55
*
@@ -151,7 +151,7 @@ public class Constant : PrimitiveElement {
151151
*/
152152
public Constant(String constantName, double constantValue) : base(Constant.TYPE_ID) {
153153
relatedExpressionsList = new List<Expression>();
154-
if (mXparser.regexMatch(constantName, ParserSymbol.nameOnlyTokenRegExp)) {
154+
if (mXparser.regexMatch(constantName, ParserSymbol.nameOnlyTokenOptBracketsRegExp)) {
155155
this.constantName = constantName;
156156
this.constantValue = constantValue;
157157
description = "";
@@ -172,7 +172,7 @@ public Constant(String constantName, double constantValue) : base(Constant.TYPE_
172172
*/
173173
public Constant(String constantName, double constantValue, String description) : base(Constant.TYPE_ID) {
174174
relatedExpressionsList = new List<Expression>();
175-
if (mXparser.regexMatch(constantName, ParserSymbol.nameOnlyTokenRegExp)) {
175+
if (mXparser.regexMatch(constantName, ParserSymbol.nameOnlyTokenOptBracketsRegExp)) {
176176
this.constantName = constantName;
177177
this.constantValue = constantValue;
178178
this.description = description;
@@ -198,7 +198,7 @@ public Constant(String constantDefinitionString, params PrimitiveElement[] eleme
198198
description = "";
199199
syntaxStatus = SYNTAX_ERROR_OR_STATUS_UNKNOWN;
200200
relatedExpressionsList = new List<Expression>();
201-
if (mXparser.regexMatch(constantDefinitionString, ParserSymbol.constArgDefStrRegExp))
201+
if (mXparser.regexMatch(constantDefinitionString, ParserSymbol.constUnitgDefStrRegExp))
202202
{
203203
HeadEqBody headEqBody = new HeadEqBody(constantDefinitionString);
204204
constantName = headEqBody.headTokens[0].tokenStr;
@@ -224,7 +224,7 @@ public String getConstantName() {
224224
* @param constantName the constant name
225225
*/
226226
public void setConstantName(String constantName) {
227-
if (mXparser.regexMatch(constantName, ParserSymbol.nameOnlyTokenRegExp)) {
227+
if (mXparser.regexMatch(constantName, ParserSymbol.nameOnlyTokenOptBracketsRegExp)) {
228228
this.constantName = constantName;
229229
setExpressionModifiedFlags();
230230
}

CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/mXparser.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ public sealed class mXparser {
143143
* sin(pi) = 0
144144
*/
145145
internal volatile static bool almostIntRounding = true;
146+
internal const int DEFAULT_MAX_RECURSION_CALLS = 200;
146147
/**
147148
* Internal limit for counter to avoid infinite loops while calculating
148149
* expression defined in the way shown by below examples
@@ -157,7 +158,7 @@ public sealed class mXparser {
157158
* f.addDefinitions(g);
158159
* g.addDefinitions(f);
159160
*/
160-
internal volatile static int MAX_RECURSION_CALLS = 200;
161+
internal volatile static int MAX_RECURSION_CALLS = DEFAULT_MAX_RECURSION_CALLS;
161162
/**
162163
* List of built-in tokens to remove.
163164
*/
@@ -775,6 +776,23 @@ public static void setNotToOverrideBuiltinTokens() {
775776
public static bool checkIfsetToOverrideBuiltinTokens() {
776777
return overrideBuiltinTokens;
777778
}
779+
/**
780+
* Sets default mXparser options
781+
*
782+
*/
783+
public static void setDefaultOptions() {
784+
enableUlpRounding();
785+
enableAlmostIntRounding();
786+
setMaxAllowedRecursionDepth(DEFAULT_MAX_RECURSION_CALLS);
787+
setNotToOverrideBuiltinTokens();
788+
unmodifyAllBuiltinTokens();
789+
setRadiansMode();
790+
resetCancelCurrentCalculationFlag();
791+
setDefaultEpsilon();
792+
setEpsilonComparison();
793+
setToFractionInitSearchSize(NumberTheory.DEFAULT_TO_FRACTION_INIT_SEARCH_SIZE);
794+
optionsChangesetNumber++;
795+
}
778796
/**
779797
* Returns token type description.
780798
*

CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/mathcollection/NumberTheory.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,12 @@ namespace org.mariuszgromada.math.mxparser.mathcollection {
8282
*/
8383
[CLSCompliant(true)]
8484
public sealed class NumberTheory {
85+
public static long DEFAULT_TO_FRACTION_INIT_SEARCH_SIZE = 10000;
8586
/**
8687
* Initial search size 1 ... n for the toFraction method
8788
* @see NumberTheory#toFraction(double)
8889
*/
89-
private static long TO_FRACTION_INIT_SEARCH_SIZE = 10000;
90+
private static long TO_FRACTION_INIT_SEARCH_SIZE = DEFAULT_TO_FRACTION_INIT_SEARCH_SIZE;
9091
/**
9192
* Sets initial search size for the toFraction method
9293
*

CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/parsertokens/ParserSymbol.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* @(#)ParserSymbol.cs 4.2.0 2018-07-15
2+
* @(#)ParserSymbol.cs 4.3.0 2019-01-18
33
*
44
* You may use this software under the condition of "Simplified BSD License"
55
*
@@ -76,7 +76,7 @@ namespace org.mariuszgromada.math.mxparser.parsertokens {
7676
* <a href="https://play.google.com/store/apps/details?id=org.mathparser.scalar.pro" target="_blank">Scalar Pro</a><br>
7777
* <a href="http://scalarmath.org/" target="_blank">ScalarMath.org</a><br>
7878
*
79-
* @version 4.2.0
79+
* @version 4.3.0
8080
*/
8181
[CLSCompliant(true)]
8282
public sealed class ParserSymbol {
@@ -127,6 +127,7 @@ public sealed class ParserSymbol {
127127
public const String DEC_FRACT = "(" + INTEGER + ")?" + "\\." + INTEGER;
128128
public const String DEC_FRACT_OR_INT = "(" + DEC_FRACT + "|" + INTEGER + ")";
129129
public const String DECIMAL_REG_EXP = "[+-]?" + DEC_FRACT_OR_INT + "([eE][+-]?" + INTEGER + ")?";
130+
public const String DECIMAL_SCIENTIFIC_REG_EXP = "[+-]?" + DEC_FRACT_OR_INT + "([eE][+-]?" + INTEGER + ")";
130131
public const String BASE1_REG_EXP = "[+-]?[bB]1\\.(" + DIGIT_B1 + ")*";
131132
public const String BASE2_REG_EXP = "[+-]?[bB][2]?\\." + DIGIT_B2 + "(" + DIGIT_B2 + ")*";
132133
public const String BASE3_REG_EXP = "[+-]?[bB]3\\." + DIGIT_B3 + "(" + DIGIT_B3 + ")*";
@@ -165,9 +166,12 @@ public sealed class ParserSymbol {
165166
public const String BASE36_REG_EXP = "[+-]?[bB]36\\." + DIGIT_B36 + "(" + DIGIT_B36 + ")*";
166167
public const String FRACTION = "(" + INTEGER + "_)?" + INTEGER + "_" + INTEGER;
167168
public const String nameOnlyTokenRegExp = "([a-zA-Z_])+([a-zA-Z0-9_])*";
169+
public const String nameOnlyTokenOptBracketsRegExp = "(" + nameOnlyTokenRegExp + "|" + "\\[" + nameOnlyTokenRegExp + "\\]" + ")";
168170
public const String nameTokenRegExp = "(\\s)*" + nameOnlyTokenRegExp + "(\\s)*";
171+
public const String nameTokenOptBracketsRegExp = "(\\s)*" + nameOnlyTokenOptBracketsRegExp + "(\\s)*";
169172
public const String paramsTokenRegeExp = "(\\s)*\\(" + "(" + nameTokenRegExp + ",(\\s)*)*" + nameTokenRegExp + "\\)(\\s)*";
170173
public const String constArgDefStrRegExp = nameTokenRegExp + "=" + "(\\s)*(.)+(\\s)*";
174+
public const String constUnitgDefStrRegExp = nameTokenOptBracketsRegExp + "=" + "(\\s)*(.)+(\\s)*";
171175
public const String functionDefStrRegExp = nameTokenRegExp + paramsTokenRegeExp + "=" + "(\\s)*(.)+(\\s)*";
172176
public const String function1ArgDefStrRegExp = nameTokenRegExp + "(\\s)*\\(" + nameTokenRegExp + "(\\s)*\\)(\\s)*" + "=" + "(\\s)*(.)+(\\s)*";
173177
public const String functionVariadicDefStrRegExp = nameTokenRegExp + "(\\s)*" + "\\(" + "(\\s)*" + "\\.\\.\\." + "(\\s)*" + "\\)" + "(\\s)*" + "=" + "(\\s)*(.)+(\\s)*";

CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/regressiontesting/RegTestExpression.cs

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14050,6 +14050,32 @@ private static bool runTest_01101_01200(int testId) {
1405014050
testResult = true;
1405114051
mXparser.consolePrint(value + " reg ... " + reg + " --> ");
1405214052
break;
14053+
case 1162:
14054+
mXparser.enableAlmostIntRounding();
14055+
mXparser.enableUlpRounding();
14056+
expStr = "2 * [xyz], [xyz] = 3";
14057+
Constant xyz = new Constant("[xyz] = 3");
14058+
mXparser.consolePrint(expStr + " ...... ");
14059+
exp[testId] = new Expression("2 * [xyz]", xyz);
14060+
value = exp[testId].calculate();
14061+
reg = 6;
14062+
if ( MathFunctions.abs(reg - value) <= 1e-14 )
14063+
testResult = true;
14064+
mXparser.consolePrint(value + " reg ... " + reg + " --> ");
14065+
break;
14066+
case 1163:
14067+
mXparser.enableAlmostIntRounding();
14068+
mXparser.enableUlpRounding();
14069+
expStr = "2 * [abc], [abc] = -3";
14070+
Constant abc = new Constant("[abc]", -3);
14071+
mXparser.consolePrint(expStr + " ...... ");
14072+
exp[testId] = new Expression("2 * [abc]", abc);
14073+
value = exp[testId].calculate();
14074+
reg = -6;
14075+
if ( MathFunctions.abs(reg - value) <= 1e-14 )
14076+
testResult = true;
14077+
mXparser.consolePrint(value + " reg ... " + reg + " --> ");
14078+
break;
1405314079
}
1405414080
if (testResult == true)
1405514081
mXparser.consolePrint("OK");
@@ -14063,8 +14089,9 @@ private static bool runTest_01101_01200(int testId) {
1406314089
* @param args no parameters are being considered
1406414090
* @return Number of tests with error result.
1406514091
*/
14066-
public static int Start() {
14067-
int numberOfTests = 1161;
14092+
public static int Start(int numOfTests) {
14093+
mXparser.setDefaultOptions();
14094+
int numberOfTests = numOfTests;
1406814095
int nOk = 0;
1406914096
int nError = 0;
1407014097
exp = new Expression[numberOfTests+1];
@@ -14094,7 +14121,7 @@ public static int Start() {
1409414121
nOk++;
1409514122
else
1409614123
nError++;
14097-
if (!exp[testId].checkSyntax())
14124+
if (!exp[testId].checkSyntax() && testId > 0)
1409814125
mXparser.consolePrintln(exp[testId].getErrorMessage());
1409914126
mXparser.consolePrintln(", time: " + exp[testId].getComputingTime() + " s.");
1410014127
}
@@ -14108,6 +14135,13 @@ public static int Start() {
1410814135
mXparser.resetCancelCurrentCalculationFlag();
1410914136
return nError;
1411014137
}
14138+
/**
14139+
* Runs main regression tests in the field of calculation.
14140+
* @return Number of tests with error result.
14141+
*/
14142+
public static int Start() {
14143+
return Start(1163);
14144+
}
1411114145
/**
1411214146
* Runs main regression tests in the field of calculation.
1411314147
*

CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/regressiontesting/RegTestExpressionAPI.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public class RegTestExpressionAPI {
9191
*
9292
* @return Number of tests with error result.
9393
*/
94-
public static int Start() {
94+
public static int Start(int fractionIterations) {
9595
long start = mXparser.currentTimeMillis();
9696
bool syn1, syn2, syn3, syn4, syn5, syn6, syn7, syn8, b1, b2, b3;
9797
String s1, s2;
@@ -989,7 +989,7 @@ public static int Start() {
989989
*/
990990
testId++;
991991
test[testId] = true;
992-
for (int decimalNumber = -1000; decimalNumber < 1000; decimalNumber++)
992+
for (int decimalNumber = -fractionIterations; decimalNumber < fractionIterations; decimalNumber++)
993993
for (int numeralSystemBase = 1; numeralSystemBase <= 36; numeralSystemBase++) {
994994
if (mXparser.isCurrentCalculationCancelled()) return -1;
995995
if (NumberTheory.convOthBase2Decimal(NumberTheory.convDecimal2OthBase(decimalNumber, numeralSystemBase), numeralSystemBase) != decimalNumber) {
@@ -1032,7 +1032,7 @@ public static int Start() {
10321032
*/
10331033
testId++;
10341034
test[testId] = true;
1035-
for (int decimalNumber = -1000; decimalNumber < 1000; decimalNumber++)
1035+
for (int decimalNumber = -fractionIterations; decimalNumber < fractionIterations; decimalNumber++)
10361036
for (int numeralSystemBase = 1; numeralSystemBase <= 36; numeralSystemBase++) {
10371037
if (mXparser.isCurrentCalculationCancelled()) return -1;
10381038
if (NumberTheory.convOthBase2Decimal(NumberTheory.convDecimal2OthBase(decimalNumber, numeralSystemBase, 1)) != decimalNumber) {
@@ -1045,7 +1045,7 @@ public static int Start() {
10451045
*/
10461046
testId++;
10471047
test[testId] = true;
1048-
for (int decimalNumber = -10000; decimalNumber < 10000; decimalNumber++)
1048+
for (int decimalNumber = -fractionIterations; decimalNumber < fractionIterations; decimalNumber++)
10491049
for (int numeralSystemBase = 1; numeralSystemBase <= 36; numeralSystemBase++) {
10501050
if (mXparser.isCurrentCalculationCancelled()) return -1;
10511051
if (NumberTheory.convOthBase2Decimal(NumberTheory.convDecimal2OthBase(decimalNumber, numeralSystemBase, 2)) != decimalNumber) {
@@ -1058,7 +1058,7 @@ public static int Start() {
10581058
*/
10591059
testId++;
10601060
test[testId] = true;
1061-
for (int decimalNumber = -1000; decimalNumber < 1000; decimalNumber++)
1061+
for (int decimalNumber = -fractionIterations; decimalNumber < fractionIterations; decimalNumber++)
10621062
for (int numeralSystemBase = 1; numeralSystemBase <= 36; numeralSystemBase++) {
10631063
if (mXparser.isCurrentCalculationCancelled()) return -1;
10641064
if (NumberTheory.convOthBase2Decimal(NumberTheory.convDecimal2OthBase(decimalNumber, numeralSystemBase, 0), numeralSystemBase) != decimalNumber) {
@@ -2271,6 +2271,13 @@ public static int Start() {
22712271
mXparser.resetCancelCurrentCalculationFlag();
22722272
return nError;
22732273
}
2274+
/**
2275+
* Runs main regression tests in the field of calculation.
2276+
* @return Number of tests with error result.
2277+
*/
2278+
public static int Start() {
2279+
return Start(10000);
2280+
}
22742281
/**
22752282
* Runs API regression tests.
22762283
*/

CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/regressiontesting/RegTestSyntax.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2958,8 +2958,9 @@ private static bool runTest(int testId) {
29582958
/**
29592959
* Runs syntax checking regression test.
29602960
*/
2961-
public static int Start() {
2962-
int numberOfTests = 244;
2961+
public static int Start(int numOfTests) {
2962+
mXparser.setDefaultOptions();
2963+
int numberOfTests = numOfTests;
29632964
int nOk = 0;
29642965
int nError = 0;
29652966
exp = new Expression[numberOfTests+1];
@@ -2985,6 +2986,13 @@ public static int Start() {
29852986
mXparser.resetCancelCurrentCalculationFlag();
29862987
return nError;
29872988
}
2989+
/**
2990+
* Runs main regression tests in the field of calculation.
2991+
* @return Number of tests with error result.
2992+
*/
2993+
public static int Start() {
2994+
return Start(244);
2995+
}
29882996
/**
29892997
* Runs syntax checking regression test.
29902998
*

CURRENT/java/src/org/mariuszgromada/math/mxparser/Constant.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* @(#)Constant.java 4.3.0 2018-12-12
2+
* @(#)Constant.java 4.3.0 2019-01-18
33
*
44
* You may use this software under the condition of "Simplified BSD License"
55
*
@@ -153,15 +153,15 @@ public Constant(String constantName
153153
,double constantValue) {
154154
super(Constant.TYPE_ID);
155155
relatedExpressionsList = new ArrayList<Expression>();
156-
if ( mXparser.regexMatch(constantName, ParserSymbol.nameOnlyTokenRegExp) ) {
156+
if ( mXparser.regexMatch(constantName, ParserSymbol.nameOnlyTokenOptBracketsRegExp) ) {
157157
this.constantName = constantName;
158158
this.constantValue = constantValue;
159159
description = "";
160160
syntaxStatus = NO_SYNTAX_ERRORS;
161161
errorMessage = NO_SYNTAX_ERROR_MSG;
162162
} else {
163163
syntaxStatus = SYNTAX_ERROR_OR_STATUS_UNKNOWN;
164-
errorMessage = "[" + constantName + "] " + "--> invalid constant name, pattern not mathes: " + ParserSymbol.nameTokenRegExp;;
164+
errorMessage = "[" + constantName + "] " + "--> invalid constant name, pattern not mathes: " + ParserSymbol.nameOnlyTokenOptBracketsRegExp;;
165165
}
166166
}
167167
/**
@@ -177,15 +177,15 @@ public Constant(String constantName
177177
,String description) {
178178
super(Constant.TYPE_ID);
179179
relatedExpressionsList = new ArrayList<Expression>();
180-
if ( mXparser.regexMatch(constantName, ParserSymbol.nameOnlyTokenRegExp) ) {
180+
if ( mXparser.regexMatch(constantName, ParserSymbol.nameOnlyTokenOptBracketsRegExp) ) {
181181
this.constantName = constantName;
182182
this.constantValue = constantValue;
183183
this.description = description;
184184
syntaxStatus = NO_SYNTAX_ERRORS;
185185
errorMessage = NO_SYNTAX_ERROR_MSG;
186186
} else {
187187
syntaxStatus = SYNTAX_ERROR_OR_STATUS_UNKNOWN;
188-
errorMessage = "[" + constantName + "] " + "--> invalid constant name, pattern not mathes: " + ParserSymbol.nameTokenRegExp;;
188+
errorMessage = "[" + constantName + "] " + "--> invalid constant name, pattern not mathes: " + ParserSymbol.nameOnlyTokenOptBracketsRegExp;;
189189
}
190190
}
191191
/**
@@ -203,14 +203,14 @@ public Constant(String constantDefinitionString, PrimitiveElement...elements) {
203203
description = "";
204204
syntaxStatus = SYNTAX_ERROR_OR_STATUS_UNKNOWN;
205205
relatedExpressionsList = new ArrayList<Expression>();
206-
if ( mXparser.regexMatch(constantDefinitionString, ParserSymbol.constArgDefStrRegExp) ) {
206+
if ( mXparser.regexMatch(constantDefinitionString, ParserSymbol.constUnitgDefStrRegExp) ) {
207207
HeadEqBody headEqBody = new HeadEqBody(constantDefinitionString);
208208
constantName = headEqBody.headTokens.get(0).tokenStr;
209209
Expression bodyExpression = new Expression(headEqBody.bodyStr, elements);
210210
constantValue = bodyExpression.calculate();
211211
syntaxStatus = bodyExpression.getSyntaxStatus();
212212
errorMessage = bodyExpression.getErrorMessage();
213-
} else errorMessage = "[" + constantDefinitionString + "] " + "--> pattern not mathes: " + ParserSymbol.constArgDefStrRegExp;
213+
} else errorMessage = "[" + constantDefinitionString + "] " + "--> pattern not mathes: " + ParserSymbol.constUnitgDefStrRegExp;
214214
}
215215
/**
216216
* Gets constant name
@@ -227,12 +227,12 @@ public String getConstantName() {
227227
* @param constantName the constant name
228228
*/
229229
public void setConstantName(String constantName) {
230-
if ( mXparser.regexMatch(constantName, ParserSymbol.nameOnlyTokenRegExp) ) {
230+
if ( mXparser.regexMatch(constantName, ParserSymbol.nameOnlyTokenOptBracketsRegExp) ) {
231231
this.constantName = constantName;
232232
setExpressionModifiedFlags();
233233
} else {
234234
syntaxStatus = SYNTAX_ERROR_OR_STATUS_UNKNOWN;
235-
errorMessage = "[" + constantName + "] " + "--> invalid constant name, pattern not mathes: " + ParserSymbol.nameTokenRegExp;;
235+
errorMessage = "[" + constantName + "] " + "--> invalid constant name, pattern not mathes: " + ParserSymbol.nameOnlyTokenOptBracketsRegExp;;
236236
}
237237
}
238238
/**

CURRENT/java/src/org/mariuszgromada/math/mxparser/parsertokens/ParserSymbol.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* @(#)ParserSymbol.java 4.2.0 2018-07-15
2+
* @(#)ParserSymbol.java 4.3.0 2019-01-18
33
*
44
* You may use this software under the condition of "Simplified BSD License"
55
*
@@ -162,9 +162,12 @@ public final class ParserSymbol {
162162
public static final String BASE36_REG_EXP = "[+-]?[bB]36\\." + DIGIT_B36 + "(" + DIGIT_B36 + ")*";
163163
public static final String FRACTION = "(" + INTEGER + "\\_)?" + INTEGER + "\\_" + INTEGER;
164164
public static final String nameOnlyTokenRegExp = "([a-zA-Z_])+([a-zA-Z0-9_])*";
165+
public static final String nameOnlyTokenOptBracketsRegExp = "(" + nameOnlyTokenRegExp + "|" + "\\[" + nameOnlyTokenRegExp + "\\]" + ")";
165166
public static final String nameTokenRegExp = "(\\s)*" + nameOnlyTokenRegExp + "(\\s)*";
167+
public static final String nameTokenOptBracketsRegExp = "(\\s)*" + nameOnlyTokenOptBracketsRegExp + "(\\s)*";
166168
public static final String paramsTokenRegeExp = "(\\s)*\\(" + "(" + nameTokenRegExp + ",(\\s)*)*" + nameTokenRegExp + "\\)(\\s)*";
167169
public static final String constArgDefStrRegExp = nameTokenRegExp + "=" + "(\\s)*(.)+(\\s)*";
170+
public static final String constUnitgDefStrRegExp = nameTokenOptBracketsRegExp + "=" + "(\\s)*(.)+(\\s)*";
168171
public static final String functionDefStrRegExp = nameTokenRegExp + paramsTokenRegeExp + "=" + "(\\s)*(.)+(\\s)*";
169172
public static final String function1ArgDefStrRegExp = nameTokenRegExp + "(\\s)*\\(" + nameTokenRegExp + "(\\s)*\\)(\\s)*" + "=" + "(\\s)*(.)+(\\s)*";
170173
public static final String functionVariadicDefStrRegExp = nameTokenRegExp + "(\\s)*" + "\\(" + "(\\s)*" + "\\.\\.\\." + "(\\s)*" + "\\)" + "(\\s)*" + "=" + "(\\s)*(.)+(\\s)*";

0 commit comments

Comments
 (0)