Skip to content

Instantly share code, notes, and snippets.

@deltaluca
Created March 28, 2012 12:26
Show Gist options
  • Save deltaluca/2225783 to your computer and use it in GitHub Desktop.
Save deltaluca/2225783 to your computer and use it in GitHub Desktop.
Stack overflow in flash Parsex bug.
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