Created
March 28, 2012 12:26
-
-
Save deltaluca/2225783 to your computer and use it in GitHub Desktop.
Stack overflow in flash Parsex bug.
This file contains 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
import com.mindrocks.text.Parser; | |
using com.mindrocks.text.Parser; | |
import com.mindrocks.functional.Functional; | |
using com.mindrocks.functional.Functional; | |
using com.mindrocks.macros.LazyMacro; | |
using Lambda; | |
class BugParser { | |
// works fine in neko | |
// in flash will give stack overflow from parsex | |
// - removing either one or both of the lazyF prevents the stack overflow. | |
static var spacingP = " ".identifier().many().lazyF(); | |
static var numberP = spacingP._and("1".identifier()).lazyF(); | |
static public function main() { | |
switch(numberP()(" 1".reader())) { | |
case Success(res,rest): | |
trace([Std.string(res)]); | |
case Failure(err,rest,_): | |
trace([err]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment