Created
November 6, 2012 16:52
-
-
Save NN---/4025970 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private __GENERATED_PEG__RULE__sumOrSubx__(position : int, text : string) : int * int | |
{ | |
mutable result; | |
def p = unchecked | |
{ | |
mutable (c : char); | |
_ = c; | |
{ | |
_ = "CaptureH[sumOrSub](CaptureA[(int, List[(Chars, Void, int)])](CaptureA[(int, List[(Chars, Void, int)])](CaptureA[int](mulOrDiv) CaptureA[List[(Chars, Void, int)]](CaptureA[(Chars, Void, int)](CaptureA[(Chars, Void, int)](CaptureA[Chars]('+' / '-') CaptureA[Void](spaces) CaptureA[int](mulOrDiv)))*))))"; | |
{ | |
mutable token_1; | |
mutable token_2; | |
if (__GENERATED_PEG__Memeoize_Pos__sumOrSub__ == position) | |
{ | |
when (__GENERATED_PEG__Memeoize_End__sumOrSub__ >= 0) result = __GENERATED_PEG__Memeoize_Res__sumOrSub__; | |
__GENERATED_PEG__Memeoize_End__sumOrSub__ | |
}; else | |
{ | |
def newPosCompileRuleCaptureHandler = | |
{ | |
_ = "CaptureA[(int, List[(Chars, Void, int)])](CaptureA[int](mulOrDiv) CaptureA[List[(Chars, Void, int)]](CaptureA[(Chars, Void, int)](CaptureA[(Chars, Void, int)](CaptureA[Chars]('+' / '-') CaptureA[Void](spaces) CaptureA[int](mulOrDiv)))*))"; | |
(res : | |
{ | |
_ = "CaptureA[int](mulOrDiv) CaptureA[List[(Chars, Void, int)]](CaptureA[(Chars, Void, int)](CaptureA[(Chars, Void, int)](CaptureA[Chars]('+' / '-') CaptureA[Void](spaces) CaptureA[int](mulOrDiv)))*)"; | |
{ | |
def pos = | |
{ | |
_ = "mulOrDiv"; | |
{ | |
def (ret, res) = __GENERATED_PEG__RULE__mulOrDivx__(position, text); | |
token_1 = res; | |
ret | |
} | |
}; | |
if (pos >= 0) | |
{ | |
_ = "CaptureA[(Chars, Void, int)](CaptureA[(Chars, Void, int)](CaptureA[Chars]('+' / '-') CaptureA[Void](spaces) CaptureA[int](mulOrDiv)))*"; | |
{ | |
token_2 = SCG.List(); | |
mutable token_3; | |
mutable token_4; | |
def rep (pos : int) | |
{ | |
def newPosCompileRuleRepeatMin0 = | |
{ | |
_ = "CaptureA[(Chars, Void, int)](CaptureA[Chars]('+' / '-') CaptureA[Void](spaces) CaptureA[int](mulOrDiv))"; | |
(res : | |
{ | |
_ = "CaptureA[Chars]('+' / '-') CaptureA[Void](spaces) CaptureA[int](mulOrDiv)"; | |
{ | |
def pos = | |
{ | |
def newPosCompileRuleCaptureChars = | |
{ | |
_ = "'+' / '-'"; | |
(res : | |
{ | |
def newPosCompileRuleChoice = | |
{ | |
_ = "'+'"; | |
if (pos < text.Length) | |
{ | |
c = text[pos]; | |
if (c == '+') pos + 1; else -1 | |
}; else -1 | |
}; | |
when (newPosCompileRuleChoice >= 0) res(newPosCompileRuleChoice); | |
_ = "'-'"; | |
if (pos < text.Length) | |
{ | |
c = text[pos]; | |
if (c == '-') pos + 1; else -1 | |
}; else -1 | |
}) | |
}; | |
when (newPosCompileRuleCaptureChars >= 0) token_3 = Nemerle.Peg.NToken(pos, newPosCompileRuleCaptureChars); | |
newPosCompileRuleCaptureChars | |
}; | |
if (pos >= 0) | |
{ | |
def pos = | |
{ | |
_ = "spaces"; | |
__GENERATED_PEG__RULE__spaces__(pos, text) | |
}; | |
if (pos >= 0) | |
{ | |
_ = "mulOrDiv"; | |
{ | |
def (ret, res) = __GENERATED_PEG__RULE__mulOrDivx__(pos, text); | |
token_4 = res; | |
ret | |
} | |
}; else -1 | |
}; else -1 | |
} | |
}) | |
}; | |
if (newPosCompileRuleRepeatMin0 >= 0) | |
{ | |
token_2.Add(token_3, token_4); | |
rep(newPosCompileRuleRepeatMin0) | |
}; else pos | |
}; | |
rep(pos) | |
} | |
}; else -1 | |
} | |
}) | |
}; | |
__GENERATED_PEG__Memeoize_Pos__sumOrSub__ = position; | |
__GENERATED_PEG__Memeoize_End__sumOrSub__ = newPosCompileRuleCaptureHandler; | |
if (newPosCompileRuleCaptureHandler >= 0) | |
{ | |
result = sumOrSub(token_1, token_2); | |
(); | |
__GENERATED_PEG__Memeoize_Res__sumOrSub__ = result | |
}; else when (__GENERATED_PEG__MaxRollback___sumOrSub__ < position) __GENERATED_PEG__MaxRollback___sumOrSub__ = position; | |
newPosCompileRuleCaptureHandler | |
} | |
} | |
} | |
}; | |
(p, result) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment