fix for jscl and empty functions

This commit is contained in:
Sergey Solovyev
2011-10-13 13:58:51 +04:00
parent f3a3ea15c1
commit f71ec83706
4 changed files with 29 additions and 3 deletions

View File

@@ -139,7 +139,7 @@ public enum MathType {
@NotNull
private final String match;
private Result(@NotNull MathType mathType, @NotNull String match){
public Result(@NotNull MathType mathType, @NotNull String match){
this.mathType = mathType;
this.match = match;

View File

@@ -42,6 +42,14 @@ class ToJsclTextProcessor implements TextProcessor {
} else if (mathType == MathType.function) {
sb.append(toJsclFunction(mathTypeResult.getMatch()));
i += mathTypeResult.getMatch().length() - 1;
// NOTE: fix for jscl for EMPTY functions processing (see tests)
startsWithFinder.setI(i + 1);
if ( i < s.length() && CollectionsUtils.get(MathType.groupSymbols, startsWithFinder) != null) {
i += 2;
sb.append("(foo)");
mathTypeResult = new MathType.Result(MathType.close_group_symbol, ")");
}
} else if (mathType == MathType.constant) {
sb.append(mathTypeResult.getMatch());
i += mathTypeResult.getMatch().length() - 1;