reformat for lint
This commit is contained in:
parent
06ec2caae0
commit
ecc82ba8f7
|
@ -18,20 +18,16 @@ let testMacro_ = (
|
||||||
) => {
|
) => {
|
||||||
let bindings = Bindings.fromArray(bindArray)
|
let bindings = Bindings.fromArray(bindArray)
|
||||||
tester(expr->T.toString, () => {
|
tester(expr->T.toString, () => {
|
||||||
let result = switch expr
|
let result = switch expr->Reducer_Dispatch_BuiltInMacros.dispatchMacroCall(
|
||||||
->Reducer_Dispatch_BuiltInMacros.dispatchMacroCall(
|
|
||||||
bindings,
|
bindings,
|
||||||
ProjectAccessorsT.identityAccessors,
|
ProjectAccessorsT.identityAccessors,
|
||||||
Expression.reduceExpressionInProject,
|
Expression.reduceExpressionInProject,
|
||||||
) {
|
) {
|
||||||
| v => Ok(v)
|
| v => Ok(v)
|
||||||
| exception Reducer_ErrorValue.ErrorException(e) => Error(e)
|
| exception Reducer_ErrorValue.ErrorException(e) => Error(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
result
|
result->ExpressionWithContext.toStringResult->expect->toEqual(expectedCode)
|
||||||
->ExpressionWithContext.toStringResult
|
|
||||||
->expect
|
|
||||||
->toEqual(expectedCode)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -261,13 +261,13 @@ module DiminishingReturns = {
|
||||||
This is currently being done with a reducer, that keeps track of:
|
This is currently being done with a reducer, that keeps track of:
|
||||||
- Value of marginal spending for each function
|
- Value of marginal spending for each function
|
||||||
- How much has been assigned to each function.
|
- How much has been assigned to each function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Two possible algorithms (n=funds/increment, m=num lambdas)
|
Two possible algorithms (n=funds/increment, m=num lambdas)
|
||||||
1. O(n): Iterate through value on next n dollars. At each step, only compute the new marginal return of the function which is spent. (This is what we are doing.)
|
1. O(n): Iterate through value on next n dollars. At each step, only compute the new marginal return of the function which is spent. (This is what we are doing.)
|
||||||
2. O(n*(m-1)): Iterate through all possible spending combinations. The advantage of this option is that it wouldn't assume that the returns of marginal spending are diminishing.
|
2. O(n*(m-1)): Iterate through all possible spending combinations. The advantage of this option is that it wouldn't assume that the returns of marginal spending are diminishing.
|
||||||
*/
|
*/
|
||||||
let optimalAllocationGivenDiminishingMarginalReturnsForManyFunctions = (
|
let optimalAllocationGivenDiminishingMarginalReturnsForManyFunctions = (
|
||||||
lambdas,
|
lambdas,
|
||||||
funds,
|
funds,
|
||||||
|
@ -275,7 +275,6 @@ module DiminishingReturns = {
|
||||||
environment,
|
environment,
|
||||||
reducer,
|
reducer,
|
||||||
) => {
|
) => {
|
||||||
|
|
||||||
switch (
|
switch (
|
||||||
E.A.length(lambdas) > 1,
|
E.A.length(lambdas) > 1,
|
||||||
funds > 0.0,
|
funds > 0.0,
|
||||||
|
@ -310,7 +309,8 @@ module DiminishingReturns = {
|
||||||
)
|
)
|
||||||
switch resultAsInternalExpression {
|
switch resultAsInternalExpression {
|
||||||
| IEvNumber(x) => Ok(x)
|
| IEvNumber(x) => Ok(x)
|
||||||
| _ => Error(
|
| _ =>
|
||||||
|
Error(
|
||||||
"Error 1 in Danger.optimalAllocationGivenDiminishingMarginalReturnsForManyFunctions. It's possible that your function doesn't return a number, try definining auxiliaryFunction(x) = mean(yourFunction(x)) and integrate auxiliaryFunction instead",
|
"Error 1 in Danger.optimalAllocationGivenDiminishingMarginalReturnsForManyFunctions. It's possible that your function doesn't return a number, try definining auxiliaryFunction(x) = mean(yourFunction(x)) and integrate auxiliaryFunction instead",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -452,5 +452,5 @@ let library = [
|
||||||
// will only depend on num points and the complexity of the function
|
// will only depend on num points and the complexity of the function
|
||||||
|
|
||||||
// Diminishing marginal return functions
|
// Diminishing marginal return functions
|
||||||
DiminishingReturns.Lib.optimalAllocationGivenDiminishingMarginalReturnsForManyFunctions
|
DiminishingReturns.Lib.optimalAllocationGivenDiminishingMarginalReturnsForManyFunctions,
|
||||||
]
|
]
|
||||||
|
|
|
@ -41,7 +41,7 @@ module Internals = {
|
||||||
(reducer: ProjectReducerFnT.t),
|
(reducer: ProjectReducerFnT.t),
|
||||||
)
|
)
|
||||||
list{newElem, ...acc}
|
list{newElem, ...acc}
|
||||||
})
|
})
|
||||||
mappedList->Belt.List.toArray->Wrappers.evArray
|
mappedList->Belt.List.toArray->Wrappers.evArray
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,8 +83,8 @@ module Internals = {
|
||||||
reducer,
|
reducer,
|
||||||
)
|
)
|
||||||
switch newElem {
|
switch newElem {
|
||||||
| IEvBool(true) => list{elem, ...acc}
|
| IEvBool(true) => list{elem, ...acc}
|
||||||
| _ => acc
|
| _ => acc
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
mappedList->Belt.List.toArray->Wrappers.evArray
|
mappedList->Belt.List.toArray->Wrappers.evArray
|
||||||
|
@ -244,13 +244,7 @@ let library = [
|
||||||
~run=(inputs, _, accessors: ProjectAccessorsT.t, reducer: ProjectReducerFnT.t) =>
|
~run=(inputs, _, accessors: ProjectAccessorsT.t, reducer: ProjectReducerFnT.t) =>
|
||||||
switch inputs {
|
switch inputs {
|
||||||
| [IEvArray(array), initialValue, IEvLambda(lambda)] =>
|
| [IEvArray(array), initialValue, IEvLambda(lambda)] =>
|
||||||
Ok(Internals.reduceReverse(
|
Ok(Internals.reduceReverse(array, initialValue, lambda, accessors, reducer))
|
||||||
array,
|
|
||||||
initialValue,
|
|
||||||
lambda,
|
|
||||||
accessors,
|
|
||||||
reducer,
|
|
||||||
))
|
|
||||||
| _ => Error(impossibleError)
|
| _ => Error(impossibleError)
|
||||||
},
|
},
|
||||||
(),
|
(),
|
||||||
|
|
|
@ -13,7 +13,6 @@ module TypeBuilder = Reducer_Type_TypeBuilder
|
||||||
open ReducerInterface_InternalExpressionValue
|
open ReducerInterface_InternalExpressionValue
|
||||||
open Reducer_ErrorValue
|
open Reducer_ErrorValue
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
MathJs provides default implementations for built-ins
|
MathJs provides default implementations for built-ins
|
||||||
This is where all the expected built-ins like + = * / sin cos log ln etc are handled
|
This is where all the expected built-ins like + = * / sin cos log ln etc are handled
|
||||||
|
@ -213,6 +212,7 @@ let dispatch = (
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
| ErrorException(e) => raise(ErrorException(e))
|
| ErrorException(e) => raise(ErrorException(e))
|
||||||
| Js.Exn.Error(obj) => raise(ErrorException(REJavaScriptExn(Js.Exn.message(obj), Js.Exn.name(obj))))
|
| Js.Exn.Error(obj) =>
|
||||||
|
raise(ErrorException(REJavaScriptExn(Js.Exn.message(obj), Js.Exn.name(obj))))
|
||||||
| _ => raise(ErrorException(RETodo("unhandled rescript exception")))
|
| _ => raise(ErrorException(RETodo("unhandled rescript exception")))
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,10 +32,7 @@ let dispatchMacroCall = (
|
||||||
|
|
||||||
let boundStatement = BindingsReplacer.replaceSymbols(newBindings, statement)
|
let boundStatement = BindingsReplacer.replaceSymbols(newBindings, statement)
|
||||||
|
|
||||||
ExpressionWithContext.withContext(
|
ExpressionWithContext.withContext(newCode(newBindings->eModule, boundStatement), newBindings)
|
||||||
newCode(newBindings->eModule, boundStatement),
|
|
||||||
newBindings,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let correspondingSetBindingsFn = (fnName: string): string =>
|
let correspondingSetBindingsFn = (fnName: string): string =>
|
||||||
|
@ -65,7 +62,11 @@ let dispatchMacroCall = (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let doBindExpression = (bindingExpr: expression, statement: expression, accessors): expressionWithContext => {
|
let doBindExpression = (
|
||||||
|
bindingExpr: expression,
|
||||||
|
statement: expression,
|
||||||
|
accessors,
|
||||||
|
): expressionWithContext => {
|
||||||
let defaultStatement = () =>
|
let defaultStatement = () =>
|
||||||
useExpressionToSetBindings(bindingExpr, accessors, statement, (
|
useExpressionToSetBindings(bindingExpr, accessors, statement, (
|
||||||
_newBindingsExpr,
|
_newBindingsExpr,
|
||||||
|
@ -93,7 +94,11 @@ let dispatchMacroCall = (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let doBlock = (exprs: list<expression>, _bindings: ExpressionT.bindings, _accessors): expressionWithContext => {
|
let doBlock = (
|
||||||
|
exprs: list<expression>,
|
||||||
|
_bindings: ExpressionT.bindings,
|
||||||
|
_accessors,
|
||||||
|
): expressionWithContext => {
|
||||||
let exprsArray = Belt.List.toArray(exprs)
|
let exprsArray = Belt.List.toArray(exprs)
|
||||||
let maxIndex = Js.Array2.length(exprsArray) - 1
|
let maxIndex = Js.Array2.length(exprsArray) - 1
|
||||||
let newStatement = exprsArray->Js.Array2.reducei((acc, statement, index) =>
|
let newStatement = exprsArray->Js.Array2.reducei((acc, statement, index) =>
|
||||||
|
@ -141,8 +146,11 @@ let dispatchMacroCall = (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let expandExpressionList = (aList, bindings: ExpressionT.bindings, accessors): expressionWithContext
|
let expandExpressionList = (
|
||||||
=>
|
aList,
|
||||||
|
bindings: ExpressionT.bindings,
|
||||||
|
accessors,
|
||||||
|
): expressionWithContext =>
|
||||||
switch aList {
|
switch aList {
|
||||||
| list{
|
| list{
|
||||||
ExpressionT.EValue(IEvCall("$$_bindStatement_$$")),
|
ExpressionT.EValue(IEvCall("$$_bindStatement_$$")),
|
||||||
|
|
|
@ -44,11 +44,10 @@ and reduceExpressionList = (
|
||||||
continuation: T.bindings,
|
continuation: T.bindings,
|
||||||
accessors: ProjectAccessorsT.t,
|
accessors: ProjectAccessorsT.t,
|
||||||
): InternalExpressionValue.t => {
|
): InternalExpressionValue.t => {
|
||||||
let acc: list<InternalExpressionValue.t> = expressions->Belt.List.reduceReverse(list{}, (acc, each: t) =>
|
let acc: list<InternalExpressionValue.t> =
|
||||||
acc->Belt.List.add(
|
expressions->Belt.List.reduceReverse(list{}, (acc, each: t) =>
|
||||||
each->reduceExpressionInProject(continuation, accessors)
|
acc->Belt.List.add(each->reduceExpressionInProject(continuation, accessors))
|
||||||
)
|
)
|
||||||
)
|
|
||||||
acc->reduceValueList(accessors)
|
acc->reduceValueList(accessors)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,17 +72,12 @@ and reduceValueList = (
|
||||||
}
|
}
|
||||||
| list{IEvLambda(_)} =>
|
| list{IEvLambda(_)} =>
|
||||||
// TODO: remove on solving issue#558
|
// TODO: remove on solving issue#558
|
||||||
valueList
|
valueList->Lambda.checkIfReduced->Belt.List.toArray->InternalExpressionValue.IEvArray
|
||||||
->Lambda.checkIfReduced
|
|
||||||
->Belt.List.toArray->InternalExpressionValue.IEvArray
|
|
||||||
| list{IEvLambda(lambdaCall), ...args} =>
|
| list{IEvLambda(lambdaCall), ...args} =>
|
||||||
args
|
args
|
||||||
->Lambda.checkIfReduced
|
->Lambda.checkIfReduced
|
||||||
->Lambda.doLambdaCall(lambdaCall, _, accessors, reduceExpressionInProject)
|
->Lambda.doLambdaCall(lambdaCall, _, accessors, reduceExpressionInProject)
|
||||||
| _ =>
|
| _ => valueList->Lambda.checkIfReduced->Belt.List.toArray->InternalExpressionValue.IEvArray
|
||||||
valueList
|
|
||||||
->Lambda.checkIfReduced
|
|
||||||
->Belt.List.toArray->InternalExpressionValue.IEvArray
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let reduceReturningBindings = (
|
let reduceReturningBindings = (
|
||||||
|
|
|
@ -11,8 +11,7 @@ let isMacroName = (fName: string): bool => fName->Js.String2.startsWith("$$")
|
||||||
|
|
||||||
let rec replaceSymbols = (bindings: ExpressionT.bindings, expression: expression): expression =>
|
let rec replaceSymbols = (bindings: ExpressionT.bindings, expression: expression): expression =>
|
||||||
switch expression {
|
switch expression {
|
||||||
| ExpressionT.EValue(value) =>
|
| ExpressionT.EValue(value) => replaceSymbolOnValue(bindings, value)->ExpressionT.EValue
|
||||||
replaceSymbolOnValue(bindings, value)->ExpressionT.EValue
|
|
||||||
| ExpressionT.EList(list) =>
|
| ExpressionT.EList(list) =>
|
||||||
switch list {
|
switch list {
|
||||||
| list{EValue(IEvCall(fName)), ..._args} =>
|
| list{EValue(IEvCall(fName)), ..._args} =>
|
||||||
|
@ -26,9 +25,10 @@ let rec replaceSymbols = (bindings: ExpressionT.bindings, expression: expression
|
||||||
}
|
}
|
||||||
|
|
||||||
and replaceSymbolsOnExpressionList = (bindings, list) => {
|
and replaceSymbolsOnExpressionList = (bindings, list) => {
|
||||||
let racc = list->Belt.List.reduceReverse(list{}, (acc, each: expression) =>
|
let racc =
|
||||||
replaceSymbols(bindings, each)->Belt.List.add(acc, _)
|
list->Belt.List.reduceReverse(list{}, (acc, each: expression) =>
|
||||||
)
|
replaceSymbols(bindings, each)->Belt.List.add(acc, _)
|
||||||
|
)
|
||||||
ExpressionT.EList(racc)
|
ExpressionT.EList(racc)
|
||||||
}
|
}
|
||||||
and replaceSymbolOnValue = (bindings, evValue: internalExpressionValue) =>
|
and replaceSymbolOnValue = (bindings, evValue: internalExpressionValue) =>
|
||||||
|
@ -40,5 +40,10 @@ and replaceSymbolOnValue = (bindings, evValue: internalExpressionValue) =>
|
||||||
and checkIfCallable = (evValue: internalExpressionValue) =>
|
and checkIfCallable = (evValue: internalExpressionValue) =>
|
||||||
switch evValue {
|
switch evValue {
|
||||||
| IEvCall(_) | IEvLambda(_) => evValue
|
| IEvCall(_) | IEvLambda(_) => evValue
|
||||||
| _ => raise(ErrorValue.ErrorException(ErrorValue.RENotAFunction(InternalExpressionValue.toString(evValue))))
|
| _ =>
|
||||||
|
raise(
|
||||||
|
ErrorValue.ErrorException(
|
||||||
|
ErrorValue.RENotAFunction(InternalExpressionValue.toString(evValue)),
|
||||||
|
),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,10 +37,10 @@ let checkArity = (
|
||||||
|
|
||||||
let checkIfReduced = (args: list<internalExpressionValue>) =>
|
let checkIfReduced = (args: list<internalExpressionValue>) =>
|
||||||
args->Belt.List.reduceReverse(list{}, (acc, arg) =>
|
args->Belt.List.reduceReverse(list{}, (acc, arg) =>
|
||||||
switch arg {
|
switch arg {
|
||||||
| IEvSymbol(symbol) => raise(ErrorValue.ErrorException(ErrorValue.RESymbolNotFound(symbol)))
|
| IEvSymbol(symbol) => raise(ErrorValue.ErrorException(ErrorValue.RESymbolNotFound(symbol)))
|
||||||
| _ => list{arg, ...acc}
|
| _ => list{arg, ...acc}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
let caseNotFFI = (
|
let caseNotFFI = (
|
||||||
|
@ -62,8 +62,8 @@ let caseNotFFI = (
|
||||||
|
|
||||||
let caseFFI = (ffiFn: ExpressionT.ffiFn, args, accessors: ProjectAccessorsT.t) => {
|
let caseFFI = (ffiFn: ExpressionT.ffiFn, args, accessors: ProjectAccessorsT.t) => {
|
||||||
switch ffiFn(args->Belt.List.toArray, accessors.environment) {
|
switch ffiFn(args->Belt.List.toArray, accessors.environment) {
|
||||||
| Ok(value) => value
|
| Ok(value) => value
|
||||||
| Error(value) => raise(ErrorValue.ErrorException(value))
|
| Error(value) => raise(ErrorValue.ErrorException(value))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function peg$subclass(child, parent) {
|
function peg$subclass(child, parent) {
|
||||||
function C() { this.constructor = child; }
|
function C() {
|
||||||
|
this.constructor = child;
|
||||||
|
}
|
||||||
C.prototype = parent.prototype;
|
C.prototype = parent.prototype;
|
||||||
child.prototype = new C();
|
child.prototype = new C();
|
||||||
}
|
}
|
||||||
|
@ -27,13 +29,15 @@ peg$subclass(peg$SyntaxError, Error);
|
||||||
|
|
||||||
function peg$padEnd(str, targetLength, padString) {
|
function peg$padEnd(str, targetLength, padString) {
|
||||||
padString = padString || " ";
|
padString = padString || " ";
|
||||||
if (str.length > targetLength) { return str; }
|
if (str.length > targetLength) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
targetLength -= str.length;
|
targetLength -= str.length;
|
||||||
padString += padString.repeat(targetLength);
|
padString += padString.repeat(targetLength);
|
||||||
return str + padString.slice(0, targetLength);
|
return str + padString.slice(0, targetLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
peg$SyntaxError.prototype.format = function(sources) {
|
peg$SyntaxError.prototype.format = function (sources) {
|
||||||
var str = "Error: " + this.message;
|
var str = "Error: " + this.message;
|
||||||
if (this.location) {
|
if (this.location) {
|
||||||
var src = null;
|
var src = null;
|
||||||
|
@ -48,15 +52,24 @@ peg$SyntaxError.prototype.format = function(sources) {
|
||||||
var loc = this.location.source + ":" + s.line + ":" + s.column;
|
var loc = this.location.source + ":" + s.line + ":" + s.column;
|
||||||
if (src) {
|
if (src) {
|
||||||
var e = this.location.end;
|
var e = this.location.end;
|
||||||
var filler = peg$padEnd("", s.line.toString().length, ' ');
|
var filler = peg$padEnd("", s.line.toString().length, " ");
|
||||||
var line = src[s.line - 1];
|
var line = src[s.line - 1];
|
||||||
var last = s.line === e.line ? e.column : line.length + 1;
|
var last = s.line === e.line ? e.column : line.length + 1;
|
||||||
var hatLen = (last - s.column) || 1;
|
var hatLen = last - s.column || 1;
|
||||||
str += "\n --> " + loc + "\n"
|
str +=
|
||||||
+ filler + " |\n"
|
"\n --> " +
|
||||||
+ s.line + " | " + line + "\n"
|
loc +
|
||||||
+ filler + " | " + peg$padEnd("", s.column - 1, ' ')
|
"\n" +
|
||||||
+ peg$padEnd("", hatLen, "^");
|
filler +
|
||||||
|
" |\n" +
|
||||||
|
s.line +
|
||||||
|
" | " +
|
||||||
|
line +
|
||||||
|
"\n" +
|
||||||
|
filler +
|
||||||
|
" | " +
|
||||||
|
peg$padEnd("", s.column - 1, " ") +
|
||||||
|
peg$padEnd("", hatLen, "^");
|
||||||
} else {
|
} else {
|
||||||
str += "\n at " + loc;
|
str += "\n at " + loc;
|
||||||
}
|
}
|
||||||
|
@ -64,33 +77,35 @@ peg$SyntaxError.prototype.format = function(sources) {
|
||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
|
|
||||||
peg$SyntaxError.buildMessage = function(expected, found) {
|
peg$SyntaxError.buildMessage = function (expected, found) {
|
||||||
var DESCRIBE_EXPECTATION_FNS = {
|
var DESCRIBE_EXPECTATION_FNS = {
|
||||||
literal: function(expectation) {
|
literal: function (expectation) {
|
||||||
return "\"" + literalEscape(expectation.text) + "\"";
|
return '"' + literalEscape(expectation.text) + '"';
|
||||||
},
|
},
|
||||||
|
|
||||||
class: function(expectation) {
|
class: function (expectation) {
|
||||||
var escapedParts = expectation.parts.map(function(part) {
|
var escapedParts = expectation.parts.map(function (part) {
|
||||||
return Array.isArray(part)
|
return Array.isArray(part)
|
||||||
? classEscape(part[0]) + "-" + classEscape(part[1])
|
? classEscape(part[0]) + "-" + classEscape(part[1])
|
||||||
: classEscape(part);
|
: classEscape(part);
|
||||||
});
|
});
|
||||||
|
|
||||||
return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
|
return (
|
||||||
|
"[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]"
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
any: function() {
|
any: function () {
|
||||||
return "any character";
|
return "any character";
|
||||||
},
|
},
|
||||||
|
|
||||||
end: function() {
|
end: function () {
|
||||||
return "end of input";
|
return "end of input";
|
||||||
},
|
},
|
||||||
|
|
||||||
other: function(expectation) {
|
other: function (expectation) {
|
||||||
return expectation.description;
|
return expectation.description;
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function hex(ch) {
|
function hex(ch) {
|
||||||
|
@ -100,13 +115,17 @@ peg$SyntaxError.buildMessage = function(expected, found) {
|
||||||
function literalEscape(s) {
|
function literalEscape(s) {
|
||||||
return s
|
return s
|
||||||
.replace(/\\/g, "\\\\")
|
.replace(/\\/g, "\\\\")
|
||||||
.replace(/"/g, "\\\"")
|
.replace(/"/g, '\\"')
|
||||||
.replace(/\0/g, "\\0")
|
.replace(/\0/g, "\\0")
|
||||||
.replace(/\t/g, "\\t")
|
.replace(/\t/g, "\\t")
|
||||||
.replace(/\n/g, "\\n")
|
.replace(/\n/g, "\\n")
|
||||||
.replace(/\r/g, "\\r")
|
.replace(/\r/g, "\\r")
|
||||||
.replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
|
.replace(/[\x00-\x0F]/g, function (ch) {
|
||||||
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
|
return "\\x0" + hex(ch);
|
||||||
|
})
|
||||||
|
.replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) {
|
||||||
|
return "\\x" + hex(ch);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function classEscape(s) {
|
function classEscape(s) {
|
||||||
|
@ -114,13 +133,17 @@ peg$SyntaxError.buildMessage = function(expected, found) {
|
||||||
.replace(/\\/g, "\\\\")
|
.replace(/\\/g, "\\\\")
|
||||||
.replace(/\]/g, "\\]")
|
.replace(/\]/g, "\\]")
|
||||||
.replace(/\^/g, "\\^")
|
.replace(/\^/g, "\\^")
|
||||||
.replace(/-/g, "\\-")
|
.replace(/-/g, "\\-")
|
||||||
.replace(/\0/g, "\\0")
|
.replace(/\0/g, "\\0")
|
||||||
.replace(/\t/g, "\\t")
|
.replace(/\t/g, "\\t")
|
||||||
.replace(/\n/g, "\\n")
|
.replace(/\n/g, "\\n")
|
||||||
.replace(/\r/g, "\\r")
|
.replace(/\r/g, "\\r")
|
||||||
.replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
|
.replace(/[\x00-\x0F]/g, function (ch) {
|
||||||
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
|
return "\\x0" + hex(ch);
|
||||||
|
})
|
||||||
|
.replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) {
|
||||||
|
return "\\x" + hex(ch);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function describeExpectation(expectation) {
|
function describeExpectation(expectation) {
|
||||||
|
@ -151,17 +174,25 @@ peg$SyntaxError.buildMessage = function(expected, found) {
|
||||||
return descriptions[0] + " or " + descriptions[1];
|
return descriptions[0] + " or " + descriptions[1];
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return descriptions.slice(0, -1).join(", ")
|
return (
|
||||||
+ ", or "
|
descriptions.slice(0, -1).join(", ") +
|
||||||
+ descriptions[descriptions.length - 1];
|
", or " +
|
||||||
|
descriptions[descriptions.length - 1]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function describeFound(found) {
|
function describeFound(found) {
|
||||||
return found ? "\"" + literalEscape(found) + "\"" : "end of input";
|
return found ? '"' + literalEscape(found) + '"' : "end of input";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
|
return (
|
||||||
|
"Expected " +
|
||||||
|
describeExpected(expected) +
|
||||||
|
" but " +
|
||||||
|
describeFound(found) +
|
||||||
|
" found."
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function peg$parse(input, options) {
|
function peg$parse(input, options) {
|
||||||
|
@ -177,7 +208,7 @@ function peg$parse(input, options) {
|
||||||
var peg$c1 = "#include";
|
var peg$c1 = "#include";
|
||||||
var peg$c2 = "as";
|
var peg$c2 = "as";
|
||||||
var peg$c3 = "'";
|
var peg$c3 = "'";
|
||||||
var peg$c4 = "\"";
|
var peg$c4 = '"';
|
||||||
var peg$c5 = "//";
|
var peg$c5 = "//";
|
||||||
var peg$c6 = "/*";
|
var peg$c6 = "/*";
|
||||||
var peg$c7 = "*/";
|
var peg$c7 = "*/";
|
||||||
|
@ -197,8 +228,8 @@ function peg$parse(input, options) {
|
||||||
var peg$e3 = peg$otherExpectation("string");
|
var peg$e3 = peg$otherExpectation("string");
|
||||||
var peg$e4 = peg$literalExpectation("'", false);
|
var peg$e4 = peg$literalExpectation("'", false);
|
||||||
var peg$e5 = peg$classExpectation(["'"], true, false);
|
var peg$e5 = peg$classExpectation(["'"], true, false);
|
||||||
var peg$e6 = peg$literalExpectation("\"", false);
|
var peg$e6 = peg$literalExpectation('"', false);
|
||||||
var peg$e7 = peg$classExpectation(["\""], true, false);
|
var peg$e7 = peg$classExpectation(['"'], true, false);
|
||||||
var peg$e8 = peg$otherExpectation("comment");
|
var peg$e8 = peg$otherExpectation("comment");
|
||||||
var peg$e9 = peg$literalExpectation("//", false);
|
var peg$e9 = peg$literalExpectation("//", false);
|
||||||
var peg$e10 = peg$literalExpectation("/*", false);
|
var peg$e10 = peg$literalExpectation("/*", false);
|
||||||
|
@ -212,16 +243,36 @@ function peg$parse(input, options) {
|
||||||
var peg$e18 = peg$classExpectation(["\r", "\n"], true, false);
|
var peg$e18 = peg$classExpectation(["\r", "\n"], true, false);
|
||||||
var peg$e19 = peg$otherExpectation("identifier");
|
var peg$e19 = peg$otherExpectation("identifier");
|
||||||
var peg$e20 = peg$classExpectation(["_", ["a", "z"]], false, false);
|
var peg$e20 = peg$classExpectation(["_", ["a", "z"]], false, false);
|
||||||
var peg$e21 = peg$classExpectation(["_", ["a", "z"], ["0", "9"]], false, true);
|
var peg$e21 = peg$classExpectation(
|
||||||
|
["_", ["a", "z"], ["0", "9"]],
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
var peg$f0 = function(head, tail) {return [head, ...tail].filter( e => e != '');};
|
var peg$f0 = function (head, tail) {
|
||||||
var peg$f1 = function() {return [];};
|
return [head, ...tail].filter((e) => e != "");
|
||||||
var peg$f2 = function(file, variable) {return [!variable ? '' : variable, file]};
|
};
|
||||||
var peg$f3 = function(characters) {return characters.join('');};
|
var peg$f1 = function () {
|
||||||
var peg$f4 = function(characters) {return characters.join('');};
|
return [];
|
||||||
var peg$f5 = function() { return '';};
|
};
|
||||||
var peg$f6 = function() { return '';};
|
var peg$f2 = function (file, variable) {
|
||||||
var peg$f7 = function() {return text();};
|
return [!variable ? "" : variable, file];
|
||||||
|
};
|
||||||
|
var peg$f3 = function (characters) {
|
||||||
|
return characters.join("");
|
||||||
|
};
|
||||||
|
var peg$f4 = function (characters) {
|
||||||
|
return characters.join("");
|
||||||
|
};
|
||||||
|
var peg$f5 = function () {
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
var peg$f6 = function () {
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
var peg$f7 = function () {
|
||||||
|
return text();
|
||||||
|
};
|
||||||
var peg$currPos = 0;
|
var peg$currPos = 0;
|
||||||
var peg$savedPos = 0;
|
var peg$savedPos = 0;
|
||||||
var peg$posDetailsCache = [{ line: 1, column: 1 }];
|
var peg$posDetailsCache = [{ line: 1, column: 1 }];
|
||||||
|
@ -235,7 +286,9 @@ function peg$parse(input, options) {
|
||||||
|
|
||||||
if ("startRule" in options) {
|
if ("startRule" in options) {
|
||||||
if (!(options.startRule in peg$startRuleFunctions)) {
|
if (!(options.startRule in peg$startRuleFunctions)) {
|
||||||
throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
|
throw new Error(
|
||||||
|
"Can't start parsing from rule \"" + options.startRule + '".'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
|
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
|
||||||
|
@ -253,7 +306,7 @@ function peg$parse(input, options) {
|
||||||
return {
|
return {
|
||||||
source: peg$source,
|
source: peg$source,
|
||||||
start: peg$savedPos,
|
start: peg$savedPos,
|
||||||
end: peg$currPos
|
end: peg$currPos,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,9 +315,10 @@ function peg$parse(input, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function expected(description, location) {
|
function expected(description, location) {
|
||||||
location = location !== undefined
|
location =
|
||||||
? location
|
location !== undefined
|
||||||
: peg$computeLocation(peg$savedPos, peg$currPos);
|
? location
|
||||||
|
: peg$computeLocation(peg$savedPos, peg$currPos);
|
||||||
|
|
||||||
throw peg$buildStructuredError(
|
throw peg$buildStructuredError(
|
||||||
[peg$otherExpectation(description)],
|
[peg$otherExpectation(description)],
|
||||||
|
@ -274,9 +328,10 @@ function peg$parse(input, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function error(message, location) {
|
function error(message, location) {
|
||||||
location = location !== undefined
|
location =
|
||||||
? location
|
location !== undefined
|
||||||
: peg$computeLocation(peg$savedPos, peg$currPos);
|
? location
|
||||||
|
: peg$computeLocation(peg$savedPos, peg$currPos);
|
||||||
|
|
||||||
throw peg$buildSimpleError(message, location);
|
throw peg$buildSimpleError(message, location);
|
||||||
}
|
}
|
||||||
|
@ -286,7 +341,12 @@ function peg$parse(input, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function peg$classExpectation(parts, inverted, ignoreCase) {
|
function peg$classExpectation(parts, inverted, ignoreCase) {
|
||||||
return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
|
return {
|
||||||
|
type: "class",
|
||||||
|
parts: parts,
|
||||||
|
inverted: inverted,
|
||||||
|
ignoreCase: ignoreCase,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function peg$anyExpectation() {
|
function peg$anyExpectation() {
|
||||||
|
@ -316,7 +376,7 @@ function peg$parse(input, options) {
|
||||||
details = peg$posDetailsCache[p];
|
details = peg$posDetailsCache[p];
|
||||||
details = {
|
details = {
|
||||||
line: details.line,
|
line: details.line,
|
||||||
column: details.column
|
column: details.column,
|
||||||
};
|
};
|
||||||
|
|
||||||
while (p < pos) {
|
while (p < pos) {
|
||||||
|
@ -345,18 +405,20 @@ function peg$parse(input, options) {
|
||||||
start: {
|
start: {
|
||||||
offset: startPos,
|
offset: startPos,
|
||||||
line: startPosDetails.line,
|
line: startPosDetails.line,
|
||||||
column: startPosDetails.column
|
column: startPosDetails.column,
|
||||||
},
|
},
|
||||||
end: {
|
end: {
|
||||||
offset: endPos,
|
offset: endPos,
|
||||||
line: endPosDetails.line,
|
line: endPosDetails.line,
|
||||||
column: endPosDetails.column
|
column: endPosDetails.column,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function peg$fail(expected) {
|
function peg$fail(expected) {
|
||||||
if (peg$currPos < peg$maxFailPos) { return; }
|
if (peg$currPos < peg$maxFailPos) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (peg$currPos > peg$maxFailPos) {
|
if (peg$currPos > peg$maxFailPos) {
|
||||||
peg$maxFailPos = peg$currPos;
|
peg$maxFailPos = peg$currPos;
|
||||||
|
@ -516,7 +578,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos++;
|
peg$currPos++;
|
||||||
} else {
|
} else {
|
||||||
s2 = peg$FAILED;
|
s2 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e0); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
peg$silentFails--;
|
peg$silentFails--;
|
||||||
if (s2 === peg$FAILED) {
|
if (s2 === peg$FAILED) {
|
||||||
|
@ -586,7 +650,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos += 8;
|
peg$currPos += 8;
|
||||||
} else {
|
} else {
|
||||||
s2 = peg$FAILED;
|
s2 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e1); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (s2 !== peg$FAILED) {
|
if (s2 !== peg$FAILED) {
|
||||||
s3 = [];
|
s3 = [];
|
||||||
|
@ -619,7 +685,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos += 2;
|
peg$currPos += 2;
|
||||||
} else {
|
} else {
|
||||||
s7 = peg$FAILED;
|
s7 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e2); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (s7 !== peg$FAILED) {
|
if (s7 !== peg$FAILED) {
|
||||||
s8 = [];
|
s8 = [];
|
||||||
|
@ -716,7 +784,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos++;
|
peg$currPos++;
|
||||||
} else {
|
} else {
|
||||||
s2 = peg$FAILED;
|
s2 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e4); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (s2 !== peg$FAILED) {
|
if (s2 !== peg$FAILED) {
|
||||||
s3 = [];
|
s3 = [];
|
||||||
|
@ -725,7 +795,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos++;
|
peg$currPos++;
|
||||||
} else {
|
} else {
|
||||||
s4 = peg$FAILED;
|
s4 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e5); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (s4 !== peg$FAILED) {
|
while (s4 !== peg$FAILED) {
|
||||||
s3.push(s4);
|
s3.push(s4);
|
||||||
|
@ -734,7 +806,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos++;
|
peg$currPos++;
|
||||||
} else {
|
} else {
|
||||||
s4 = peg$FAILED;
|
s4 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e5); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (input.charCodeAt(peg$currPos) === 39) {
|
if (input.charCodeAt(peg$currPos) === 39) {
|
||||||
|
@ -742,7 +816,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos++;
|
peg$currPos++;
|
||||||
} else {
|
} else {
|
||||||
s4 = peg$FAILED;
|
s4 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e4); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (s4 !== peg$FAILED) {
|
if (s4 !== peg$FAILED) {
|
||||||
s1 = s3;
|
s1 = s3;
|
||||||
|
@ -767,7 +843,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos++;
|
peg$currPos++;
|
||||||
} else {
|
} else {
|
||||||
s2 = peg$FAILED;
|
s2 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e6); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e6);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (s2 !== peg$FAILED) {
|
if (s2 !== peg$FAILED) {
|
||||||
s3 = [];
|
s3 = [];
|
||||||
|
@ -776,7 +854,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos++;
|
peg$currPos++;
|
||||||
} else {
|
} else {
|
||||||
s4 = peg$FAILED;
|
s4 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e7); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e7);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (s4 !== peg$FAILED) {
|
while (s4 !== peg$FAILED) {
|
||||||
s3.push(s4);
|
s3.push(s4);
|
||||||
|
@ -785,7 +865,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos++;
|
peg$currPos++;
|
||||||
} else {
|
} else {
|
||||||
s4 = peg$FAILED;
|
s4 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e7); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e7);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (input.charCodeAt(peg$currPos) === 34) {
|
if (input.charCodeAt(peg$currPos) === 34) {
|
||||||
|
@ -793,7 +875,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos++;
|
peg$currPos++;
|
||||||
} else {
|
} else {
|
||||||
s4 = peg$FAILED;
|
s4 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e6); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e6);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (s4 !== peg$FAILED) {
|
if (s4 !== peg$FAILED) {
|
||||||
s1 = s3;
|
s1 = s3;
|
||||||
|
@ -814,7 +898,9 @@ function peg$parse(input, options) {
|
||||||
peg$silentFails--;
|
peg$silentFails--;
|
||||||
if (s0 === peg$FAILED) {
|
if (s0 === peg$FAILED) {
|
||||||
s1 = peg$FAILED;
|
s1 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e3); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
||||||
|
@ -877,7 +963,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos += 2;
|
peg$currPos += 2;
|
||||||
} else {
|
} else {
|
||||||
s1 = peg$FAILED;
|
s1 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e9); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e9);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (s1 !== peg$FAILED) {
|
if (s1 !== peg$FAILED) {
|
||||||
s2 = [];
|
s2 = [];
|
||||||
|
@ -910,7 +998,9 @@ function peg$parse(input, options) {
|
||||||
peg$silentFails--;
|
peg$silentFails--;
|
||||||
if (s0 === peg$FAILED) {
|
if (s0 === peg$FAILED) {
|
||||||
s1 = peg$FAILED;
|
s1 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e8); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e8);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
||||||
|
@ -937,7 +1027,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos += 2;
|
peg$currPos += 2;
|
||||||
} else {
|
} else {
|
||||||
s1 = peg$FAILED;
|
s1 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e10); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (s1 !== peg$FAILED) {
|
if (s1 !== peg$FAILED) {
|
||||||
s2 = [];
|
s2 = [];
|
||||||
|
@ -946,7 +1038,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos++;
|
peg$currPos++;
|
||||||
} else {
|
} else {
|
||||||
s3 = peg$FAILED;
|
s3 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e11); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e11);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (s3 !== peg$FAILED) {
|
while (s3 !== peg$FAILED) {
|
||||||
s2.push(s3);
|
s2.push(s3);
|
||||||
|
@ -955,7 +1049,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos++;
|
peg$currPos++;
|
||||||
} else {
|
} else {
|
||||||
s3 = peg$FAILED;
|
s3 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e11); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e11);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (input.substr(peg$currPos, 2) === peg$c7) {
|
if (input.substr(peg$currPos, 2) === peg$c7) {
|
||||||
|
@ -963,7 +1059,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos += 2;
|
peg$currPos += 2;
|
||||||
} else {
|
} else {
|
||||||
s3 = peg$FAILED;
|
s3 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e12); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e12);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (s3 !== peg$FAILED) {
|
if (s3 !== peg$FAILED) {
|
||||||
peg$savedPos = s0;
|
peg$savedPos = s0;
|
||||||
|
@ -979,7 +1077,9 @@ function peg$parse(input, options) {
|
||||||
peg$silentFails--;
|
peg$silentFails--;
|
||||||
if (s0 === peg$FAILED) {
|
if (s0 === peg$FAILED) {
|
||||||
s1 = peg$FAILED;
|
s1 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e8); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e8);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
||||||
|
@ -1005,12 +1105,16 @@ function peg$parse(input, options) {
|
||||||
peg$currPos++;
|
peg$currPos++;
|
||||||
} else {
|
} else {
|
||||||
s0 = peg$FAILED;
|
s0 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e14); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e14);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
peg$silentFails--;
|
peg$silentFails--;
|
||||||
if (s0 === peg$FAILED) {
|
if (s0 === peg$FAILED) {
|
||||||
s1 = peg$FAILED;
|
s1 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e13); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e13);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
||||||
|
@ -1036,12 +1140,16 @@ function peg$parse(input, options) {
|
||||||
peg$currPos++;
|
peg$currPos++;
|
||||||
} else {
|
} else {
|
||||||
s0 = peg$FAILED;
|
s0 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e16); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e16);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
peg$silentFails--;
|
peg$silentFails--;
|
||||||
if (s0 === peg$FAILED) {
|
if (s0 === peg$FAILED) {
|
||||||
s1 = peg$FAILED;
|
s1 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e15); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e15);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
||||||
|
@ -1067,12 +1175,16 @@ function peg$parse(input, options) {
|
||||||
peg$currPos++;
|
peg$currPos++;
|
||||||
} else {
|
} else {
|
||||||
s0 = peg$FAILED;
|
s0 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e18); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e18);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
peg$silentFails--;
|
peg$silentFails--;
|
||||||
if (s0 === peg$FAILED) {
|
if (s0 === peg$FAILED) {
|
||||||
s1 = peg$FAILED;
|
s1 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e17); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e17);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
||||||
|
@ -1101,7 +1213,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos++;
|
peg$currPos++;
|
||||||
} else {
|
} else {
|
||||||
s3 = peg$FAILED;
|
s3 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e20); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e20);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (s3 !== peg$FAILED) {
|
if (s3 !== peg$FAILED) {
|
||||||
while (s3 !== peg$FAILED) {
|
while (s3 !== peg$FAILED) {
|
||||||
|
@ -1111,7 +1225,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos++;
|
peg$currPos++;
|
||||||
} else {
|
} else {
|
||||||
s3 = peg$FAILED;
|
s3 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e20); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e20);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1124,7 +1240,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos++;
|
peg$currPos++;
|
||||||
} else {
|
} else {
|
||||||
s4 = peg$FAILED;
|
s4 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e21); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e21);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (s4 !== peg$FAILED) {
|
while (s4 !== peg$FAILED) {
|
||||||
s3.push(s4);
|
s3.push(s4);
|
||||||
|
@ -1133,7 +1251,9 @@ function peg$parse(input, options) {
|
||||||
peg$currPos++;
|
peg$currPos++;
|
||||||
} else {
|
} else {
|
||||||
s4 = peg$FAILED;
|
s4 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e21); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e21);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s2 = [s2, s3];
|
s2 = [s2, s3];
|
||||||
|
@ -1150,7 +1270,9 @@ function peg$parse(input, options) {
|
||||||
peg$silentFails--;
|
peg$silentFails--;
|
||||||
if (s0 === peg$FAILED) {
|
if (s0 === peg$FAILED) {
|
||||||
s1 = peg$FAILED;
|
s1 = peg$FAILED;
|
||||||
if (peg$silentFails === 0) { peg$fail(peg$e19); }
|
if (peg$silentFails === 0) {
|
||||||
|
peg$fail(peg$e19);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
||||||
|
@ -1179,5 +1301,5 @@ function peg$parse(input, options) {
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
SyntaxError: peg$SyntaxError,
|
SyntaxError: peg$SyntaxError,
|
||||||
parse: peg$parse
|
parse: peg$parse,
|
||||||
};
|
};
|
||||||
|
|
|
@ -191,9 +191,7 @@ let doBuildResult = (
|
||||||
this
|
this
|
||||||
->getExpression
|
->getExpression
|
||||||
->Belt.Option.map(
|
->Belt.Option.map(
|
||||||
Belt.Result.flatMap(
|
Belt.Result.flatMap(_, expression =>
|
||||||
_,
|
|
||||||
expression =>
|
|
||||||
try {
|
try {
|
||||||
Reducer_Expression.reduceExpressionInProject(expression, aContinuation, accessors)->Ok
|
Reducer_Expression.reduceExpressionInProject(expression, aContinuation, accessors)->Ok
|
||||||
} catch {
|
} catch {
|
||||||
|
|
|
@ -2,8 +2,4 @@ module ExpressionT = Reducer_Expression_T
|
||||||
module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||||
module ProjectAccessorsT = ReducerProject_ProjectAccessors_T
|
module ProjectAccessorsT = ReducerProject_ProjectAccessors_T
|
||||||
|
|
||||||
type t = (
|
type t = (ExpressionT.t, ExpressionT.bindings, ProjectAccessorsT.t) => InternalExpressionValue.t
|
||||||
ExpressionT.t,
|
|
||||||
ExpressionT.bindings,
|
|
||||||
ProjectAccessorsT.t,
|
|
||||||
) => InternalExpressionValue.t
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user