Ported PetitCompiler-(Tests).
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sun, 26 Oct 2014 01:03:31 +0000
changeset 391 553a5456963b
parent 390 17ba167b8ee1
child 392 9b297f0d949c
Ported PetitCompiler-(Tests). Name: PetitCompiler-JanKurs.41 Author: JanKurs Time: 25-10-2014, 03:30:28 AM UUID: 105186d1-1187-4ca6-8d66-3d2d47def4d3 Repository: http://smalltalkhub.com/mc/JanKurs/PetitParser/main Name: PetitCompiler-Tests-JanKurs.4 Author: JanKurs Time: 25-10-2014, 03:30:58 AM UUID: 3e798fad-d5f6-4881-a583-f0bbffe27869 Repository: http://smalltalkhub.com/mc/JanKurs/PetitParser/main In addition, fixed some problems to make it compilable under Smalltalk/X: * Fixed PPCTokenNode>>initialize - there's no children instvar, it's initialization removed. * Fixed PPCContextMemento>>propertyAt:ifAbsent: - removed return-in-return, not compilable under Smalltalk/X (C issues) * Fixed PPCContextMemento>>hash - there's no stream instvar, access to it removed. * Fixed PPCAbstractCharacterNode>>compileWith:effect:id: - removed dot after method selector (stc does not like it)
compiler/Make.proto
compiler/Make.spec
compiler/Makefile.init
compiler/PPCAbstractActionNode.st
compiler/PPCAbstractCharacterNode.st
compiler/PPCAbstractLiteralNode.st
compiler/PPCAbstractPredicateNode.st
compiler/PPCActionNode.st
compiler/PPCAndNode.st
compiler/PPCAnyNode.st
compiler/PPCBridge.st
compiler/PPCCharSetPredicateNode.st
compiler/PPCCharacterNode.st
compiler/PPCChoiceNode.st
compiler/PPCCompiledMethod.st
compiler/PPCCompiler.st
compiler/PPCContext.st
compiler/PPCContextMemento.st
compiler/PPCDelegateNode.st
compiler/PPCForwardNode.st
compiler/PPCGuard.st
compiler/PPCInlineAnyNode.st
compiler/PPCInlineCharSetPredicateNode.st
compiler/PPCInlineCharacterNode.st
compiler/PPCInlineLiteralNode.st
compiler/PPCInlineMessagePredicateNode.st
compiler/PPCInlineNilNode.st
compiler/PPCInlineNotCharSetPredicateNode.st
compiler/PPCInlineNotLiteralNode.st
compiler/PPCInlineNotMessagePredicateNode.st
compiler/PPCInlinePluggableNode.st
compiler/PPCInlineStrategy.st
compiler/PPCInlinedMethod.st
compiler/PPCListNode.st
compiler/PPCLiteralNode.st
compiler/PPCMessagePredicateNode.st
compiler/PPCMethod.st
compiler/PPCMethodStrategy.st
compiler/PPCNegateNode.st
compiler/PPCNilNode.st
compiler/PPCNode.st
compiler/PPCNotCharSetPredicateNode.st
compiler/PPCNotLiteralNode.st
compiler/PPCNotMessagePredicateNode.st
compiler/PPCNotNode.st
compiler/PPCOptimizationResult.st
compiler/PPCOptionalNode.st
compiler/PPCPluggableNode.st
compiler/PPCPlusNode.st
compiler/PPCPredicateNode.st
compiler/PPCProfilingContext.st
compiler/PPCSequenceNode.st
compiler/PPCStarAnyNode.st
compiler/PPCStarCharSetPredicateNode.st
compiler/PPCStarMessagePredicateNode.st
compiler/PPCStarNode.st
compiler/PPCSymbolActionNode.st
compiler/PPCTokenNode.st
compiler/PPCTokenSequenceNode.st
compiler/PPCTokenStarMessagePredicateNode.st
compiler/PPCTrimNode.st
compiler/PPCTrimmingTokenNode.st
compiler/PPCUnknownNode.st
compiler/PPCompiledParser.st
compiler/PetitBenchmark.st
compiler/PetitBenchmarkSources.st
compiler/abbrev.stc
compiler/bc.mak
compiler/bmake.bat
compiler/compiler.rc
compiler/extensions.st
compiler/lccmake.bat
compiler/libInit.cc
compiler/mingwmake.bat
compiler/stx_goodies_petitparser_compiler.st
compiler/tests/Make.proto
compiler/tests/Make.spec
compiler/tests/Makefile.init
compiler/tests/PPCContextMementoTest.st
compiler/tests/PPCContextTest.st
compiler/tests/PPCGuardTest.st
compiler/tests/PPCMockCompiler.st
compiler/tests/PPCNodeCompilingTest.st
compiler/tests/PPCNodeTest.st
compiler/tests/PPCOptimizingTest.st
compiler/tests/PPCompiledSmalltalkGrammarResource.st
compiler/tests/PPCompiledSmalltalkGrammarTests.st
compiler/tests/PetitCompilerTest.st
compiler/tests/abbrev.stc
compiler/tests/bc.mak
compiler/tests/bmake.bat
compiler/tests/lccmake.bat
compiler/tests/libInit.cc
compiler/tests/mingwmake.bat
compiler/tests/stx_goodies_petitparser_compiler_tests.st
compiler/tests/tests.rc
compiler/tests/vcmake.bat
compiler/vcmake.bat
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/Make.proto	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,195 @@
+# $Header$
+#
+# DO NOT EDIT
+# automagically generated from the projectDefinition: stx_goodies_petitparser_compiler.
+#
+# Warning: once you modify this file, do not rerun
+# stmkmp or projectDefinition-build again - otherwise, your changes are lost.
+#
+# The Makefile as generated by this Make.proto supports the following targets:
+#    make         - compile all st-files to a classLib
+#    make clean   - clean all temp files
+#    make clobber - clean all
+#
+# This file contains definitions for Unix based platforms.
+# It shares common definitions with the win32-make in Make.spec.
+
+#
+# position (of this package) in directory hierarchy:
+# (must point to ST/X top directory, for tools and includes)
+TOP=../../..
+INCLUDE_TOP=$(TOP)/..
+
+# subdirectories where targets are to be made:
+SUBDIRS=
+
+
+# subdirectories where Makefiles are to be made:
+# (only define if different from SUBDIRS)
+# ALLSUBDIRS=
+
+REQUIRED_SUPPORT_DIRS=
+
+# if your embedded C code requires any system includes,
+# add the path(es) here:,
+# ********** OPTIONAL: MODIFY the next lines ***
+# LOCALINCLUDES=-Ifoo -Ibar
+LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/goodies/petitparser -I$(INCLUDE_TOP)/stx/goodies/petitparser/parsers/smalltalk -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libbasic2
+
+
+# if you need any additional defines for embedded C code,
+# add them here:,
+# ********** OPTIONAL: MODIFY the next lines ***
+# LOCALDEFINES=-Dfoo -Dbar -DDEBUG
+LOCALDEFINES=
+
+LIBNAME=libstx_goodies_petitparser_compiler
+STCLOCALOPT='-package=$(PACKAGE)' -I. $(LOCALINCLUDES) $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES) -headerDir=.  -varPrefix=$(LIBNAME)
+
+
+# ********** OPTIONAL: MODIFY the next line ***
+# additional C-libraries that should be pre-linked with the class-objects
+LD_OBJ_LIBS=
+LOCAL_SHARED_LIBS=
+
+
+# ********** OPTIONAL: MODIFY the next line ***
+# additional C targets or libraries should be added below
+LOCAL_EXTRA_TARGETS=
+
+OBJS= $(COMMON_OBJS) $(UNIX_OBJS)
+
+
+
+all:: preMake classLibRule postMake
+
+pre_objs::  
+
+
+
+
+
+
+# Enforce recompilation of package definition class if Mercurial working
+# copy state changes. Together with --guessVersion it ensures that package
+# definition class always contains correct binary revision string.
+ifneq (**NOHG**, $(shell hg root 2> /dev/null || echo -n '**NOHG**'))
+stx_goodies_petitparser_compiler.$(O): $(shell hg root)/.hg/dirstate
+endif
+
+
+
+
+# run default testsuite for this package
+test: $(TOP)/goodies/builder/reports
+	$(MAKE) -C $(TOP)/goodies/builder/reports -f Makefile.init
+	$(TOP)/goodies/builder/reports/report-runner.sh -D . -r Builder::TestReport -p $(PACKAGE)
+
+
+
+# add more install actions here
+install::
+
+# add more install actions for aux-files (resources) here
+installAux::
+
+# add more preMake actions here
+preMake::
+
+# add more postMake actions here
+postMake:: cleanjunk
+
+# build all mandatory prerequisite packages (containing superclasses) for this package
+prereq:
+	cd ../../../libbasic && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../refactoryBrowser/parser && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../../libbasic2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../ && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../parsers/smalltalk && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+
+
+# build all packages containing referenced classes for this package
+# they are nor needed to compile the package
+references:
+
+
+cleanjunk::
+	-rm -f *.s *.s2
+
+clean::
+	-rm -f *.o *.H
+
+clobber:: clean
+	-rm -f *.so *.dll
+
+
+# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
+$(OUTDIR)PPCBridge.$(O) PPCBridge.$(H): PPCBridge.st $(INCLUDE_TOP)/stx/goodies/petitparser/PPParser.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCCompiledMethod.$(O) PPCCompiledMethod.$(H): PPCCompiledMethod.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCCompiler.$(O) PPCCompiler.$(H): PPCCompiler.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCContext.$(O) PPCContext.$(H): PPCContext.st $(INCLUDE_TOP)/stx/goodies/petitparser/PPStream.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/PeekableStream.$(H) $(INCLUDE_TOP)/stx/libbasic/PositionableStream.$(H) $(INCLUDE_TOP)/stx/libbasic/ReadStream.$(H) $(INCLUDE_TOP)/stx/libbasic/Stream.$(H) $(STCHDR)
+$(OUTDIR)PPCContextMemento.$(O) PPCContextMemento.$(H): PPCContextMemento.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCGuard.$(O) PPCGuard.$(H): PPCGuard.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCInlineStrategy.$(O) PPCInlineStrategy.$(H): PPCInlineStrategy.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCMethod.$(O) PPCMethod.$(H): PPCMethod.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCMethodStrategy.$(O) PPCMethodStrategy.$(H): PPCMethodStrategy.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCNode.$(O) PPCNode.$(H): PPCNode.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCOptimizationResult.$(O) PPCOptimizationResult.$(H): PPCOptimizationResult.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCompiledParser.$(O) PPCompiledParser.$(H): PPCompiledParser.st $(INCLUDE_TOP)/stx/goodies/petitparser/PPParser.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PetitBenchmark.$(O) PetitBenchmark.$(H): PetitBenchmark.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PetitBenchmarkSources.$(O) PetitBenchmarkSources.$(H): PetitBenchmarkSources.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)stx_goodies_petitparser_compiler.$(O) stx_goodies_petitparser_compiler.$(H): stx_goodies_petitparser_compiler.st $(INCLUDE_TOP)/stx/libbasic/LibraryDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(STCHDR)
+$(OUTDIR)PPCAbstractCharacterNode.$(O) PPCAbstractCharacterNode.$(H): PPCAbstractCharacterNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCAbstractLiteralNode.$(O) PPCAbstractLiteralNode.$(H): PPCAbstractLiteralNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCAbstractPredicateNode.$(O) PPCAbstractPredicateNode.$(H): PPCAbstractPredicateNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCAnyNode.$(O) PPCAnyNode.$(H): PPCAnyNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCDelegateNode.$(O) PPCDelegateNode.$(H): PPCDelegateNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCInlinedMethod.$(O) PPCInlinedMethod.$(H): PPCInlinedMethod.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCMethod.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCListNode.$(O) PPCListNode.$(H): PPCListNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCNilNode.$(O) PPCNilNode.$(H): PPCNilNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCPluggableNode.$(O) PPCPluggableNode.$(H): PPCPluggableNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCProfilingContext.$(O) PPCProfilingContext.$(H): PPCProfilingContext.st $(INCLUDE_TOP)/stx/goodies/petitparser/PPStream.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCContext.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/PeekableStream.$(H) $(INCLUDE_TOP)/stx/libbasic/PositionableStream.$(H) $(INCLUDE_TOP)/stx/libbasic/ReadStream.$(H) $(INCLUDE_TOP)/stx/libbasic/Stream.$(H) $(STCHDR)
+$(OUTDIR)PPCStarAnyNode.$(O) PPCStarAnyNode.$(H): PPCStarAnyNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCStarCharSetPredicateNode.$(O) PPCStarCharSetPredicateNode.$(H): PPCStarCharSetPredicateNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCStarMessagePredicateNode.$(O) PPCStarMessagePredicateNode.$(H): PPCStarMessagePredicateNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCUnknownNode.$(O) PPCUnknownNode.$(H): PPCUnknownNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCAbstractActionNode.$(O) PPCAbstractActionNode.$(H): PPCAbstractActionNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCDelegateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCAndNode.$(O) PPCAndNode.$(H): PPCAndNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCDelegateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCCharSetPredicateNode.$(O) PPCCharSetPredicateNode.$(H): PPCCharSetPredicateNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCAbstractPredicateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCCharacterNode.$(O) PPCCharacterNode.$(H): PPCCharacterNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCAbstractCharacterNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCChoiceNode.$(O) PPCChoiceNode.$(H): PPCChoiceNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCListNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCForwardNode.$(O) PPCForwardNode.$(H): PPCForwardNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCDelegateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCInlineAnyNode.$(O) PPCInlineAnyNode.$(H): PPCInlineAnyNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCAnyNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCInlineCharacterNode.$(O) PPCInlineCharacterNode.$(H): PPCInlineCharacterNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCAbstractCharacterNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCInlineLiteralNode.$(O) PPCInlineLiteralNode.$(H): PPCInlineLiteralNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCAbstractLiteralNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCInlineNilNode.$(O) PPCInlineNilNode.$(H): PPCInlineNilNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNilNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCInlineNotLiteralNode.$(O) PPCInlineNotLiteralNode.$(H): PPCInlineNotLiteralNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCAbstractLiteralNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCInlinePluggableNode.$(O) PPCInlinePluggableNode.$(H): PPCInlinePluggableNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCPluggableNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCLiteralNode.$(O) PPCLiteralNode.$(H): PPCLiteralNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCAbstractLiteralNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCMessagePredicateNode.$(O) PPCMessagePredicateNode.$(H): PPCMessagePredicateNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCAbstractPredicateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCNegateNode.$(O) PPCNegateNode.$(H): PPCNegateNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCDelegateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCNotCharSetPredicateNode.$(O) PPCNotCharSetPredicateNode.$(H): PPCNotCharSetPredicateNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCAbstractPredicateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCNotLiteralNode.$(O) PPCNotLiteralNode.$(H): PPCNotLiteralNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCAbstractLiteralNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCNotMessagePredicateNode.$(O) PPCNotMessagePredicateNode.$(H): PPCNotMessagePredicateNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCAbstractPredicateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCNotNode.$(O) PPCNotNode.$(H): PPCNotNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCDelegateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCOptionalNode.$(O) PPCOptionalNode.$(H): PPCOptionalNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCDelegateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCPlusNode.$(O) PPCPlusNode.$(H): PPCPlusNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCDelegateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCPredicateNode.$(O) PPCPredicateNode.$(H): PPCPredicateNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCAbstractPredicateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCSequenceNode.$(O) PPCSequenceNode.$(H): PPCSequenceNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCListNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCStarNode.$(O) PPCStarNode.$(H): PPCStarNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCDelegateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCTokenNode.$(O) PPCTokenNode.$(H): PPCTokenNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCDelegateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCTokenStarMessagePredicateNode.$(O) PPCTokenStarMessagePredicateNode.$(H): PPCTokenStarMessagePredicateNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCStarMessagePredicateNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCTrimNode.$(O) PPCTrimNode.$(H): PPCTrimNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCDelegateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCTrimmingTokenNode.$(O) PPCTrimmingTokenNode.$(H): PPCTrimmingTokenNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCListNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCActionNode.$(O) PPCActionNode.$(H): PPCActionNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCAbstractActionNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCDelegateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCInlineCharSetPredicateNode.$(O) PPCInlineCharSetPredicateNode.$(H): PPCInlineCharSetPredicateNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCAbstractPredicateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCCharSetPredicateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCInlineMessagePredicateNode.$(O) PPCInlineMessagePredicateNode.$(H): PPCInlineMessagePredicateNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCAbstractPredicateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCMessagePredicateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCInlineNotCharSetPredicateNode.$(O) PPCInlineNotCharSetPredicateNode.$(H): PPCInlineNotCharSetPredicateNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCAbstractPredicateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNotCharSetPredicateNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCInlineNotMessagePredicateNode.$(O) PPCInlineNotMessagePredicateNode.$(H): PPCInlineNotMessagePredicateNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCAbstractPredicateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNotMessagePredicateNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCSymbolActionNode.$(O) PPCSymbolActionNode.$(H): PPCSymbolActionNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCAbstractActionNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCDelegateNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPCTokenSequenceNode.$(O) PPCTokenSequenceNode.$(H): PPCTokenSequenceNode.st $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCListNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCNode.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/compiler/PPCSequenceNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/goodies/petitparser/PPActionParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPAndParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPCharSetPredicate.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPChoiceParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPCompositeParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPContext.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPDelegateParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPEpsilonParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPFailure.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPFlattenParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPListParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPLiteralObjectParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPLiteralParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPLiteralSequenceParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPNotParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPOptionalParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPPluggableParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPPossessiveRepeatingParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPPredicateObjectParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPPredicateParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPRepeatingParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPSequenceParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPStream.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPToken.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPTokenParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPTrimmingParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/parsers/smalltalk/PPSmalltalkGrammar.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/parsers/smalltalk/PPSmalltalkTokenParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/parsers/smalltalk/PPSmalltalkWhitespaceParser.$(H) $(INCLUDE_TOP)/stx/libbasic/Character.$(H) $(INCLUDE_TOP)/stx/libbasic/Magnitude.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/PeekableStream.$(H) $(INCLUDE_TOP)/stx/libbasic/PositionableStream.$(H) $(INCLUDE_TOP)/stx/libbasic/ReadStream.$(H) $(INCLUDE_TOP)/stx/libbasic/Stream.$(H) $(INCLUDE_TOP)/stx/libbasic/UndefinedObject.$(H) $(STCHDR)
+
+# ENDMAKEDEPEND --- do not remove this line
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/Make.spec	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,189 @@
+# $Header$
+#
+# DO NOT EDIT
+# automagically generated from the projectDefinition: stx_goodies_petitparser_compiler.
+#
+# Warning: once you modify this file, do not rerun
+# stmkmp or projectDefinition-build again - otherwise, your changes are lost.
+#
+# This file contains specifications which are common to all platforms.
+#
+
+# Do NOT CHANGE THESE DEFINITIONS
+# (otherwise, ST/X will have a hard time to find out the packages location from its packageID,
+#  to find the source code of a class and to find the library for a package)
+MODULE=stx
+MODULE_DIR=goodies/petitparser/compiler
+PACKAGE=$(MODULE):$(MODULE_DIR)
+
+
+# Argument(s) to the stc compiler (stc --usage).
+#  -headerDir=. : create header files locally
+#                (if removed, they will be created as common
+#  -Pxxx       : defines the package
+#  -Zxxx       : a prefix for variables within the classLib
+#  -Dxxx       : defines passed to to CC for inline C-code
+#  -Ixxx       : include path passed to CC for inline C-code
+#  +optspace   : optimized for space
+#  +optspace2  : optimized more for space
+#  +optspace3  : optimized even more for space
+#  +optinline  : generate inline code for some ST constructs
+#  +inlineNew  : additionally inline new
+#  +inlineMath : additionally inline some floatPnt math stuff
+#
+# ********** OPTIONAL: MODIFY the next line(s) ***
+# STCLOCALOPTIMIZATIONS=+optinline +inlineNew
+# STCLOCALOPTIMIZATIONS=+optspace3
+STCLOCALOPTIMIZATIONS=+optspace3
+
+
+# Argument(s) to the stc compiler (stc --usage).
+#  -warn            : no warnings
+#  -warnNonStandard : no warnings about ST/X extensions
+#  -warnEOLComments : no warnings about EOL comment extension
+#  -warnPrivacy     : no warnings about privateClass extension
+#
+# ********** OPTIONAL: MODIFY the next line(s) ***
+# STCWARNINGS=-warn
+# STCWARNINGS=-warnNonStandard
+# STCWARNINGS=-warnEOLComments
+STCWARNINGS=-warnNonStandard
+
+COMMON_CLASSES= \
+	PPCBridge \
+	PPCCompiledMethod \
+	PPCCompiler \
+	PPCContext \
+	PPCContextMemento \
+	PPCGuard \
+	PPCInlineStrategy \
+	PPCMethod \
+	PPCMethodStrategy \
+	PPCNode \
+	PPCOptimizationResult \
+	PPCompiledParser \
+	PetitBenchmark \
+	PetitBenchmarkSources \
+	stx_goodies_petitparser_compiler \
+	PPCAbstractCharacterNode \
+	PPCAbstractLiteralNode \
+	PPCAbstractPredicateNode \
+	PPCAnyNode \
+	PPCDelegateNode \
+	PPCInlinedMethod \
+	PPCListNode \
+	PPCNilNode \
+	PPCPluggableNode \
+	PPCProfilingContext \
+	PPCStarAnyNode \
+	PPCStarCharSetPredicateNode \
+	PPCStarMessagePredicateNode \
+	PPCUnknownNode \
+	PPCAbstractActionNode \
+	PPCAndNode \
+	PPCCharSetPredicateNode \
+	PPCCharacterNode \
+	PPCChoiceNode \
+	PPCForwardNode \
+	PPCInlineAnyNode \
+	PPCInlineCharacterNode \
+	PPCInlineLiteralNode \
+	PPCInlineNilNode \
+	PPCInlineNotLiteralNode \
+	PPCInlinePluggableNode \
+	PPCLiteralNode \
+	PPCMessagePredicateNode \
+	PPCNegateNode \
+	PPCNotCharSetPredicateNode \
+	PPCNotLiteralNode \
+	PPCNotMessagePredicateNode \
+	PPCNotNode \
+	PPCOptionalNode \
+	PPCPlusNode \
+	PPCPredicateNode \
+	PPCSequenceNode \
+	PPCStarNode \
+	PPCTokenNode \
+	PPCTokenStarMessagePredicateNode \
+	PPCTrimNode \
+	PPCTrimmingTokenNode \
+	PPCActionNode \
+	PPCInlineCharSetPredicateNode \
+	PPCInlineMessagePredicateNode \
+	PPCInlineNotCharSetPredicateNode \
+	PPCInlineNotMessagePredicateNode \
+	PPCSymbolActionNode \
+	PPCTokenSequenceNode \
+
+
+
+
+COMMON_OBJS= \
+    $(OUTDIR_SLASH)PPCBridge.$(O) \
+    $(OUTDIR_SLASH)PPCCompiledMethod.$(O) \
+    $(OUTDIR_SLASH)PPCCompiler.$(O) \
+    $(OUTDIR_SLASH)PPCContext.$(O) \
+    $(OUTDIR_SLASH)PPCContextMemento.$(O) \
+    $(OUTDIR_SLASH)PPCGuard.$(O) \
+    $(OUTDIR_SLASH)PPCInlineStrategy.$(O) \
+    $(OUTDIR_SLASH)PPCMethod.$(O) \
+    $(OUTDIR_SLASH)PPCMethodStrategy.$(O) \
+    $(OUTDIR_SLASH)PPCNode.$(O) \
+    $(OUTDIR_SLASH)PPCOptimizationResult.$(O) \
+    $(OUTDIR_SLASH)PPCompiledParser.$(O) \
+    $(OUTDIR_SLASH)PetitBenchmark.$(O) \
+    $(OUTDIR_SLASH)PetitBenchmarkSources.$(O) \
+    $(OUTDIR_SLASH)stx_goodies_petitparser_compiler.$(O) \
+    $(OUTDIR_SLASH)PPCAbstractCharacterNode.$(O) \
+    $(OUTDIR_SLASH)PPCAbstractLiteralNode.$(O) \
+    $(OUTDIR_SLASH)PPCAbstractPredicateNode.$(O) \
+    $(OUTDIR_SLASH)PPCAnyNode.$(O) \
+    $(OUTDIR_SLASH)PPCDelegateNode.$(O) \
+    $(OUTDIR_SLASH)PPCInlinedMethod.$(O) \
+    $(OUTDIR_SLASH)PPCListNode.$(O) \
+    $(OUTDIR_SLASH)PPCNilNode.$(O) \
+    $(OUTDIR_SLASH)PPCPluggableNode.$(O) \
+    $(OUTDIR_SLASH)PPCProfilingContext.$(O) \
+    $(OUTDIR_SLASH)PPCStarAnyNode.$(O) \
+    $(OUTDIR_SLASH)PPCStarCharSetPredicateNode.$(O) \
+    $(OUTDIR_SLASH)PPCStarMessagePredicateNode.$(O) \
+    $(OUTDIR_SLASH)PPCUnknownNode.$(O) \
+    $(OUTDIR_SLASH)PPCAbstractActionNode.$(O) \
+    $(OUTDIR_SLASH)PPCAndNode.$(O) \
+    $(OUTDIR_SLASH)PPCCharSetPredicateNode.$(O) \
+    $(OUTDIR_SLASH)PPCCharacterNode.$(O) \
+    $(OUTDIR_SLASH)PPCChoiceNode.$(O) \
+    $(OUTDIR_SLASH)PPCForwardNode.$(O) \
+    $(OUTDIR_SLASH)PPCInlineAnyNode.$(O) \
+    $(OUTDIR_SLASH)PPCInlineCharacterNode.$(O) \
+    $(OUTDIR_SLASH)PPCInlineLiteralNode.$(O) \
+    $(OUTDIR_SLASH)PPCInlineNilNode.$(O) \
+    $(OUTDIR_SLASH)PPCInlineNotLiteralNode.$(O) \
+    $(OUTDIR_SLASH)PPCInlinePluggableNode.$(O) \
+    $(OUTDIR_SLASH)PPCLiteralNode.$(O) \
+    $(OUTDIR_SLASH)PPCMessagePredicateNode.$(O) \
+    $(OUTDIR_SLASH)PPCNegateNode.$(O) \
+    $(OUTDIR_SLASH)PPCNotCharSetPredicateNode.$(O) \
+    $(OUTDIR_SLASH)PPCNotLiteralNode.$(O) \
+    $(OUTDIR_SLASH)PPCNotMessagePredicateNode.$(O) \
+    $(OUTDIR_SLASH)PPCNotNode.$(O) \
+    $(OUTDIR_SLASH)PPCOptionalNode.$(O) \
+    $(OUTDIR_SLASH)PPCPlusNode.$(O) \
+    $(OUTDIR_SLASH)PPCPredicateNode.$(O) \
+    $(OUTDIR_SLASH)PPCSequenceNode.$(O) \
+    $(OUTDIR_SLASH)PPCStarNode.$(O) \
+    $(OUTDIR_SLASH)PPCTokenNode.$(O) \
+    $(OUTDIR_SLASH)PPCTokenStarMessagePredicateNode.$(O) \
+    $(OUTDIR_SLASH)PPCTrimNode.$(O) \
+    $(OUTDIR_SLASH)PPCTrimmingTokenNode.$(O) \
+    $(OUTDIR_SLASH)PPCActionNode.$(O) \
+    $(OUTDIR_SLASH)PPCInlineCharSetPredicateNode.$(O) \
+    $(OUTDIR_SLASH)PPCInlineMessagePredicateNode.$(O) \
+    $(OUTDIR_SLASH)PPCInlineNotCharSetPredicateNode.$(O) \
+    $(OUTDIR_SLASH)PPCInlineNotMessagePredicateNode.$(O) \
+    $(OUTDIR_SLASH)PPCSymbolActionNode.$(O) \
+    $(OUTDIR_SLASH)PPCTokenSequenceNode.$(O) \
+    $(OUTDIR_SLASH)extensions.$(O) \
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/Makefile.init	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,27 @@
+#
+# DO NOT EDIT
+#
+# make uses this file (Makefile) only, if there is no
+# file named "makefile" (lower-case m) in the same directory.
+# My only task is to generate the real makefile and call make again.
+# Thereafter, I am no longer used and needed.
+#
+# MACOSX caveat:
+#   as filenames are not case sensitive (in a default setup),
+#   we cannot use the above trick. Therefore, this file is now named
+#   "Makefile.init", and you have to execute "make -f Makefile.init" to
+#   get the initial makefile.  This is now also done by the toplevel CONFIG
+#   script.
+
+.PHONY: run
+
+run: makefile
+	$(MAKE) -f makefile
+
+#only needed for the definition of $(TOP)
+include Make.proto
+
+makefile: mf
+
+mf:
+	$(TOP)/rules/stmkmf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCAbstractActionNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,30 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCDelegateNode subclass:#PPCAbstractActionNode
+	instanceVariableNames:'block'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCAbstractActionNode comment:''
+!
+
+!PPCAbstractActionNode methodsFor:'accessing'!
+
+block
+	
+	^ block
+!
+
+block: anObject
+	
+	block := anObject
+! !
+
+!PPCAbstractActionNode methodsFor:'as yet unclassified'!
+
+prefix
+	^ #action
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCAbstractCharacterNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,67 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCNode subclass:#PPCAbstractCharacterNode
+	instanceVariableNames:'character'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCAbstractCharacterNode comment:''
+!
+
+!PPCAbstractCharacterNode methodsFor:'accessing'!
+
+acceptsEpsilon
+	^ false
+!
+
+character
+	^ character
+!
+
+character: char
+	character := char
+!
+
+prefix
+	^ #char
+! !
+
+!PPCAbstractCharacterNode methodsFor:'analysis'!
+
+firstCharParser
+	^ character asParser
+! !
+
+!PPCAbstractCharacterNode methodsFor:'compiling'!
+
+body: compiler
+	| id |
+
+	character ppcPrintable ifTrue: [
+		id := character printString
+	] ifFalse: [
+		id := compiler idFor: character prefixed: #char.
+		compiler addConstant: (Character value: character asInteger) as: id .
+	].
+
+	compiler add: '(context peek == ', id, ')'.
+	compiler indent.
+	compiler add: 'ifFalse: [ self error: ''', character asInteger asString, ' expected'' at: context position ] '.
+	compiler add: 'ifTrue: [ context next ].'.
+	compiler dedent.
+!
+
+compileWith: compiler effect: effect id: id
+	self start: compiler id: id.
+	self body: compiler.
+	^ self stop: compiler.
+!
+
+compileWith: compiler id: id
+	self start: compiler.
+	self body: compiler.
+ 	^ compiler stopMethod.
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCAbstractLiteralNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,48 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCNode subclass:#PPCAbstractLiteralNode
+	instanceVariableNames:'literal'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCAbstractLiteralNode comment:''
+!
+
+!PPCAbstractLiteralNode methodsFor:'accessing'!
+
+acceptsEpsilon
+	^ literal size = 0
+!
+
+firstCharParser
+	^ literal first asParser
+!
+
+literal
+	
+	^ literal
+!
+
+literal: anObject
+	
+	literal := anObject
+!
+
+prefix
+	^ #lit
+! !
+
+!PPCAbstractLiteralNode methodsFor:'compiling'!
+
+encodeQuotes: string
+	| x s |
+	s := WriteStream on: ''.
+	1 to: string size do: [ :i|
+		s nextPut: (x := string at: i).
+		x = $' ifTrue: [ s nextPut: x ].
+	].
+	^ s contents
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCAbstractPredicateNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,102 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCNode subclass:#PPCAbstractPredicateNode
+	instanceVariableNames:'predicate methodStrategy'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCAbstractPredicateNode comment:''
+!
+
+!PPCAbstractPredicateNode methodsFor:'accessing'!
+
+methodStrategy
+	
+	^ methodStrategy
+!
+
+methodStrategy: anObject
+	
+	methodStrategy := anObject
+!
+
+predicate
+	
+	^ predicate
+!
+
+predicate: anObject
+	
+	predicate := anObject
+!
+
+prefix
+	^ #predicate
+! !
+
+!PPCAbstractPredicateNode methodsFor:'analysis'!
+
+= anotherNode
+	(self == anotherNode) ifTrue: [ ^ true ].
+	(anotherNode class = self class) ifFalse: [ ^ false ].
+	
+	(anotherNode name = name) ifFalse: [ ^ false ].
+	(anotherNode methodStrategy = methodStrategy) ifFalse: [ ^ false ].
+	^ anotherNode children = self children.
+!
+
+acceptsEpsilon
+	^ false
+!
+
+firstCharParser
+	^ PPPredicateObjectParser on: predicate message: 'predicate expected'.
+! !
+
+!PPCAbstractPredicateNode methodsFor:'compiling'!
+
+bodyOfPredicate: compiler
+	self subclassResponsibility
+!
+
+compileWith: compiler effect: effect id: id
+	compiler startMethod: id.
+	compiler add: '^'.
+	self bodyOfPredicate: compiler.
+ ^ compiler stopMethod.
+!
+
+extendClassification: classification
+	^ (classification asOrderedCollection addLast: false; yourself) asArray
+! !
+
+!PPCAbstractPredicateNode methodsFor:'initialization'!
+
+initialize
+	super initialize.
+	methodStrategy := PPCMethodStrategy new
+! !
+
+!PPCAbstractPredicateNode methodsFor:'optimizing'!
+
+asInlined
+	^ super asInlined
+"	(methodStrategy == (PPCInlineStrategy instance)) ifFalse: [ 
+		^ self copy 
+			methodStrategy: PPCInlineStrategy instance;
+			yourself
+	].
+	^ self"
+!
+
+optimize: params status: changeStatus
+	| retval |
+	retval := self.
+	retval := retval rewrite: params status: changeStatus.
+	retval := retval inline: params status: changeStatus.
+	
+	^ retval
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCActionNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,49 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCAbstractActionNode subclass:#PPCActionNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCActionNode comment:''
+!
+
+!PPCActionNode methodsFor:'as yet unclassified'!
+
+compileWith: compiler effect: effect id: id
+	compiler addConstant: block as: id.
+	
+	compiler startMethod: id.
+	compiler addVariable: 'element'.
+	compiler add: 'element := '.
+	compiler callOnLine: (child compileWith: compiler).
+	compiler add: 'error ifFalse: [ ^ ',  id, ' value: element ].'.
+	compiler add: '^ failure'.
+ ^ compiler stopMethod.
+!
+
+rewrite: changeStatus
+	"TODO JK: Find another way how to recognize the trimming token!!"
+	(name = 'trimmingToken') ifTrue: [ 
+		changeStatus change.
+		^ PPCTrimmingTokenNode new
+			"name: name"
+			"JK: I am sorry"
+			child: child children second child;
+			tokenClass: child children second tokenClass;
+			whitespace: child children first;
+			yourself
+	].
+	
+	block isSymbol ifTrue: [ 
+		changeStatus change.
+		^ PPCSymbolActionNode new
+			block: block;
+			name: name;
+			child: child;
+			yourself
+	]
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCAndNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,33 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCDelegateNode subclass:#PPCAndNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCAndNode comment:''
+!
+
+!PPCAndNode methodsFor:'as yet unclassified'!
+
+compileWith: compiler effect: effect id: id
+
+	compiler startMethod: id.
+	compiler addVariable: 'memento'.
+	compiler addVariable: 'retval'.
+	compiler add: (compiler smartRemember: child).
+	
+	compiler add: 'retval :='.
+	compiler callOnLine: (child compileWith: compiler).
+	compiler add: (compiler smartRestore: child).
+
+	compiler add: '^ retval'.
+ ^ compiler stopMethod.
+!
+
+prefix
+	^ #and
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCAnyNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,39 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCNode subclass:#PPCAnyNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCAnyNode comment:''
+!
+
+!PPCAnyNode methodsFor:'as yet unclassified'!
+
+acceptsEpsilon
+	^ false
+!
+
+asInlined
+	^ PPCInlineAnyNode new
+		name: name;
+		yourself
+!
+
+compileWith: compiler effect: effect id: id
+	compiler startMethod: id.
+	compiler add: '^ context next ifNil: [ error := true. ].'.
+ ^ compiler stopMethod.	
+!
+
+firstCharParser
+	^ #any asParser
+	
+!
+
+prefix
+	^ #any
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCBridge.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,42 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPParser subclass:#PPCBridge
+	instanceVariableNames:'selector'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Core'
+!
+
+PPCBridge comment:''
+!
+
+!PPCBridge class methodsFor:'as yet unclassified'!
+
+on: aSymbol
+	^ self new
+		selector: aSymbol;
+		yourself
+! !
+
+!PPCBridge methodsFor:'as yet unclassified'!
+
+call
+	^ 'self callParser: ', self id, '.'.
+!
+
+selector: aSymbol
+	selector := aSymbol
+! !
+
+!PPCBridge methodsFor:'parsing'!
+
+parseOn: aPPContext
+	| retval |
+	retval := (aPPContext compiledParser) perform: selector.
+	(aPPContext compiledParser isError) ifTrue: [ 
+		aPPContext compiledParser clearError.		
+		^ PPFailure message: 'error' context: aPPContext 
+	].
+	^ retval
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCCharSetPredicateNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,42 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCAbstractPredicateNode subclass:#PPCCharSetPredicateNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCCharSetPredicateNode comment:''
+!
+
+!PPCCharSetPredicateNode methodsFor:'as yet unclassified'!
+
+asInlined
+	^ PPCInlineCharSetPredicateNode new
+		predicate: predicate;
+		name: name;
+		yourself
+!
+
+bodyOfPredicate: compiler
+	| classification classificationId |
+	classification := self extendClassification: predicate classification.
+	classificationId := compiler idFor: classification prefixed: #classification.
+	compiler addConstant: classification as: classificationId.
+	
+	compiler addOnLine: '(', classificationId, ' at: context peek asInteger)'.
+	compiler indent.
+	compiler add: 'ifFalse: [ self error: ''predicate not found'' ]'.
+	compiler add: 'ifTrue: [ context next ].'.
+	compiler dedent.
+!
+
+start: compiler id: id
+	compiler startMethod: id
+!
+
+stop: compiler
+	^ compiler stopMethod
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCCharacterNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,32 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCAbstractCharacterNode subclass:#PPCCharacterNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCCharacterNode comment:''
+!
+
+!PPCCharacterNode methodsFor:'as yet unclassified'!
+
+start: compiler id: id
+	compiler startMethod: id.
+	compiler add: '^ '.
+!
+
+stop: compiler
+	^ compiler stopMethod
+! !
+
+!PPCCharacterNode methodsFor:'optimizing'!
+
+asInlined
+	^ PPCInlineCharacterNode new
+		character: character;
+		name: name;
+		yourself
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCChoiceNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,77 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCListNode subclass:#PPCChoiceNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCChoiceNode comment:''
+!
+
+!PPCChoiceNode methodsFor:'as yet unclassified'!
+
+acceptsEpsilon
+	^ self acceptsEpsilonOpenSet: IdentitySet new.
+!
+
+acceptsEpsilonOpenSet: set
+	set add: self.
+	^ self children anySatisfy: [:e | e acceptsEpsilonOpenSet: set ].
+!
+
+compileWith: compiler effect: effect id: id
+	| firsts guard  |
+	compiler addVariable: 'element'.
+
+	firsts := (self firstSetSuchThat: [ :e | (e isKindOf: PPCTrimmingTokenNode) or: [ e isTerminal ] ]).
+	
+	compiler startMethod: id.
+	compiler addVariable: 'element'.
+
+	"If we start with trimming token, we should invoke the whitespace parser"
+	(firsts allSatisfy: [ :e | e isKindOf: PPCTrimmingTokenNode ]) ifTrue: [  
+		firsts anyOne compileWhitespace: compiler.
+	].
+	
+	(1 to: children size) do: [ :idx  | |child|
+		child := children at: idx.
+		
+		(compiler guards and: [ (guard := PPCGuard on: child) makesSense ]) ifTrue: [ 	
+			guard id: (compiler idFor: guard prefixed: #guard).
+			guard compileGuard: compiler.
+			compiler add: ' ifTrue: [ '.
+			compiler indent.
+				compiler add: 'self clearError.'.
+				compiler add: 'element := '.
+				compiler callOnLine: (child compileWith: compiler).
+				compiler add: 'error ifFalse: [ ^ element ].'.
+			compiler dedent.
+			compiler add: ' ].'.
+		] ifFalse: [
+			compiler add: 'self clearError.'.
+			compiler add: 'element := '.
+			compiler callOnLine: (child compileWith: compiler).
+			compiler add: 'error ifFalse: [ ^ element ].'.
+		]
+	].
+	compiler add: '^ self error: ''no choice suitable'''.
+ ^ compiler stopMethod.
+!
+
+prefix
+	^ #ch
+! !
+
+!PPCChoiceNode methodsFor:'optimizing'!
+
+optimize: params status: changeStatus
+	| retval |
+	retval := self.
+	retval := retval rewrite: params status: changeStatus.
+	retval := retval inline: params status: changeStatus.
+	
+	^ retval
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCCompiledMethod.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,26 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+Object subclass:#PPCCompiledMethod
+	instanceVariableNames:'code id'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Core'
+!
+
+PPCCompiledMethod comment:''
+!
+
+!PPCCompiledMethod methodsFor:'as yet unclassified'!
+
+call
+	^ 'self ', self methodName, '.'.
+!
+
+id: value
+	id := value
+!
+
+methodName
+	^ id
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCCompiler.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,416 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+Object subclass:#PPCCompiler
+	instanceVariableNames:'compilerStack compiledParser cache inlining debug profile
+		currentMethod lastMethod guards ids updateContextMethod tokenMode'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Core'
+!
+
+PPCCompiler comment:''
+!
+
+!PPCCompiler methodsFor:'accessing'!
+
+fastMode
+	^ tokenMode
+!
+
+inlining
+	^ inlining
+!
+
+inlining: value
+	inlining := value
+!
+
+lastMethod
+	^ lastMethod 
+!
+
+parameters: associations
+	| key value |
+	associations do: [ :ass |
+		key := ass key.
+		value := ass value.
+		
+		(key = #profile) ifTrue: [ profile := value ].
+		(key = #inline) ifTrue: [ inlining := value ].
+		(key = #guards) ifTrue: [ guards := value ].
+	]
+!
+
+profile
+	^ profile
+!
+
+profile: aBoolean
+	profile := aBoolean 
+!
+
+startInline: id
+	self push.
+	
+	currentMethod := PPCInlinedMethod new.
+	currentMethod id: id.	
+	currentMethod profile: self profile.
+! !
+
+!PPCCompiler methodsFor:'cleaning'!
+
+clean: class
+"	Transcript crShow: 'Cleaning time: ',
+	[	
+"		self cleanGeneratedMethods: class.
+		self cleanInstVars: class.
+		self cleanParsers: class.
+		self cleanConstants: class.
+"	] timeToRun asMilliSeconds asString, 'ms'."
+!
+
+cleanConstants: class
+	class constants removeAll.
+!
+
+cleanGeneratedMethods: class
+	(class allSelectorsInProtocol: #generated) do: [ :selector | 
+		class removeSelectorSilently: selector ].
+!
+
+cleanInstVars: class
+	class class instanceVariableNames: ''.
+!
+
+cleanParsers: class
+	class parsers removeAll.
+! !
+
+!PPCCompiler methodsFor:'code generation'!
+
+add: string
+	currentMethod add: string.
+!
+
+addConstant: value as: name
+	compiledParser addConstant: value as: name.
+!
+
+addOnLine: string
+	currentMethod addOnLine: string.
+!
+
+addVariable: name
+	currentMethod addVariable: name.
+!
+
+allowInline
+	currentMethod allowInline
+!
+
+cache: id as: value
+	cache at: id put: value.
+!
+
+cachedValue: id
+	^ cache at: id ifAbsent: [ nil ]
+!
+
+call: anotherMethod
+	currentMethod add: anotherMethod call.
+!
+
+callOnLine: anotherMethod
+	currentMethod addOnLine: anotherMethod call.
+!
+
+checkCache: id
+	| method value |
+	"Check if method is already compiled/hand written"
+	method := compiledParser compiledMethodAt: id ifAbsent: [ nil ].
+	method ifNotNil: [ ^ lastMethod := PPCCompiledMethod new id: id; yourself ].
+	
+	^ (value := self cachedValue: id) ifNotNil: [ lastMethod := value ].
+!
+
+dedent
+	currentMethod dedent
+!
+
+indent
+	currentMethod indent
+!
+
+nl
+	currentMethod nl
+!
+
+pop
+	| array |
+	array := compilerStack pop.
+	currentMethod := array first	
+!
+
+push
+	| array |
+	array := { currentMethod }.
+	compilerStack push: array.
+	(compilerStack size > 500 )ifTrue: [ self error: 'unless it is very complex grammar, there is an error somewhere' ]
+!
+
+smartRemember: parser
+	^ self smartRemember: parser to: #memento 
+!
+
+smartRemember: parser to: variableName
+	parser isContextFree ifTrue: [ 
+		^ variableName, ' := context lwRemember.'.
+	].
+	^ variableName, ':= context remember.'
+!
+
+smartRestore: parser
+	^ self smartRestore: parser from: #memento 
+!
+
+smartRestore: parser from: mementoName
+	parser isContextFree ifTrue: [ 
+		^ 'context lwRestore: ', mementoName, '.'.
+	].
+	^ 'context restore: ', mementoName, '.'.
+!
+
+startMethod: id
+	|  sender |
+	(cache includesKey: id) ifTrue: [ self error: 'OOOUPS!!' ].
+	self push.
+	
+	
+	currentMethod := PPCMethod new.
+	currentMethod id: id.
+	currentMethod profile: self profile.	
+	self cache: id as: currentMethod.
+	
+	sender := thisContext sender receiver.
+	self add: '"Method generated from ', sender asString, '"'.
+!
+
+startTokenMode
+	tokenMode := true
+!
+
+stopInline
+	| sender |
+	sender := thisContext sender receiver.
+	self add: '"Inlined by ', sender asString, '"'.
+	lastMethod := currentMethod.
+	currentMethod := nil.
+	self pop.
+!
+
+stopMethod
+	self cache: currentMethod methodName as: currentMethod.
+	lastMethod := currentMethod.
+	currentMethod := nil.
+	self pop.
+!
+
+stopTokenMode
+	tokenMode := false
+! !
+
+!PPCCompiler methodsFor:'code generation - ids'!
+
+idFor: object prefixed: prefix
+	^ self idFor: object prefixed: prefix effect: #none
+!
+
+idFor: object prefixed: prefix effect: effect
+	| body suffix |
+	^ ids at: object ifAbsentPut: [ 
+		suffix := self fastMode ifTrue: [ '_fast' ] ifFalse: [ '' ].
+		((object isKindOf: PPCNode) and: [object name isNotNil]) ifTrue: [ 
+			 (object name, suffix) asSymbol
+		] ifFalse: [ 
+			body := ids size asString.
+			(prefix asString, '_', body, suffix) asSymbol
+		]
+	]
+!
+
+idFor: object prefixed: prefix suffixed: suffix effect: effect
+	| body |
+	^ ids at: object ifAbsentPut: [ 
+		((object isKindOf: PPCNode) and: [object name isNotNil]) ifTrue: [ 
+			 (object name, suffix) asSymbol
+		] ifFalse: [ 
+			body := ids size asString.
+			(prefix asString, '_', body, suffix) asSymbol
+		]
+	]
+! !
+
+!PPCCompiler methodsFor:'compiling'!
+
+compile: aPPParser as: name
+	^ self compile: aPPParser as: name params: #()
+!
+
+compile: aPPParser as: name params: params
+	| parser |
+	parser := self copy: aPPParser.
+	parser := self toCompilerTree: parser.
+	parser := self optimize: parser params: params.
+	parser := self compileTree: parser as: name parser: aPPParser params: params.
+	^ parser
+	
+!
+
+compileTree: compilerTree as: name parser: parser params: params
+	|  |
+	params do: [ :p | 
+		(p key = #guards) ifTrue: [ self guards: p value ].
+	].	
+
+	"
+		To create a new Package so that a new classes are not in PetitCompiler package.
+		TODO JK: This is HACK, needs some more interoperable approach
+	"
+	RPackageOrganizer default registerPackageNamed: 'PetitCompiler-Generated'.
+	compiledParser := (Smalltalk at: name ifAbsent: [ nil ]).
+	compiledParser ifNil: [ 
+							PPCompiledParser subclass: name.
+							compiledParser := Smalltalk at: name.
+							compiledParser category: 'PetitCompiler-Generated'							
+						] ifNotNil: [ 
+							self clean: compiledParser 
+						].	
+	compiledParser constants removeAll.
+	
+
+	
+	self startMethod: #start.
+	self add: '^ '.
+	self callOnLine: (compilerTree compileWith: self).
+	self stopMethod.
+
+	self installMethodsAndVariables: compiledParser.
+
+	compiledParser referringParser: parser.
+	^ compiledParser
+!
+
+copy: parser
+	^ parser transform: [ :p | p copy ].
+!
+
+installMethods: class
+	cache keysAndValuesDo: [ :key :method |
+		class compileSilently: method code classified: 'generated'.
+	]
+!
+
+installMethodsAndVariables: class
+	
+	self installVariables: class.
+	self installMethods: class.	
+	
+!
+
+installVariables: class
+	| string |
+	string := class constants keys inject: '' into: [:r :e | r, ' ', e  ].
+	PPCompiledParser subclass: class name instanceVariableNames: string classVariableNames: '' category: 'PetitCompiler-Generated'.
+!
+
+optimize: parser params: params
+	| retval |
+	retval := parser optimizeTree: params.
+	retval checkTree.
+	^ retval
+!
+
+toCompilerTree: parser
+	^ parser asCompilerTree
+! !
+
+!PPCCompiler methodsFor:'guard'!
+
+addSequenceGuard: parser
+
+	| firsts  guardSet guardSetId |
+	(self guards not or: [(guardSet := self guardCharSet: parser) isNil]) ifTrue: [ ^ self].
+
+	firsts := (parser firstSetSuchThat: [ :e | (e isKindOf: PPTokenParser) or: [ e isTerminal ] ]).
+	
+	"If we start with PPTokenParser, we should invoke the whitespace parser"
+	(firsts allSatisfy: [ :e | e isKindOf: PPTokenParser ]) ifTrue: [  
+		guardSetId := (self idFor: guardSet prefixed: #guard).
+		self addConstant: guardSet as: guardSetId.
+		self add: 'wsParser parseOn: context.'.
+		self add: 'context atEnd ifTrue: [ ^ self error ].'.
+		self add: '(', guardSetId, ' value: context peek) ifFalse: [ ^ self error ].'.
+	].
+
+	(firsts allSatisfy: [ :e | e isTerminal ]) ifTrue: [  
+		guardSetId := (self idFor: guardSet prefixed: #guard).
+		self addConstant: guardSet as: guardSetId.
+		self add: 'context atEnd ifTrue: [ ^ self error ].'.
+		self add: '(', guardSetId, ' value: context peek) ifFalse: [ ^ self error ].'.
+	].
+!
+
+guardCharSet: parser
+	| fs charSet   |
+	"No Guards fro trimming parser so far"
+	(parser firstSetSuchThat: [ :e | e isKindOf: PPCTrimNode ]) isEmpty ifFalse: [ ^ nil ].
+
+	"Makes no sense to do guard for epsilon parse"
+	(parser acceptsEpsilon) ifTrue: [ ^ nil ].
+
+	fs := parser firstSet.
+	fs do: [ :p |
+		"If we can accept epsilon guard does not make sense"
+		p isNullable ifTrue: [ ^ nil ].
+	].
+	
+	charSet := PPCharSetPredicate on: [:char | fs anySatisfy: [:e | (e firstCharParser parse: char asString) isPetitFailure not ]].
+	^ charSet
+!
+
+guards
+	^ guards
+!
+
+guards: aBoolean
+	guards := aBoolean
+! !
+
+!PPCCompiler methodsFor:'initialization'!
+
+initialize
+	super initialize.
+	compilerStack := Stack new.
+	cache := IdentityDictionary new.
+	ids := IdentityDictionary new.
+	
+	tokenMode := false.
+	inlining := true.
+	profile := false.
+	guards := true.
+! !
+
+!PPCCompiler methodsFor:'ppcmethod protocol'!
+
+bridge
+	^ PPCBridge on: lastMethod methodName.
+!
+
+call
+	^ lastMethod call
+!
+
+canInline
+	^ lastMethod canInline
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCContext.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,278 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPStream subclass:#PPCContext
+	instanceVariableNames:'root properties globals furthestFailure compiledParser rc ws'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Context'
+!
+
+PPCContext comment:''
+!
+
+!PPCContext class methodsFor:'as yet unclassified'!
+
+new
+	^ self basicNew initialize
+!
+
+on: aPPParser stream: aStream
+	^ self basicNew 
+		initialize;
+		root: aPPParser;
+		stream: aStream asPetitStream;
+		yourself
+! !
+
+!PPCContext methodsFor:'accessing-globals'!
+
+globalAt: aKey
+	"Answer the global property value associated with aKey."
+	
+	^ self globalAt: aKey ifAbsent: [ self error: 'Property not found' ]
+!
+
+globalAt: aKey ifAbsent: aBlock
+	"Answer the global property value associated with aKey or, if aKey isn't found, answer the result of evaluating aBlock."
+	
+	^ globals isNil
+		ifTrue: [ aBlock value ]
+		ifFalse: [ globals at: aKey ifAbsent: aBlock ]
+!
+
+globalAt: aKey ifAbsentPut: aBlock
+	"Answer the global property associated with aKey or, if aKey isn't found store the result of evaluating aBlock as new value."
+	
+	^ self globalAt: aKey ifAbsent: [ self globalAt: aKey put: aBlock value ]
+!
+
+globalAt: aKey put: anObject
+	"Set the global property at aKey to be anObject. If aKey is not found, create a new entry for aKey and set is value to anObject. Answer anObject."
+
+	^ (globals ifNil: [ globals := Dictionary new: 1 ])
+		at: aKey put: anObject
+!
+
+hasGlobal: aKey
+	"Test if the global property aKey is present."
+	
+	^ globals notNil and: [ globals includesKey: aKey ]
+!
+
+invoke: parser
+	^ parser parseOn: self
+!
+
+peek2
+	position = readLimit ifTrue: [ ^ nil ].
+	^ collection at: (position + 1)
+!
+
+removeGlobal: aKey
+	"Remove the property with aKey. Answer the property or raise an error if aKey isn't found."
+	
+	^ self removeGlobal: aKey ifAbsent: [ self error: 'Property not found' ]
+!
+
+removeGlobal: aKey ifAbsent: aBlock
+	"Remove the global property with aKey. Answer the value or, if aKey isn't found, answer the result of evaluating aBlock."
+	
+	| answer |
+	globals isNil ifTrue: [ ^ aBlock value ].
+	answer := globals removeKey: aKey ifAbsent: aBlock.
+	globals isEmpty ifTrue: [ globals := nil ].
+	^ answer
+! !
+
+!PPCContext methodsFor:'accessing-properties'!
+
+hasProperty: aKey
+	"Test if the property aKey is present."
+	
+	^ properties notNil and: [ properties includesKey: aKey ]
+!
+
+propertyAt: aKey
+	"Answer the property value associated with aKey."
+	
+	^ self propertyAt: aKey ifAbsent: [ self error: 'Property not found' ]
+!
+
+propertyAt: aKey ifAbsent: aBlock
+	"Answer the property value associated with aKey or, if aKey isn't found, answer the result of evaluating aBlock."
+	
+	^ properties isNil
+		ifTrue: [ aBlock value ]
+		ifFalse: [ properties at: aKey ifAbsent: aBlock ]
+!
+
+propertyAt: aKey ifAbsentPut: aBlock
+	"Answer the property associated with aKey or, if aKey isn't found store the result of evaluating aBlock as new value."
+	
+	^ self propertyAt: aKey ifAbsent: [ self propertyAt: aKey put: aBlock value ]
+!
+
+propertyAt: aKey put: anObject
+	"Set the property at aKey to be anObject. If aKey is not found, create a new entry for aKey and set is value to anObject. Answer anObject."
+
+	^ (properties ifNil: [ properties := Dictionary new: 1 ])
+		at: aKey put: anObject
+!
+
+removeProperty: aKey
+	"Remove the property with aKey. Answer the property or raise an error if aKey isn't found."
+	
+	^ self removeProperty: aKey ifAbsent: [ self error: 'Property not found' ]
+!
+
+removeProperty: aKey ifAbsent: aBlock
+	"Remove the property with aKey. Answer the value or, if aKey isn't found, answer the result of evaluating aBlock."
+	
+	| answer |
+	properties isNil ifTrue: [ ^ aBlock value ].
+	answer := properties removeKey: aKey ifAbsent: aBlock.
+	properties isEmpty ifTrue: [ properties := nil ].
+	^ answer
+! !
+
+!PPCContext methodsFor:'acessing'!
+
+hash
+	^ collection hash
+!
+
+initializeFor: parser
+	parser == root ifTrue: [ ^ self ].
+	
+	root := parser.
+	root allParsersDo: [ :p | 
+		p updateContext: self
+	]
+!
+
+root
+	^ root 
+!
+
+stream
+	^ self
+!
+
+stream: aStream
+	collection := aStream collection.
+	position := aStream position.
+	readLimit := collection size.
+! !
+
+!PPCContext methodsFor:'as yet unclassified'!
+
+atWs
+	^ position = ws
+!
+
+goUpTo: char
+	[ position < readLimit ] whileTrue: [ 
+		(collection at: position + 1) = char ifTrue: [ position := position + 1. ^ char ] .
+		position := position + 1.
+	]
+	
+!
+
+setWs
+	^ ws := position
+!
+
+ws
+	^ ws
+!
+
+ws: anInteger
+	ws := anInteger
+! !
+
+!PPCContext methodsFor:'converting'!
+
+asCompiledParserContext
+	^ self
+! !
+
+!PPCContext methodsFor:'failures'!
+
+furthestFailure
+	^ furthestFailure 
+!
+
+noteFailure: aPPFailure
+	(aPPFailure position > furthestFailure position)
+		ifTrue: [ furthestFailure := aPPFailure ].
+! !
+
+!PPCContext methodsFor:'initialization'!
+
+compiledParser
+	^ compiledParser
+!
+
+compiledParser: anObject
+	compiledParser := anObject
+!
+
+initialize
+	
+	rc := 0.
+	"Note a failure at -1"
+	furthestFailure  := PPFailure new position: -1; yourself.
+! !
+
+!PPCContext methodsFor:'memoization'!
+
+lwRemember
+
+	^ position
+!
+
+lwRestore: aPPContextMemento
+	
+	position := aPPContextMemento.
+!
+
+remember
+	| memento |
+"
+	^ position
+"
+	memento := PPCContextMemento new
+		position: position;
+		yourself.
+		
+	self rememberProperties: memento.
+	"JK: Just while developing"
+	rc := rc + 1.
+	(rc > ((self size + 1)* 1000*1000)) ifTrue: [ self error: 'Hey, this is not normal, is it?' ].
+	^ memento
+!
+
+rememberProperties: aPPContextMemento
+	properties ifNil: [ ^ self ].
+	
+	properties keysAndValuesDo: [ :key :value |
+		aPPContextMemento propertyAt: key put: value
+	].
+!
+
+restore: aPPContextMemento
+"	
+	position := aPPContextMemento.
+"	
+	position := aPPContextMemento position.
+	
+	self restoreProperties: aPPContextMemento.
+			
+!
+
+restoreProperties: aPPContextMemento
+	aPPContextMemento keysAndValuesDo: [ :key :value |
+		self propertyAt: key put: value
+	].
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCContextMemento.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,115 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+Object subclass:#PPCContextMemento
+	instanceVariableNames:'position properties'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Context'
+!
+
+PPCContextMemento comment:''
+!
+
+!PPCContextMemento methodsFor:'accessing'!
+
+position
+	^ position
+!
+
+position: anInteger
+	position := anInteger 
+! !
+
+!PPCContextMemento methodsFor:'accessing - properties'!
+
+hasProperty: aKey
+	"Test if the property aKey is present."
+	
+	^ properties notNil and: [ properties includesKey: aKey ]
+!
+
+keysAndValuesDo: aBlock
+	properties ifNil: [ ^ self ].
+	properties keysAndValuesDo: [ :key :value | aBlock value: key value: value copy ] 
+!
+
+propertiesSize
+	properties ifNil: [ ^ 0 ].
+	^ properties size.
+!
+
+propertyAt: aKey
+	"Answer the property value associated with aKey."
+	
+	^ self propertyAt: aKey ifAbsent: [ self error: 'Property not found' ]
+!
+
+propertyAt: aKey ifAbsent: aBlock
+        "Answer the property value associated with aKey or, if aKey isn't found, answer the result of evaluating aBlock."
+
+        properties isNil
+                ifTrue: [ ^ aBlock value ]
+                ifFalse: [ 
+                        (properties includesKey: aKey) ifTrue: [ 
+                                ^ (properties at: aKey) copy
+                        ].
+                        ^ aBlock value
+                ]
+
+    "Created: / 26-10-2014 / 01:23:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+propertyAt: aKey ifAbsentPut: aBlock
+	"Answer the property associated with aKey or, if aKey isn't found store the result of evaluating aBlock as new value."
+	
+	^ self propertyAt: aKey ifAbsent: [ self propertyAt: aKey put: aBlock value ]
+!
+
+propertyAt: aKey put: anObject
+	"Set the property at aKey to be anObject. If aKey is not found, create a new entry for aKey and set is value to anObject. Answer anObject."
+
+	^ (properties ifNil: [ properties := Dictionary new: 1 ])
+		at: aKey put: (anObject copy)
+!
+
+removeProperty: aKey
+	"Remove the property with aKey. Answer the property or raise an error if aKey isn't found."
+	
+	^ self removeProperty: aKey ifAbsent: [ self error: 'Property not found' ]
+!
+
+removeProperty: aKey ifAbsent: aBlock
+	"Remove the property with aKey. Answer the value or, if aKey isn't found, answer the result of evaluating aBlock."
+	
+	| answer |
+	properties isNil ifTrue: [ ^ aBlock value ].
+	answer := properties removeKey: aKey ifAbsent: aBlock.
+	properties isEmpty ifTrue: [ properties := nil ].
+	^ answer
+! !
+
+!PPCContextMemento methodsFor:'comparing'!
+
+= anObject
+	
+	(self == anObject) ifTrue: [ ^ true ].
+	(anObject class = PPCContextMemento) ifFalse: [ ^ false ].
+	
+	(anObject position = position) ifFalse: [ ^ false ].
+
+	(self propertiesSize = anObject propertiesSize) ifFalse: [ ^ false ].
+
+	self keysAndValuesDo: [ :key :value |
+		(anObject hasProperty: key) ifFalse: [ ^ false ].
+		((anObject propertyAt: key) = value) ifFalse: [ ^ false ]. 
+ 	].
+	
+	^ true.
+!
+
+hash
+        ^ position hash bitXor: properties hash.
+
+    "Modified: / 26-10-2014 / 01:46:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCDelegateNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,75 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCNode subclass:#PPCDelegateNode
+	instanceVariableNames:'child'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCDelegateNode comment:''
+!
+
+
+!PPCDelegateNode methodsFor:'accessing'!
+
+child
+	^ child
+!
+
+child: whatever
+	child := whatever 
+!
+
+children
+	^ { child }
+! !
+
+!PPCDelegateNode methodsFor:'analysis'!
+
+acceptsEpsilon
+	^ child acceptsEpsilonOpenSet: (IdentitySet with: self).
+!
+
+acceptsEpsilonOpenSet: set
+	(set includes: child) ifFalse: [ 
+		set add: child.
+		^ child acceptsEpsilonOpenSet: set 
+	].
+	^ false
+! !
+
+!PPCDelegateNode methodsFor:'optimizing'!
+
+inline: changeStatus	
+	| inlinedNode |
+	inlinedNode := child asInlined.
+	(inlinedNode ~= child) ifTrue: [ 
+		changeStatus change.
+		self replace: child with: inlinedNode.
+	]
+!
+
+optimize: params status: changeStatus
+	| retval |
+	retval := self.
+	
+	retval := retval rewrite: params status: changeStatus.
+	retval := retval inline: params status: changeStatus.
+	
+	^ retval
+! !
+
+!PPCDelegateNode methodsFor:'transformation'!
+
+replace: node with: anotherNode
+	child == node ifTrue: [ child := anotherNode ]
+! !
+
+!PPCDelegateNode class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCForwardNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,43 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCDelegateNode subclass:#PPCForwardNode
+	instanceVariableNames:'block'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCForwardNode comment:''
+!
+
+!PPCForwardNode methodsFor:'compiling'!
+
+check
+	^ (child name = self name and: [child suffix = self suffix]) ifTrue: [ 'referring to itself!!' ]
+!
+
+compileWith: compiler effect: effect id: id
+	compiler startMethod: id.
+	compiler add: '^ '.
+	"child name = 'keyword' ifTrue: [ self halt ]."
+	compiler callOnLine: (child compileWith: compiler).
+ ^ compiler stopMethod.	
+!
+
+prefix
+	^ #fw
+!
+
+rewrite: changeStatus
+	child name ifNil: [  
+		changeStatus change.
+		child name: self name.
+		^ child
+	].
+
+	(child name = self name) ifTrue: [ 
+		changeStatus change.
+		^ child
+	]
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCGuard.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,150 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+Object subclass:#PPCGuard
+	instanceVariableNames:'node classification id message'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Core'
+!
+
+PPCGuard comment:''
+!
+
+!PPCGuard class methodsFor:'as yet unclassified'!
+
+on: aPPCNode
+	^ self new
+		initializeFor: aPPCNode;
+		yourself
+! !
+
+!PPCGuard methodsFor:'accessing'!
+
+id
+	
+	^ id
+!
+
+id: anObject
+	
+	id := anObject
+!
+
+message
+	(message == #unknown) ifTrue: [ 
+		(self testMessage: #isLetter) ifTrue: [ ^ message := #isLetter ].
+		(self testMessage: #isAlphaNumeric) ifTrue: [ ^ message := #isAlphaNumeric ].
+		(self testMessage: #isDigit) ifTrue: [ ^ message := #isDigit ].
+		
+		^ message := nil.
+	].
+	^ message
+! !
+
+!PPCGuard methodsFor:'as yet unclassified'!
+
+classificationOn: aBlock
+	classification := Array new: 255.
+	1 to: classification size do: [ :index |
+		classification at: index put: (aBlock
+			value: (Character value: index)) ].
+!
+
+compileAny: compiler
+	compiler add: '(context atEnd not)'.
+!
+
+compileCharacter: compiler
+	self assert: (classification select: [ :e | e ]) size = 1.
+	
+	classification keysAndValuesDo: [ :index :value | value ifTrue: [  
+		(index > 32 and: [ index < 127 ]) ifTrue: [ 
+			compiler add: '(context peek = ', (Character value: index) printString, ')'
+		] ifFalse: [ 
+			id := compiler idFor: (Character value: index) prefixed: #character.
+			compiler addConstant: (Character value: index) as: id.
+			compiler add: '(context peek = ', id, ')'.
+	 	] 
+	] ].
+
+!
+
+compileGuard: compiler id: symbol
+	self id: symbol.
+	^ self compileGuard: compiler
+!
+
+compileMessage: compiler
+	compiler add: '(context peek ', message, ')'
+!
+
+initializeFor: aPPCNode
+	node := aPPCNode.
+	message := #unknown.
+	id := nil.
+	
+	"No Guards for trimming parser so far"
+	((node firstSetSuchThat: [ :e | e isKindOf: PPCTrimNode ]) isEmpty not) ifTrue: [ 
+		^ self initializeForNoGuard 
+	].
+	(node acceptsEpsilon) ifTrue: [  
+		^ self initializeForEpsilon
+	].
+
+	self classificationOn: [:char | node firstSet anySatisfy: [:e | (e firstCharParser parse: char asString) isPetitFailure not ]]
+!
+
+initializeForEpsilon
+	classification := nil
+	
+!
+
+initializeForNoGuard
+	classification := nil
+	
+!
+
+testAny
+	^ classification allSatisfy: [ :e | e ].
+!
+
+testMessage: selector
+ 	classification keysAndValuesDo: [:index :element |
+		(element = ((Character value: index) perform: selector)) ifFalse: [ 
+			^ false 
+		]
+	].
+	^ true
+!
+
+testSingleCharacter
+	^ (classification select: [ :e | e ]) size = 1
+! !
+
+!PPCGuard methodsFor:'code generation'!
+
+compileArray: compiler
+	| array |
+	self assert: id isNotNil.
+
+	array := ((classification asOrderedCollection) addLast: false; yourself) asArray.
+	compiler addConstant: array as: id.
+	compiler add: '(', id, ' at: context peek asInteger)'.
+!
+
+compileGuard: compiler
+	self assert: self makesSense description: 'No Guard could be compiled'.
+	self assert: id notNil.
+	
+	
+	self message ifNotNil: [ ^ self compileMessage: compiler ].
+	self testAny ifTrue: [ ^ self compileAny: compiler ].
+	self testSingleCharacter ifTrue: [ ^ self compileCharacter: compiler ].
+	
+	^ self compileArray: compiler
+!
+
+makesSense
+	^ classification isNil not
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCInlineAnyNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,29 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCAnyNode subclass:#PPCInlineAnyNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCInlineAnyNode comment:''
+!
+
+!PPCInlineAnyNode methodsFor:'as yet unclassified'!
+
+asInlined
+	^ self
+!
+
+compileWith: compiler effect: effect id: id
+	compiler startInline: id.
+	compiler add: 'context next ifNil: [ error := true. ].'.
+ ^ compiler stopInline.
+!
+
+printOn: aStream
+	aStream nextPutAll: #inlined.
+	super printOn: aStream.
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCInlineCharSetPredicateNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,25 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCCharSetPredicateNode subclass:#PPCInlineCharSetPredicateNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCInlineCharSetPredicateNode comment:''
+!
+
+!PPCInlineCharSetPredicateNode methodsFor:'as yet unclassified'!
+
+asInlined
+	^ self
+!
+
+compileWith: compiler effect: effect id: id
+	compiler startInline: id.
+	compiler add: ''.
+	self bodyOfPredicate: compiler.
+ ^ compiler stopInline.
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCInlineCharacterNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,27 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCAbstractCharacterNode subclass:#PPCInlineCharacterNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCInlineCharacterNode comment:''
+!
+
+!PPCInlineCharacterNode methodsFor:'as yet unclassified'!
+
+printOn: aStream
+	aStream nextPutAll: #inlined.
+	super printOn: aStream.
+!
+
+start: compiler id: id
+	compiler startInline: id.
+!
+
+stop: compiler
+	^ compiler stopInline
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCInlineLiteralNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,47 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCAbstractLiteralNode subclass:#PPCInlineLiteralNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCInlineLiteralNode comment:''
+!
+
+!PPCInlineLiteralNode methodsFor:'compiling'!
+
+compileWith: compiler effect: effect id: id
+	| encodedLiteral |
+	
+	encodedLiteral := self encodeQuotes: literal.
+	compiler startInline: id.
+	compiler add: '((context peek: ', literal size asString, ') = #''', encodedLiteral, ''')'.
+	compiler indent.
+	compiler add: ' ifTrue: [ context skip: ', literal size asString, '. #''', encodedLiteral, ''']'.
+	compiler add: ' ifFalse: [ self error: ''', encodedLiteral,  ' expected'' ].'.
+	compiler dedent.
+ ^ compiler stopInline.
+!
+
+inlineWith: compiler id: id
+	| encodedLiteral |
+	
+	encodedLiteral := self encodeQuotes: literal.
+	compiler startInline: id.
+	compiler add: '((context peek: ', literal size asString, ') = #''', encodedLiteral, ''')'.
+	compiler indent.
+	compiler add: ' ifTrue: [ context skip: ', literal size asString, '. #''', encodedLiteral, ''']'.
+	compiler add: ' ifFalse: [ self error: ''', encodedLiteral,  ' expected'' ].'.
+	compiler dedent.
+ ^ compiler stopInline.
+! !
+
+!PPCInlineLiteralNode methodsFor:'printing'!
+
+printOn: aStream
+	aStream nextPutAll: '#inline'.
+	super printOn: aStream
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCInlineMessagePredicateNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,25 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCMessagePredicateNode subclass:#PPCInlineMessagePredicateNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCInlineMessagePredicateNode comment:''
+!
+
+!PPCInlineMessagePredicateNode methodsFor:'as yet unclassified'!
+
+asInlined
+	^ self
+!
+
+compileWith: compiler effect: effect id: id
+	compiler startInline: id.
+	compiler add: ''.
+	self bodyOfPredicate: compiler.
+ ^ compiler stopInline.
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCInlineNilNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,24 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCNilNode subclass:#PPCInlineNilNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCInlineNilNode comment:''
+!
+
+!PPCInlineNilNode methodsFor:'as yet unclassified'!
+
+asInlined
+	^ self
+!
+
+compileWith: compiler effect: effect id: id
+	compiler startInline: id.
+	compiler add: 'nil.'.
+ ^ compiler stopInline.
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCInlineNotCharSetPredicateNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,25 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCNotCharSetPredicateNode subclass:#PPCInlineNotCharSetPredicateNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCInlineNotCharSetPredicateNode comment:''
+!
+
+!PPCInlineNotCharSetPredicateNode methodsFor:'as yet unclassified'!
+
+asInlined
+	^ self
+!
+
+compileWith: compiler effect: effect id: id
+	compiler startInline: id.
+	compiler add: ''.
+	self bodyOfPredicate: compiler.
+ ^ compiler stopInline.
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCInlineNotLiteralNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,55 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCAbstractLiteralNode subclass:#PPCInlineNotLiteralNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCInlineNotLiteralNode comment:''
+!
+
+!PPCInlineNotLiteralNode methodsFor:'accessing'!
+
+literal
+	
+	^ literal
+!
+
+literal: anObject
+	
+	literal := anObject
+!
+
+prefix
+	^ #notLit
+! !
+
+!PPCInlineNotLiteralNode methodsFor:'as yet unclassified'!
+
+compileWith: compiler effect: effect id: id
+	| encodedLiteral size |
+	encodedLiteral := self encodeQuotes: literal.
+	size := literal size asString.
+	
+	compiler startInline: id.
+	compiler add: '((context peek: ', size, ') =#''', encodedLiteral, ''')'.
+	compiler indent.
+	compiler add: ' ifTrue: [ self error: ''', encodedLiteral, ' not expected'' ]'.
+	compiler add: ' ifFalse: [ nil ].'.
+	compiler dedent.
+ ^ compiler stopInline.
+! !
+
+!PPCInlineNotLiteralNode methodsFor:'printing'!
+
+firstCharParser
+	^ literal first asParser not
+!
+
+printOn: aStream
+	aStream nextPutAll: #inlined.
+	super printOn: aStream.
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCInlineNotMessagePredicateNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,25 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCNotMessagePredicateNode subclass:#PPCInlineNotMessagePredicateNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCInlineNotMessagePredicateNode comment:''
+!
+
+!PPCInlineNotMessagePredicateNode methodsFor:'as yet unclassified'!
+
+asInlined
+	^ self
+!
+
+compileWith: compiler effect: effect id: id
+	compiler startInline: id.
+	compiler add: ''.
+	self bodyOfPredicate: compiler.
+ ^ compiler stopInline.
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCInlinePluggableNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,24 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCPluggableNode subclass:#PPCInlinePluggableNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCInlinePluggableNode comment:''
+!
+
+!PPCInlinePluggableNode methodsFor:'as yet unclassified'!
+
+asInlined
+	^ self
+!
+
+compileWith: compiler effect: effect id: id
+	compiler startInline: id.
+	compiler add: block asString, ' value: context.'.
+ ^ compiler stopInline.
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCInlineStrategy.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,45 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+Object subclass:#PPCInlineStrategy
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCInlineStrategy class instanceVariableNames:'Instance'
+
+"
+ No other class instance variables are inherited by this class.
+"
+!
+
+PPCInlineStrategy comment:''
+!
+
+!PPCInlineStrategy class methodsFor:'as yet unclassified'!
+
+instance
+	^ Instance ifNil: [ 
+		Instance := self basicNew initialize.
+	]
+!
+
+new
+	^ self instance
+! !
+
+!PPCInlineStrategy methodsFor:'as yet unclassified'!
+
+return: compiler
+	compiler add: ''.
+!
+
+start: compiler id: id
+	^ compiler startInline: id
+!
+
+stop: compiler
+ ^ compiler stopInline
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCInlinedMethod.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,22 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCMethod subclass:#PPCInlinedMethod
+	instanceVariableNames:'code'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Core'
+!
+
+PPCInlinedMethod comment:''
+!
+
+!PPCInlinedMethod methodsFor:'as yet unclassified'!
+
+call
+	^ self code
+!
+
+code
+	^ buffer contents trim
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCListNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,68 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCNode subclass:#PPCListNode
+	instanceVariableNames:'children'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCListNode comment:''
+!
+
+!PPCListNode methodsFor:'accessing'!
+
+children
+	^ children
+!
+
+children: anObject
+	
+	children := anObject
+! !
+
+!PPCListNode methodsFor:'analysis'!
+
+acceptsEpsilon
+	self subclassResponsibility
+!
+
+acceptsEpsilonOpenSet: set
+	self subclassResponsibility
+!
+
+replace: node with: anotherNode
+	children keysAndValuesDo: [ :index :child |
+		child == node ifTrue: [ children at: index put: anotherNode ] 
+	]
+! !
+
+!PPCListNode methodsFor:'copying'!
+
+postCopy
+	super postCopy.
+	children := children copy
+! !
+
+!PPCListNode methodsFor:'optimizing'!
+
+inline: changeStatus
+	| inlinedNode |
+	self children do: [ :child |
+		inlinedNode := child asInlined.
+		(inlinedNode ~= child) ifTrue: [ 
+			changeStatus change.
+			^ self replace: child with: inlinedNode.
+		]
+	]
+!
+
+optimize: params status: changeStatus
+	| retval |
+	retval := self.
+	retval := retval rewrite: params status: changeStatus.
+	retval := retval inline: params status: changeStatus.
+	
+	^ retval
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCLiteralNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,39 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCAbstractLiteralNode subclass:#PPCLiteralNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCLiteralNode comment:''
+!
+
+!PPCLiteralNode methodsFor:'compiling'!
+
+compileWith: compiler effect: effect id: id
+	| encodedLiteral |
+	
+	encodedLiteral := self encodeQuotes: literal.
+	compiler startMethod: id.
+	compiler addVariable: 'retval'.
+	compiler addVariable: 'position'.
+	compiler add: 'position := context position.'.
+
+	compiler add: 'retval := context next: ', literal size asString, '.'.
+	compiler add: 'retval = #''', encodedLiteral, ''' ifTrue: [ ^ #''', encodedLiteral, '''].'.
+	compiler add: 'context position: position.'.
+	compiler add: '^ self error: ''', encodedLiteral,  ' expected'' at: position'.
+ ^	compiler stopMethod.	
+! !
+
+!PPCLiteralNode methodsFor:'optimizing'!
+
+asInlined
+	^ PPCInlineLiteralNode new
+		literal: literal;
+		name: name;
+		yourself
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCMessagePredicateNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,42 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCAbstractPredicateNode subclass:#PPCMessagePredicateNode
+	instanceVariableNames:'message'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCMessagePredicateNode comment:''
+!
+
+!PPCMessagePredicateNode methodsFor:'accessing'!
+
+asInlined
+	^ PPCInlineMessagePredicateNode new
+		message: message;
+		predicate: predicate;
+		name: name;
+		yourself
+!
+
+message
+	
+	^ message
+!
+
+message: anObject
+	
+	message := anObject
+! !
+
+!PPCMessagePredicateNode methodsFor:'as yet unclassified'!
+
+bodyOfPredicate: compiler
+	compiler addOnLine: '(context peek ', self message, ')'.
+	compiler indent.
+	compiler add: 'ifFalse: [ self error: ''predicate not found'' ]'.
+	compiler add: 'ifTrue: [ context next ].'.
+	compiler dedent.
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCMethod.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,111 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+Object subclass:#PPCMethod
+	instanceVariableNames:'buffer variables indentation id profile canInline'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Core'
+!
+
+PPCMethod comment:''
+!
+
+!PPCMethod methodsFor:'as yet unclassified'!
+
+add: string
+	self nl.
+	indentation timesRepeat: [ buffer nextPutAll: '  ' ].
+	self addOnLine: string.
+!
+
+addOnLine: string
+	buffer nextPutAll: string.
+!
+
+addVariable: name
+	variables add: name.
+!
+
+allowInline
+	canInline := true
+!
+
+body
+	^ buffer contents
+!
+
+bridge
+	^ PPCBridge on: self methodName.
+!
+
+call
+	^ 'self ', self methodName, '.'.
+!
+
+code
+	^ self methodName, String cr,  
+		self variables, String cr,
+		self profilingBegin, String cr,
+		self body, String cr
+"		self profilingEnd"
+!
+
+dedent
+	indentation := indentation - 1
+!
+
+id: value
+	id := value
+!
+
+indent 
+	indentation := indentation + 1
+!
+
+isMethod
+	^ true
+!
+
+methodName
+	^ id
+!
+
+nl
+	^ buffer nextPut: Character cr
+!
+
+profile
+	^ profile
+!
+
+profile: aBoolean
+	profile := aBoolean 
+!
+
+profilingBegin
+	self profile ifTrue: [ 
+ 		^ '  context methodInvoked: #', id, '.'	
+	].
+	^ ''
+!
+
+profilingEnd
+	self profile ifTrue: [ 
+ 		^ '  context methodFinished: #', id, '.'	
+	].
+	^ ''
+!
+
+variables
+	^ '  | ', (variables inject: '' into: [ :s :e | s, ' ', e]), ' |'
+! !
+
+!PPCMethod methodsFor:'initialization'!
+
+initialize
+	buffer := WriteStream on: ''.
+	indentation := 1.
+	variables := OrderedCollection new.
+	canInline := false
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCMethodStrategy.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,46 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+Object subclass:#PPCMethodStrategy
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCMethodStrategy class instanceVariableNames:'Instance'
+
+"
+ No other class instance variables are inherited by this class.
+"
+!
+
+PPCMethodStrategy comment:''
+!
+
+!PPCMethodStrategy class methodsFor:'as yet unclassified'!
+
+instance
+	^ Instance ifNil: [ 
+		Instance := self basicNew initialize.
+	]
+!
+
+new
+	^ self instance
+! !
+
+!PPCMethodStrategy methodsFor:'as yet unclassified'!
+
+return: compiler
+	compiler add: '^'.
+!
+
+start: compiler id: id
+	self halt: 'deprecated?'.
+	^ compiler startMethod: id
+!
+
+stop: compiler
+ ^ compiler stopMethod
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCNegateNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,22 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCDelegateNode subclass:#PPCNegateNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCNegateNode comment:''
+!
+
+!PPCNegateNode methodsFor:'as yet unclassified'!
+
+compileWith: compiler effect: effect id: id
+	"TODO"
+!
+
+prefix
+	^ #negate
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCNilNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,36 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCNode subclass:#PPCNilNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCNilNode comment:''
+!
+
+!PPCNilNode methodsFor:'as yet unclassified'!
+
+acceptsEpsilon
+	^ true
+!
+
+asInlined
+	^ PPCInlineNilNode new
+!
+
+compileWith: compiler effect: effect id: id
+	compiler startMethod: id.
+	compiler add: '^ nil.'.
+ ^ compiler stopMethod.
+!
+
+firstCharParser
+	^ PPFailingParser new
+!
+
+prefix
+	^ #nil
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,326 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+Object subclass:#PPCNode
+	instanceVariableNames:'contextFree name'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCNode comment:''
+!
+
+!PPCNode methodsFor:'accessing'!
+
+children
+	^ #()
+!
+
+name: anObject
+	
+	name := anObject
+!
+
+prefix
+	self subclassResponsibility 
+!
+
+suffix
+	^ ''
+! !
+
+!PPCNode methodsFor:'analysis'!
+
+acceptsEpsilon
+	"return true, if parser can accept epsilon without failure"
+	^ self subclassResponsibility
+!
+
+acceptsEpsilonOpenSet: set
+	"private helper for acceptsEmpsilon that makes sure to avoid cycles (using open set)"
+	self children isEmpty ifTrue: [ ^ self acceptsEpsilon ].
+	
+	self shouldBeImplemented .
+!
+
+allNodes
+	| result |
+	result := OrderedCollection new.
+	self allParsersDo: [ :parser | result add: parser ].
+	^ result
+!
+
+allNodesDo: aBlock
+	"Iterate over all the parse nodes of the receiver."
+
+	self allNodesDo: aBlock seen: IdentitySet new
+!
+
+allNodesDo: aBlock seen: aSet
+	"Iterate over all the parse nodes of the receiver, do not visit and follow the ones contained in aSet."
+
+	(aSet includes: self)
+		ifTrue: [ ^ self ].
+	aSet add: self.
+	aBlock value: self.
+	self children
+		do: [ :each | each allNodesDo: aBlock seen: aSet ]
+!
+
+check
+	"nothing to do"
+	^ nil
+!
+
+firstSetSuchThat: block
+	^ self firstSetSuchThat: block into: (OrderedCollection new) openSet: IdentitySet new.
+!
+
+firstSetSuchThat: block into: aCollection openSet: aSet
+	(aSet includes: self) ifTrue: [ ^ aCollection ].
+	aSet add: self.
+	
+	(block value: self) ifTrue: [aCollection add: self. ^ aCollection ].
+	self children do: [ :child | 
+		child firstSetSuchThat: block into: aCollection openSet: aSet 
+	].
+	^ aCollection
+!
+
+isContextFree
+	^ contextFree ifNil: [ contextFree := self allNodes allSatisfy: [ :n | n isContextFreePrim  ] ]
+!
+
+isContextFreePrim
+	^ true
+!
+
+isFirstSetTerminal
+	"Answer true if the receiver is a terminal or leaf parser, that means it does not delegate to any other parser."
+
+	^ self isTerminal
+!
+
+isNullable
+	"Answer true if the receiver is a nullable parser, e.g. it can successfully parse nothing."
+	
+	^ false
+!
+
+isTerminal
+	"Answer true if the receiver is a terminal or leaf parser, that means it does not delegate to any other parser."
+
+	^ self children isEmpty
+! !
+
+!PPCNode methodsFor:'as yet unclassified'!
+
+firstSet
+	^ self firstSetSuchThat: [ :e | e isFirstSetTerminal ]
+!
+
+name
+	^ name
+! !
+
+!PPCNode methodsFor:'comparison'!
+
+= anotherNode
+	(self == anotherNode) ifTrue: [ ^ true ].
+	(anotherNode class = self class) ifFalse: [ ^ false ].
+	
+	(anotherNode name = name) ifFalse: [ ^ false ].
+	^ anotherNode children = self children.
+! !
+
+!PPCNode methodsFor:'compiling'!
+
+compileWith: compiler
+	|  |
+	^ self compileWith: compiler effect: #none
+!
+
+compileWith: compiler effect: effect
+	| id |
+	id := (compiler idFor: self prefixed: (self prefix) suffixed: (self suffix) effect: effect).
+	(compiler checkCache: id) ifNotNil: [ ^ compiler ].
+
+	^ self compileWith: compiler effect: effect id: id.
+!
+
+compileWith: compiler effect: effect id: id
+	self subclassResponsibility 
+! !
+
+!PPCNode methodsFor:'gt'!
+
+gtTreeViewIn: composite
+	<gtInspectorPresentationOrder: 40>
+
+	composite tree
+			title: 'Tree';
+			children: [:n | n children ];
+			format: [:n| n name ifNil: [ n asString ] ifNotNil: [n name] ];
+			shouldExpandToLevel: 6
+! !
+
+!PPCNode methodsFor:'optimizing'!
+
+asFast
+	^ self
+!
+
+asInlined
+	^ self
+!
+
+checkTree
+	| message |
+	self allNodes do: [ :node | (message := node check) ifNotNil: [ self error: message ]  ].
+!
+
+defaultOptimizationParameters
+	| parameters |
+	parameters := IdentityDictionary new.
+	parameters at: #inline put: true.
+	parameters at: #rewrite put: true.
+
+	^ parameters
+!
+
+doOptimizationLoop: params status: changeStatus
+	| mapping optimized root |
+	mapping := IdentityDictionary new.
+	self allNodes do: [ :node |
+		optimized := (node optimize: params status: changeStatus).
+		(optimized ~= node) ifTrue: [  
+			mapping at: node put: optimized.
+		].
+	].
+	
+	root := mapping at: self ifAbsent: [ self ].
+	[  | changed |
+		changed := false.
+		root allNodes do: [ :node |
+			node children do: [ :child | 
+				mapping at: child ifPresent: [:newChild | 
+					node replace: child with: newChild.
+					changed := true ]
+		]].
+		changed 
+	] whileTrue.
+	^ root
+!
+
+inline: changeStatus
+	"nothing to do"
+!
+
+inline: params status: changeStatus
+	(params at: #inline) ifTrue: [ 
+		^ self inline: changeStatus
+	]
+!
+
+optimize: params status: changeStatus
+	" nothing to do "
+!
+
+optimizeTree
+	^ self optimizeTree: #()
+!
+
+optimizeTree: params
+	|  node newNode parameters status |
+	
+	parameters := self defaultOptimizationParameters.
+	
+	params do: [ :p | parameters at: p key put: p value ].
+	
+	node := self.
+	[ 
+		status := PPCOptimizationResult new.
+		newNode := node doOptimizationLoop: parameters status: status.
+		status isChange.
+	] whileTrue: [ node := newNode ].
+	^ node
+!
+
+rewrite: changeStatus
+	"nothing to do"
+!
+
+rewrite: params status: changeStatus
+	(params at: #rewrite) ifTrue: [  
+		^ self rewrite: changeStatus.
+	].
+! !
+
+!PPCNode methodsFor:'printing'!
+
+printNameOn: aStream
+	self name isNil
+		ifTrue: [ aStream print: self hash ]
+		ifFalse: [ aStream nextPutAll: self name. aStream nextPut: $-. aStream print: self hash. ]
+!
+
+printOn: aStream
+	super printOn: aStream.
+	aStream nextPut: $(.
+	self printNameOn: aStream.
+	aStream nextPut: $)
+! !
+
+!PPCNode methodsFor:'todel'!
+
+allParsersDo: aBlock
+	"Iterate over all the parse nodes of the receiver."
+
+	self allParsersDo: aBlock seen: IdentitySet new
+!
+
+allParsersDo: aBlock seen: aSet
+	"Iterate over all the parse nodes of the receiver, do not visit and follow the ones contained in aSet."
+
+	(aSet includes: self)
+		ifTrue: [ ^ self ].
+	aSet add: self.
+	aBlock value: self.
+	self children
+		do: [ :each | each allParsersDo: aBlock seen: aSet ]
+!
+
+firstSets: aFirstDictionary into: aSet
+	self children do: [ :child | aSet addAll: (aFirstDictionary at: child) ]
+! !
+
+!PPCNode methodsFor:'transformation'!
+
+asCompilerNode
+	^ self
+!
+
+replace: node with: anotherNode
+!
+
+transform: aBlock
+	"Answer a copy of all parsers reachable from the receiver transformed using aBlock."
+
+	| mapping root |
+	mapping := IdentityDictionary new.
+	self allParsersDo: [ :each |
+		mapping
+			at: each
+			put: (aBlock value: each copy) ].
+	root := mapping at: self.
+	[	| changed |
+		changed := false.
+		root allParsersDo: [ :each |
+			each children do: [ :old |
+				mapping at: old ifPresent: [ :new |
+					each replace: old with: new.
+					changed := true ] ] ].
+		changed ] whileTrue.
+	^ root
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCNotCharSetPredicateNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,38 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCAbstractPredicateNode subclass:#PPCNotCharSetPredicateNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCNotCharSetPredicateNode comment:''
+!
+
+!PPCNotCharSetPredicateNode methodsFor:'as yet unclassified'!
+
+asInlined
+	^ PPCInlineNotCharSetPredicateNode new
+		predicate: predicate;
+		name: name;
+		yourself
+!
+
+bodyOfPredicate: compiler
+	| classificationId  classification |
+	classification := self extendClassification: predicate classification.
+	classificationId := (compiler idFor: classification prefixed: #classification).
+	compiler  addConstant: classification as: classificationId.
+	
+	compiler addOnLine: '(', classificationId, ' at: context peek asInteger)'.
+	compiler indent.
+	compiler add: ' ifTrue: [ self error: '' predicate not expected'' ]'.
+	compiler add: ' ifFalse: [ nil ].'.
+	compiler dedent.
+!
+
+firstCharParser
+	^ (PPPredicateObjectParser on: predicate message: 'predicate not expected') not.
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCNotLiteralNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,55 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCAbstractLiteralNode subclass:#PPCNotLiteralNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCNotLiteralNode comment:''
+!
+
+!PPCNotLiteralNode methodsFor:'accessing'!
+
+asInlined
+	^ PPCInlineNotLiteralNode new
+		name: name;
+		literal: literal;
+		yourself
+!
+
+firstCharParser
+	^ literal first asParser
+!
+
+literal
+	
+	^ literal
+!
+
+literal: anObject
+	
+	literal := anObject
+!
+
+prefix
+	^ #notLit
+! !
+
+!PPCNotLiteralNode methodsFor:'as yet unclassified'!
+
+compileWith: compiler effect: effect id: id
+	| encodedLiteral size |
+	encodedLiteral := self encodeQuotes: literal.
+	size := literal size asString.
+	
+	compiler startMethod: id.
+	compiler add: '((context peek: ', size, ') =#''', encodedLiteral, ''')'.
+	compiler indent.
+	compiler add: ' ifTrue: [ self error: ''', encodedLiteral, ' not expected'' ]'.
+	compiler add: ' ifFalse: [ nil ].'.
+	compiler dedent.
+ ^ compiler stopMethod.
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCNotMessagePredicateNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,46 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCAbstractPredicateNode subclass:#PPCNotMessagePredicateNode
+	instanceVariableNames:'message'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCNotMessagePredicateNode comment:''
+!
+
+!PPCNotMessagePredicateNode methodsFor:'accessing'!
+
+asInlined
+	^ PPCInlineNotMessagePredicateNode new
+		predicate: predicate;
+		message: message;
+		name: name;
+		yourself
+!
+
+firstCharParser
+	^ (PPPredicateObjectParser on: predicate message: 'predicate not expected') not.
+!
+
+message
+	
+	^ message
+!
+
+message: anObject
+	
+	message := anObject
+! !
+
+!PPCNotMessagePredicateNode methodsFor:'as yet unclassified'!
+
+bodyOfPredicate: compiler
+	compiler addOnLine: '(context peek ', message, ')'.
+	compiler indent.
+	compiler add: ' ifTrue: [ self error: '' predicate not expected'' ]'.
+	compiler add: ' ifFalse: [ nil ].'.
+	compiler dedent.
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCNotNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,76 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCDelegateNode subclass:#PPCNotNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCNotNode comment:''
+!
+
+!PPCNotNode methodsFor:'accessing'!
+
+prefix
+	^ #not
+! !
+
+!PPCNotNode methodsFor:'analysis'!
+
+isFirstSetTerminal
+	^ false
+! !
+
+!PPCNotNode methodsFor:'compiling'!
+
+compileWith: compiler effect: effect id: id
+
+	compiler startMethod: id.
+	compiler addVariable: 'memento'.
+	compiler add: (compiler smartRemember: child).
+	
+	compiler startTokenMode.
+	compiler call: (child compileWith: compiler).
+	compiler stopTokenMode.
+	compiler add: (compiler smartRestore: child).
+
+	compiler add: '^ error ifFalse: [ self error ] ifTrue: [ self clearError. nil ]'.
+ ^ compiler stopMethod.
+! !
+
+!PPCNotNode methodsFor:'optimizing'!
+
+optimize: params 
+	(self rewrite: params) ifTrue: [ 
+		^ true.
+	].
+	^ super optimize: params.
+!
+
+rewrite: changeStatus
+	(child isKindOf: PPCAbstractLiteralNode) ifTrue: [  
+		changeStatus change.
+		^ PPCNotLiteralNode new
+			name: self name;
+			literal: self child literal;
+			yourself
+	]. 
+
+	(child isKindOf: PPCMessagePredicateNode) ifTrue: [  
+		changeStatus change.
+		^ PPCNotMessagePredicateNode new
+			name: self name;
+			message: child message;
+			yourself
+	].
+
+	(child isKindOf: PPCCharSetPredicateNode) ifTrue: [  
+		changeStatus change.
+		^ PPCNotCharSetPredicateNode new
+			name: self name;
+			predicate: child predicate;
+			yourself
+	] 
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCOptimizationResult.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,37 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+Object subclass:#PPCOptimizationResult
+	instanceVariableNames:'change'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCOptimizationResult comment:''
+!
+
+!PPCOptimizationResult class methodsFor:'as yet unclassified'!
+
+nothing
+	^ PPCOptimizationResult new
+		change: false;
+		yourself
+! !
+
+!PPCOptimizationResult methodsFor:'accessing'!
+
+change
+	Halt ifShiftPressed.
+	change := true.
+!
+
+isChange
+	^ change
+! !
+
+!PPCOptimizationResult methodsFor:'initialization'!
+
+initialize
+	change := false
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCOptionalNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,36 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCDelegateNode subclass:#PPCOptionalNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCOptionalNode comment:''
+!
+
+!PPCOptionalNode methodsFor:'as yet unclassified'!
+
+acceptsEpsilon
+	^ true
+!
+
+acceptsEpsilonOpenSet: set
+	^ true
+!
+
+compileWith: compiler effect: effect id: id
+	compiler startMethod: id.
+	compiler addVariable: 'retval'.
+
+	compiler add: 'retval := '.
+	compiler callOnLine: (child compileWith: compiler ).
+	compiler add: '^ error ifFalse: [ retval ] ifTrue: [ self clearError. nil ]'.
+ ^ compiler stopMethod.
+!
+
+prefix
+	^ #opt
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCPluggableNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,59 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCNode subclass:#PPCPluggableNode
+	instanceVariableNames:'block'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCPluggableNode comment:''
+!
+
+!PPCPluggableNode methodsFor:'accessing'!
+
+block
+	
+	^ block
+!
+
+block: anObject
+	
+	block := anObject
+! !
+
+!PPCPluggableNode methodsFor:'as yet unclassified'!
+
+acceptsEpsilon
+	^ true
+!
+
+acceptsEpsilonOpenSet: set
+	^ true
+!
+
+asInlined
+	^ PPCInlinePluggableNode new
+		name: name;
+		block: block;
+		yourself
+!
+
+compileWith: compiler effect: effect id: id
+	| blockId |
+	blockId := compiler idFor: block prefixed: #block.
+	
+	compiler startMethod: id.
+	compiler addConstant: block as: blockId.
+	compiler add: '^ ', blockId, ' value: context.'.
+ ^ compiler stopMethod.
+!
+
+firstCharParser
+	^  block asParser
+!
+
+prefix
+	^ #plug
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCPlusNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,44 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCDelegateNode subclass:#PPCPlusNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCPlusNode comment:''
+!
+
+!PPCPlusNode methodsFor:'as yet unclassified'!
+
+compileWith: compiler effect: effect id: id
+		
+	compiler startMethod: id.
+	compiler addVariable: 'retval'.
+	compiler addVariable: 'element'.
+		
+	compiler add: 'retval := OrderedCollection new.'.
+	compiler add: 'element := '.
+	compiler callOnLine: (child compileWith: compiler).
+	compiler add: 'error ifTrue: [ ^ self error: ''at least one occurence expected'' ].'.
+	compiler add: 'retval add: element.'.
+	
+	compiler add: 'element := '.
+	compiler callOnLine: (child compileWith: compiler).
+	compiler add: '[ error ] whileFalse: ['.
+	compiler indent.
+	compiler add: 'retval add: element.'.
+	compiler add: 'element := '.
+	compiler callOnLine: (child compileWith: compiler).
+	compiler dedent.
+	compiler add: '].'.
+	compiler add: 'self clearError.'.
+	compiler add: '^ retval asArray'.
+ ^ compiler stopMethod.
+!
+
+prefix
+	^ #plus
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCPredicateNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,85 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCAbstractPredicateNode subclass:#PPCPredicateNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCPredicateNode comment:''
+!
+
+!PPCPredicateNode methodsFor:'as yet unclassified'!
+
+bodyOfPredicate: compiler
+	| id |
+	id := (compiler idFor: predicate prefixed: #predicate).
+	compiler addConstant: predicate as: id.
+
+	compiler addOnLine: '(context atEnd not and: [ ', id , ' value: context uncheckedPeek])'.
+	compiler indent.
+	compiler add: 'ifFalse: [ self error: ''predicate not found'' ]'.
+	compiler add: 'ifTrue: [ context next ].'.
+	compiler dedent.	
+!
+
+rewrite: changeStatus
+	| charSet |
+	
+	(predicate class == PPCharSetPredicate) ifTrue: [ 
+		charSet := predicate.
+	].
+	charSet := PPCharSetPredicate on: predicate.
+	
+	(charSet equals: (PPCharSetPredicate on: [ :char | char isLetter])) ifTrue: [ 
+		changeStatus change.
+		^ PPCMessagePredicateNode new
+			name: name;
+			message: #isLetter;
+			predicate: predicate;
+			yourself
+	].
+
+	(charSet equals: (PPCharSetPredicate on: [ :char | char isDigit])) ifTrue: [ 
+		changeStatus change.
+		^ PPCMessagePredicateNode new
+			name: name;
+			message: #isDigit;
+			predicate: predicate;
+			yourself
+	].
+
+	(charSet equals: (PPCharSetPredicate on: [ :char | char isAlphaNumeric])) ifTrue: [ 
+		changeStatus change.
+		^ PPCMessagePredicateNode new
+			name: name;
+			message: #isAlphaNumeric;
+			predicate: predicate;
+			yourself
+	].
+
+	(charSet equals: (PPCharSetPredicate on: [ :char | char isSeparator])) ifTrue: [ 
+		changeStatus change.
+		^ PPCMessagePredicateNode new
+			name: name;
+			message: #isSeparator;
+			predicate: predicate;
+			yourself
+	].
+
+
+	(charSet equals: (PPCharSetPredicate on: [ :char | true ])) ifTrue: [ 
+		changeStatus change.
+		^ PPCAnyNode new
+			name: name;
+			yourself
+	].
+
+	changeStatus change.
+	^ PPCCharSetPredicateNode new
+		name: name;
+		predicate: charSet;
+		yourself.
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCProfilingContext.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,142 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCContext subclass:#PPCProfilingContext
+	instanceVariableNames:'invocations remembers restores lwRemembers lwRestores totalSize'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Context'
+!
+
+PPCProfilingContext comment:''
+!
+
+!PPCProfilingContext methodsFor:'gt'!
+
+gtReport: composite
+	<gtInspectorPresentationOrder: 40>
+	composite table 
+		title: 'Report';
+		column: 'Info' evaluated: [ :each | each key printString ];
+		column: 'Value' evaluated: [ :each | each value printString ];
+		display: [:context | context asReportTable ].
+! !
+
+!PPCProfilingContext methodsFor:'initialization'!
+
+initialize
+	super initialize.
+	self reset
+!
+
+reset
+	invocations := OrderedCollection new.
+	remembers := OrderedCollection new.
+	restores := OrderedCollection new.
+	
+	lwRemembers := OrderedCollection new.
+	lwRestores := OrderedCollection new.
+	
+	totalSize := 0.
+! !
+
+!PPCProfilingContext methodsFor:'profiling'!
+
+invocations
+	^ invocations 
+!
+
+lwRemember
+	| selector |
+	selector := thisContext sender selector.
+	lwRemembers add: selector.
+
+	^ super lwRemember
+!
+
+lwRestore: whatever
+	| selector |
+	selector := thisContext sender selector.
+	lwRestores add: selector.
+
+	^ super lwRestore: whatever.
+!
+
+methodFinished: selector
+	"Nothing to do for now"
+!
+
+methodInvoked: selector
+	invocations add: selector
+!
+
+remember
+	| sender selector |
+
+	sender := thisContext sender.
+	(sender receiver isKindOf: PPCompiledParser) ifTrue: [ 
+ 		selector := sender selector.
+	] ifFalse: [ 
+ 		selector := sender receiver class.	
+	].
+	remembers add: selector.
+	^ super remember
+!
+
+restore: whatever
+	| selector sender |
+	
+	sender := thisContext sender.
+	(sender receiver isKindOf: PPCompiledParser) ifTrue: [ 
+ 		selector := sender selector.
+	] ifFalse: [ 
+ 		selector := sender receiver class.	
+	].
+	
+	
+	restores add: selector.
+	
+	^ super restore: whatever
+!
+
+stream: aStream
+	totalSize := totalSize + aStream size.
+	^ super stream: aStream
+! !
+
+!PPCProfilingContext methodsFor:'reporting'!
+
+asReportTable
+	^{ 
+		#'invocations per character (NOT PRECISE YET)' -> (self invocationCount / (totalSize + 1.0)).
+		#'lwBacktrack per character' -> (self lwRestoreCount / (totalSize + 1.0)).
+		#'backtrack per character' -> (self restoreCount / (totalSize + 1.0)).
+		#'total stream size' -> totalSize .
+		#'invocation count' -> self invocationCount.
+		#'lwRemember count' -> self lwRememberCount.
+		#'lwRestore count' -> self lwRestoreCount.
+		#'remember count' -> self rememberCount.
+		#'restore count' -> self restoreCount.
+	
+	}
+!
+
+invocationCount
+	^ invocations size
+!
+
+lwRememberCount
+	^ lwRemembers size
+!
+
+lwRestoreCount
+	^ lwRestores size
+!
+
+rememberCount
+	^ remembers size
+!
+
+restoreCount
+	^ restores size
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCSequenceNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,99 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCListNode subclass:#PPCSequenceNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCSequenceNode comment:''
+!
+
+!PPCSequenceNode methodsFor:'accessing'!
+
+prefix
+	^ #seq
+! !
+
+!PPCSequenceNode methodsFor:'analysis'!
+
+acceptsEpsilon
+	^ self acceptsEpsilonOpenSet: IdentitySet new.
+!
+
+acceptsEpsilonOpenSet: set
+	set add: self.
+	^ self children allSatisfy: [:e | e acceptsEpsilonOpenSet: set ]
+!
+
+firstSetSuchThat: block into: aCollection openSet: aSet
+	(aSet includes: self) ifTrue: [ ^ aCollection ].
+	aSet add: self.
+	
+	(block value: self) ifTrue: [ aCollection add: self. ^ aCollection ].
+	
+	self children do: [ :child | 
+		child firstSetSuchThat: block into: aCollection openSet: aSet.
+		child acceptsEpsilon ifFalse: [ ^ aCollection ]
+	].
+	^ aCollection
+! !
+
+!PPCSequenceNode methodsFor:'compiling'!
+
+addGuard: compiler id: id
+	|  guard firsts |
+	(compiler guards not or: [(guard := PPCGuard on: self) makesSense not]) ifTrue: [ ^ self].
+
+	firsts := (self firstSetSuchThat: [ :e | (e isKindOf: PPCTrimmingTokenNode) or: [ e isTerminal ] ]).
+
+	
+	(firsts allSatisfy: [ :e | e isKindOf: PPCTrimmingTokenNode ]) ifTrue: [  
+		"If we start with trimming, we should invoke the whitespace parser"
+		firsts anyOne compileWhitespace: compiler.
+		
+		compiler add: 'context atEnd ifTrue: [ ^ self error ].'.
+		guard id: id, '_guard'.
+		guard compileGuard: compiler.
+		compiler addOnLine: 'ifFalse: [ ^ self error ].'
+	].
+
+	(firsts allSatisfy: [ :e | e isTerminal ]) ifTrue: [  
+		compiler add: 'context atEnd ifTrue: [ ^ self error ].'.
+		guard id: id, '_guard'.
+		guard compileGuard: compiler.
+		compiler addOnLine: 'ifFalse: [ ^ self error ].'
+	].
+!
+
+compileWith: compiler effect: effect id: id
+	compiler startMethod: id.
+	compiler addVariable: 'retval'.
+	compiler addVariable: 'element'.
+	compiler addVariable: 'memento'.			
+	compiler add: (compiler smartRemember: self).
+	compiler add: 'retval := Array new: ', children size asString, '.'.
+	self addGuard: compiler id: id.
+
+	(1 to: children size) do: [ :idx  | |child|
+		child := children at: idx.
+		compiler add: 'element := '.
+		compiler callOnLine: (child compileWith: compiler).
+	
+		compiler add: 'error ifTrue: [ ', (compiler smartRestore: self) ,' ^ failure ].'.
+		compiler add: 'retval at: ', idx asString, ' put: element.'.
+	].
+	compiler add: '^ retval'.
+ ^ compiler stopMethod.
+! !
+
+!PPCSequenceNode methodsFor:'optimizing'!
+
+asFast
+	^ PPCTokenSequenceNode new
+		children: children;
+		name: self name;
+		yourself
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCStarAnyNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,36 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCNode subclass:#PPCStarAnyNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCStarAnyNode comment:''
+!
+
+!PPCStarAnyNode methodsFor:'as yet unclassified'!
+
+acceptsEpsilon
+	^ true
+!
+
+acceptsEpsilonOpenSet: set
+	^ true
+!
+
+compileWith: compiler effect: effect id: id
+	compiler startMethod: id.
+	compiler addVariable: 'retval size'.
+	compiler add: 'size := context size - context position.'.
+	compiler add: 'retval := Array new: size.'.
+	compiler add: '(1 to: size) do: [ :e | retval at: e put: context next ].'.
+	compiler add: '^ retval'.
+ ^ compiler stopMethod.
+!
+
+prefix
+	^ #starAny
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCStarCharSetPredicateNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,59 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCNode subclass:#PPCStarCharSetPredicateNode
+	instanceVariableNames:'predicate'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCStarCharSetPredicateNode comment:''
+!
+
+!PPCStarCharSetPredicateNode methodsFor:'accessing'!
+
+acceptsEpsilon
+	^ true
+!
+
+compileWith: compiler effect: effect id: id
+	| classification classificationId |
+	
+	compiler startMethod: id.
+	classification := self extendClassification: predicate classification.
+	classificationId := compiler idFor: classification prefixed: #classification.
+	compiler addConstant: classification as: classificationId.
+	
+	compiler addVariable: 'retval'.
+	compiler add: 'retval := OrderedCollection new.'.	
+	compiler add: '[ ', classificationId, ' at: context peek asInteger ] whileTrue: ['.
+	compiler indent.
+	compiler add: ' retval add: context next.'.
+	compiler dedent.
+	compiler add: '].'.
+   compiler add: '^ retval asArray'.
+ ^ compiler stopMethod.
+!
+
+extendClassification: classification
+	^ (classification asOrderedCollection addLast: false; yourself) asArray
+!
+
+firstCharParser
+	^ PPPredicateObjectParser on: predicate message: 'predicate expected'.
+!
+
+predicate
+	
+	^ predicate
+!
+
+predicate: anObject
+	
+	predicate := anObject
+!
+
+prefix
+	^ #starPredicate
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCStarMessagePredicateNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,73 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCNode subclass:#PPCStarMessagePredicateNode
+	instanceVariableNames:'message'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCStarMessagePredicateNode comment:''
+!
+
+!PPCStarMessagePredicateNode methodsFor:'accessing'!
+
+acceptsEpsilon
+	^ true
+!
+
+message
+	
+	^ message
+!
+
+message: anObject
+	
+	message := anObject
+!
+
+prefix
+	^ #starPredicate
+! !
+
+!PPCStarMessagePredicateNode methodsFor:'as yet unclassified'!
+
+compileWith: compiler effect: effect id: id
+	compiler startMethod: id.
+	compiler addVariable: 'retval'.
+	compiler add: 'retval := OrderedCollection new.'.	
+	compiler add: '[ context peek ', message, ' ] whileTrue: ['.
+	compiler indent.
+	compiler add: ' retval add: context next'.
+	compiler dedent.
+	compiler add: '].'.
+	compiler add: '^ retval asArray'.
+ ^ compiler stopMethod.
+!
+
+compileWith_old: compiler effect: effect id: id
+	compiler startMethod: id.
+	compiler addVariable: 'retval'.
+	compiler add: 'retval := OrderedCollection new.'.	
+	compiler add: '[ context atEnd ] whileFalse: ['.
+	compiler indent.
+	compiler add: '(context uncheckedPeek ', message,')'.
+	compiler indent.
+	compiler add: ' ifFalse: [ ^ retval asArray ].'.
+	compiler dedent.
+	compiler add: ' retval add: context next'.
+	compiler dedent.
+	compiler add: '].'.
+	compiler add: '^ retval asArray'.
+ ^ compiler stopMethod.
+! !
+
+!PPCStarMessagePredicateNode methodsFor:'optimizing'!
+
+asFast
+	^ PPCTokenStarMessagePredicateNode new
+		name: name;
+		message: message;
+		yourself
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCStarNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,73 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCDelegateNode subclass:#PPCStarNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCStarNode comment:''
+!
+
+!PPCStarNode methodsFor:'accessing'!
+
+acceptsEpsilon
+	^ true
+!
+
+acceptsEpsilonOpenSet: set
+	^ true
+!
+
+prefix
+	^ #star
+!
+
+rewrite: changeStatus
+	(child isKindOf: PPCMessagePredicateNode) ifTrue: [ 
+		changeStatus change.
+		^ PPCStarMessagePredicateNode new
+			name: name;
+			message: child message;
+			yourself
+	]. 
+
+	(child isKindOf: PPCAnyNode) ifTrue: [ 
+		changeStatus change.
+		^ PPCStarAnyNode new
+			name: name;
+			yourself
+	]. 
+
+	(child isKindOf: PPCCharSetPredicateNode) ifTrue: [ 
+		changeStatus change.
+		^ PPCStarCharSetPredicateNode new
+			name: name;
+			predicate: child predicate;
+			yourself
+	] 
+! !
+
+!PPCStarNode methodsFor:'as yet unclassified'!
+
+compileWith: compiler effect: effect id: id
+	compiler startMethod: id.
+	compiler addVariable: 'retval'.
+	compiler addVariable: 'element'.
+
+	compiler add: 'retval := OrderedCollection new.'.
+	compiler add: 'element := '.
+	compiler callOnLine: (child compileWith: compiler).
+	compiler add: '[ error ] whileFalse: ['.
+	compiler indent.
+	compiler add: 'retval add: element.'.
+	compiler add: 'element := '.
+	compiler callOnLine: (child compileWith: compiler).
+	compiler dedent.
+	compiler add: '].'.
+	compiler add: 'self clearError.'.
+	compiler add: '^ retval asArray'.
+ ^ compiler stopMethod.
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCSymbolActionNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,24 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCAbstractActionNode subclass:#PPCSymbolActionNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCSymbolActionNode comment:''
+!
+
+!PPCSymbolActionNode methodsFor:'as yet unclassified'!
+
+compileWith: compiler effect: effect id: id
+	compiler startMethod: id.
+	compiler addVariable: 'element'.	
+	compiler add: 'element := '.
+	compiler callOnLine: (child compileWith: compiler).
+	compiler add: 'error ifFalse: [ ^ element ', block asString, ' ].'.
+	compiler add: '^ failure'.
+ ^ compiler stopMethod.
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCTokenNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,75 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCDelegateNode subclass:#PPCTokenNode
+	instanceVariableNames:'tokenClass'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCTokenNode comment:''
+!
+
+!PPCTokenNode methodsFor:'accessing'!
+
+initialize
+    super initialize.
+
+    "Modified: / 26-10-2014 / 01:34:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+rewrite: changeStatus
+	|  |
+	super rewrite: changeStatus.
+	
+	(self allNodes anySatisfy: [ :node | node asFast ~= node ]) ifTrue: [  
+		changeStatus change.
+		self replace: child with: (child transform: [:node | node asFast]).
+	]
+!
+
+tokenClass
+	
+	^ tokenClass
+!
+
+tokenClass: anObject
+	
+	tokenClass := anObject
+! !
+
+!PPCTokenNode methodsFor:'as yet unclassified'!
+
+compileWith: compiler effect: effect id: id
+	|    |
+
+	compiler startMethod: id.
+	compiler startTokenMode.
+	compiler addVariable: 'start'.
+	compiler addVariable: 'end'.
+	
+"
+	(compiler guards and: [ (guardSet := compiler guardCharSet: self) isNil not ]) ifTrue: [ 	
+		guardSetId := (compiler idFor: guardSet prefixed: #guard).
+		compiler addConstant: guardSet as: guardSetId.
+		compiler add: 'context atEnd ifTrue: [ ^ self error ].'.
+		compiler add: '(', guardSetId, ' value: context peek) ifFalse: [ ^ self error ].'.
+	].
+"
+	compiler add: 'start := context position + 1.'.
+	compiler call: (self child compileWith: compiler).
+	compiler add: 'error ifTrue: [ ^ self ].'.	
+	compiler add: 'end := context position.'.
+	
+	compiler add: '^ ', tokenClass asString, ' on: (context collection) 
+																start: start  
+																stop: end
+																value: nil'.
+	compiler stopTokenMode.
+ ^ compiler stopMethod.	
+!
+
+prefix
+	^ #token
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCTokenSequenceNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,41 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCSequenceNode subclass:#PPCTokenSequenceNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCTokenSequenceNode comment:''
+!
+
+!PPCTokenSequenceNode methodsFor:'as yet unclassified'!
+
+asFast
+	^ self
+!
+
+compileWith: compiler effect: effect id: id
+
+	compiler startMethod: id.
+	compiler addVariable: 'memento'.			
+	compiler add: (compiler smartRemember: self).
+
+"	self addGuard: compiler."
+
+	compiler call: ((children at: 1) compileWith: compiler).
+	compiler add: 'error ifTrue: [ ^ failure ].'.
+
+	(2 to: children size) do: [ :idx  | |child|
+		child := children at: idx.
+		compiler call: (child compileWith: compiler).
+		compiler add: 'error ifTrue: [ ', (compiler smartRestore: self) ,' ^ failure ].'.
+	].
+ ^ compiler stopMethod.
+!
+
+suffix
+	^ #'_fast'
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCTokenStarMessagePredicateNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,29 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCStarMessagePredicateNode subclass:#PPCTokenStarMessagePredicateNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCTokenStarMessagePredicateNode comment:''
+!
+
+!PPCTokenStarMessagePredicateNode methodsFor:'as yet unclassified'!
+
+asFast
+	^ self
+!
+
+compileWith: compiler effect: effect id: id
+	compiler startMethod: id.
+	compiler add: '[ context peek ', message,' ] whileTrue: ['.
+	compiler indent.
+	compiler add: 'context next'.
+	compiler indent.
+	compiler dedent.
+	compiler add: '].'.
+ ^ compiler stopMethod.
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCTrimNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,45 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCDelegateNode subclass:#PPCTrimNode
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCTrimNode comment:''
+!
+
+!PPCTrimNode methodsFor:'accessing'!
+
+prefix
+	^ #trim
+! !
+
+!PPCTrimNode methodsFor:'compiling'!
+
+compileWith: compiler effect: effect id: id
+	"TODO: This ignores the TrimmingParser trimmer object!!"
+	compiler startMethod: id.
+	compiler addVariable: 'result'.	
+
+	compiler add: '[context atEnd not and: [ context uncheckedPeek isSeparator ]] whileTrue: ['.
+	compiler indent.
+	compiler add: 'context next'.
+	compiler dedent.
+	compiler add: '].'.
+
+	compiler add: 'result := '.
+	compiler callOnLine: (child compileWith: compiler).
+
+	compiler add: '[context atEnd not and: [ context uncheckedPeek isSeparator ]] whileTrue: ['.
+	compiler indent.
+	compiler add: 'context next'.
+	compiler dedent.
+	compiler add: '].'.
+
+	compiler add: '^ result'.
+	compiler stopMethod.
+ ^ compiler lastMethod
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCTrimmingTokenNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,132 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCListNode subclass:#PPCTrimmingTokenNode
+	instanceVariableNames:'tokenClass'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCTrimmingTokenNode comment:''
+!
+
+!PPCTrimmingTokenNode methodsFor:'accessing'!
+
+child
+	
+	^ children at: 2
+!
+
+child: anObject
+	
+	children at: 2 put: anObject
+!
+
+compileWhitespace: compiler
+	compiler add: 'context atWs ifFalse: ['.
+	compiler indent.
+		compiler call: (self whitespace compileWith: compiler).
+		compiler add: 'context setWs.'.
+	compiler dedent.
+	compiler add: '].'.
+!
+
+initialize
+	super initialize.
+	children := Array new: 2
+!
+
+rewrite: changeStatus
+	|  |
+	super rewrite: changeStatus.
+	
+	(self allNodes anySatisfy: [ :node | node asFast ~= node ]) ifTrue: [  
+		changeStatus change.
+		self replace: self whitespace with: (self whitespace transform: [ :node | node asFast ]).
+		self replace: self child with: (self child transform: [:node | node asFast]).
+	]
+!
+
+tokenClass
+	
+	^ tokenClass
+!
+
+tokenClass: anObject
+	
+	tokenClass := anObject
+!
+
+whitespace
+	
+	^ children at: 1
+!
+
+whitespace: anObject
+	(anObject name isNil and: [ self child name isNotNil ]) ifTrue: [ 
+		anObject name: self child name, '_water'.
+	].
+	children at: 1 put: anObject
+! !
+
+!PPCTrimmingTokenNode methodsFor:'analyzing'!
+
+acceptsEpsilon
+	^ self child acceptsEpsilonOpenSet: (IdentitySet with: self).
+!
+
+acceptsEpsilonOpenSet: set
+	(set includes: self child) ifFalse: [ 
+		set add: self child.
+		^ self child acceptsEpsilonOpenSet: set 
+	].
+	^ false
+!
+
+firstSetSuchThat: block into: aCollection openSet: aSet
+	(aSet includes: self) ifTrue: [ ^ aCollection ].
+	aSet add: self.
+	
+	(block value: self) ifTrue: [ aCollection add: self. ^ aCollection ].
+	
+	^ self child firstSetSuchThat: block into: aCollection openSet: aSet.
+! !
+
+!PPCTrimmingTokenNode methodsFor:'as yet unclassified'!
+
+compileWith: compiler effect: effect id: id
+	|  guardSetId guardSet |
+
+	compiler startMethod: id.
+	compiler startTokenMode.
+	compiler addVariable: 'start'.
+	compiler addVariable: 'end'.
+	
+	self compileWhitespace: compiler.
+
+	(compiler guards and: [ (guardSet := compiler guardCharSet: self) isNil not ]) ifTrue: [ 	
+		guardSetId := id, '_guard'.
+		compiler addConstant: guardSet as: guardSetId.
+		compiler add: 'context atEnd ifTrue: [ ^ self error ].'.
+		compiler add: '(', guardSetId, ' value: context peek) ifFalse: [ ^ self error ].'.
+	].
+
+	compiler add: 'start := context position + 1.'.
+	compiler call: (self child compileWith: compiler).
+	compiler add: 'error ifTrue: [ ^ self ].'.	
+	compiler add: 'end := context position.'.
+	
+	self compileWhitespace: compiler.
+
+	compiler add: '^ ', tokenClass asString, ' on: (context collection) 
+																start: start  
+																stop: end
+																value: nil'.
+	compiler stopTokenMode.
+ ^ compiler stopMethod.	
+!
+
+prefix
+	^ #token
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCUnknownNode.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,80 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPCNode subclass:#PPCUnknownNode
+	instanceVariableNames:'parser'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Nodes'
+!
+
+PPCUnknownNode comment:''
+!
+
+!PPCUnknownNode methodsFor:'accessing'!
+
+acceptsEpsilon
+	^ parser acceptsEpsilon
+!
+
+acceptsEpsilonOpenSet: aSet
+	^ parser acceptsEpsilonOpenSet: aSet
+!
+
+children
+	^ parser children
+!
+
+firstCharParser
+	^ parser firstCharParser
+!
+
+isContextFreePrim
+	^ parser isContextFreePrim
+!
+
+parser
+	
+	^ parser
+!
+
+parser: anObject
+	
+	parser := anObject
+!
+
+prefix
+	^ #parser
+! !
+
+!PPCUnknownNode methodsFor:'compiling'!
+
+compileWith: compiler effect: effect id: id
+	| compiledChild compiledParser |
+	compiler startMethod: id.
+	
+	compiledParser := parser copy.
+	"Compile all the children and call compiled version of them instead of the original one"
+	compiledParser children do: [ :child | 
+		compiledChild := child compileWith: compiler.
+		compiledParser replace: child with: compiledChild bridge.
+	].
+	
+	compiler addConstant: compiledParser as: id. 
+	
+	compiler addVariable: 'retval'.
+	compiler add: 'self clearError.'.
+	compiler add: '(retval := ', id, ' parseOn: context) isPetitFailure'.
+	compiler indent.
+	compiler add: ' ifTrue: [self error: retval message at: retval position ].'.
+	compiler dedent.
+	compiler add: 'error := retval isPetitFailure.'.
+	compiler add: '^ retval'.
+ ^ compiler stopMethod.
+! !
+
+!PPCUnknownNode methodsFor:'transformation'!
+
+replace: node with: anotherNode
+	parser replace: node with: anotherNode
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCompiledParser.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,144 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+PPParser subclass:#PPCompiledParser
+	instanceVariableNames:'startSymbol context failure error'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Core'
+!
+
+PPCompiledParser class instanceVariableNames:'parsers constants referringParser'
+
+"
+ No other class instance variables are inherited by this class.
+"
+!
+
+PPCompiledParser comment:''
+!
+
+!PPCompiledParser class methodsFor:'as yet unclassified'!
+
+addConstant: value as: id
+	self constants at: id ifPresent: [ 
+		((self constants at: id) = value) ifFalse: [self error: 'ooups']].	
+	
+	self constants at: id put: value.
+!
+
+addParser: aPPParser as: id
+	
+	"(self parsers includesKey: id) ifTrue: [self error: 'Ooups' ]."
+	self parsers at: id put: aPPParser.
+!
+
+constants
+	constants ifNil: [ constants := IdentityDictionary new ].
+	^ constants
+!
+
+parse: input
+	^ self new parse: input
+!
+
+parsers
+	parsers ifNil: [ parsers := IdentityDictionary new ].
+	^ parsers
+!
+
+referringParser
+	^ referringParser 
+!
+
+referringParser: aPPParser
+	referringParser := aPPParser
+! !
+
+!PPCompiledParser methodsFor:'as yet unclassified'!
+
+callParser: id
+	| retval |
+	retval := (self class parsers at: id) parseOn: context.
+	retval isPetitFailure 	ifTrue: [ self error: retval message at: retval position ]
+									ifFalse: [ self clearError ].
+	^ retval
+!
+
+clearError
+	error := false.
+!
+
+error
+	^ self error: '' at: context position
+!
+
+error: message
+	^ self error: message at: context position
+!
+
+error: aMessage at: position
+	failure position < position ifTrue: [
+		failure message: aMessage.
+		failure position: position
+	].
+	error := true.
+	^ failure
+!
+
+initialize
+	super initialize.
+	
+	self class constants keysAndValuesDo: [ :key :value |
+		self instVarNamed: key put: value.
+	].
+
+	startSymbol := #start.
+
+	
+
+!
+
+isCompiled
+	^ true
+!
+
+isError
+	^ error
+!
+
+parse: input rule: symbol
+	startSymbol := symbol.
+	^ self parse: input.
+!
+
+start
+	^ self subclassResponsibility
+!
+
+startSymbol: aSymbol
+	startSymbol := aSymbol
+!
+
+updateContext: aPPContext
+	self class referringParser allParsersDo: [ :p | p updateContext: aPPContext ].
+! !
+
+!PPCompiledParser methodsFor:'parsing'!
+
+parseOn: aPPContext
+	| retval |
+"	context := aPPContext asCompiledParserContext."
+	context := aPPContext.
+	context compiledParser: self.
+	failure := PPFailure new message: nil; context: context; position: -1.
+	context noteFailure: failure.
+	error := false.
+
+	retval := self perform: startSymbol.
+	(retval isPetitFailure) ifTrue: [ aPPContext noteFailure: failure ].
+	error ifTrue: [ aPPContext noteFailure: failure. retval := failure ].
+	
+"	aPPContext position: context position."
+	^ retval
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PetitBenchmark.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,306 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+Object subclass:#PetitBenchmark
+	instanceVariableNames:'sources report contextClass compile'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Benchmarks'
+!
+
+PetitBenchmark comment:''
+!
+
+!PetitBenchmark methodsFor:'benchmark support'!
+
+createContext
+	^ contextClass new
+!
+
+endSuite
+!
+
+initialize
+	super initialize.
+	sources := PetitBenchmarkSources new.
+	contextClass := PPCContext.
+	compile := false.
+!
+
+measure: parser on: input
+	self measure: parser on: input name: #unknown
+!
+
+measure: parser on: input name: aString
+	| time result context p |
+	context := self createContext.
+	
+	compile 	ifTrue: [ 
+					p := (parser end compile: #TmpBenchmark) 
+				] ifFalse: [ 
+					p := parser end. 
+				].
+
+	
+	time := Time millisecondsToRun: [ result := p parse: input withContext: context ].
+
+	self assert: result isPetitFailure not.
+	self reportFor: parser context: context input: input time: time name: aString.
+!
+
+measure: parser onSources: inputs name: aString
+	| time result context p totalInput |
+	
+	compile 	ifTrue: [ 
+					p := (parser end compile: #TmpBenchmark) 
+				] ifFalse: [ 
+					p := parser end. 
+				].
+			
+	totalInput := ''.
+	time := 0.
+	inputs do: [:input | 
+		context := self createContext.
+		time := time + (Time millisecondsToRun: [ result := p parse: input withContext: context ]).
+		totalInput := totalInput, input.
+		self assert: result isPetitFailure not.
+	].
+	
+	
+	self reportFor: parser context: context input: totalInput time: time name: aString.
+!
+
+reportFor: parser context: context input: input time: time
+	self reportFor: parser context: context input: input time: time name: #unknown
+!
+
+reportFor: parser context: context input: input time: time name: name
+	Transcript crShow: (self getMetaInfo: name).
+	Transcript crShow: '	Compile: ', compile asString.	
+	
+	Transcript crShow: '	Total time: ', time asString, ' ms'.
+		
+	Transcript crShow: '	Time per character: ', 
+	(((time / input size) asFloat * 1000) asString truncateTo: 6), 
+	' microseconds'.
+	
+	Transcript crShow: '	Backtrack per character: ',
+	((context backtrackCount / input size) asFloat asString truncateTo: 6),
+	'.'.
+	
+	Transcript crShow: '	Remembers per character: ',
+	((context rememberCount / input size) asFloat asString truncateTo: 6),
+	'.'.
+!
+
+startSuite
+	Transcript crShow: Date current asString, ' ', Time current asString.
+! !
+
+!PetitBenchmark methodsFor:'benchmarks'!
+
+benchmarkAnyStar
+"
+	self measure: self anyStar on: sources petitParserPackage.
+"	
+	self measure: self anyStar on: (self changesSized: 1000*1000) name: #anyStar.
+!
+
+benchmarkAttributes
+	| string text allStyles |
+	string := (self changesSized: 60000).
+	text := string asText.
+	allStyles := {
+		'Announcement' -> TextColor green. 
+		'Collections' -> TextColor blue.
+		'File' -> TextColor blue.
+ 		'Metacello' -> TextColor red.
+		'Monticello' -> TextColor magenta.
+		'Morphic' -> TextColor orange.
+		'Mooose' -> TextColor green.
+		'FAMIX' -> TextColor green.
+		'Roassal' -> TextColor green.
+	}.
+	
+	allStyles do: [ :assoc | | parser result time |
+		parser := (assoc key asParser, #newline asParser negate star).
+		time := Time millisecondsToRun: [
+			result := parser matchingRangesIn: string.
+		].
+		self reportFor: parser input: string time: time.
+	].
+!
+
+benchmarkBacktrack
+"
+	self measure: self anyStar on: sources petitParserPackage.
+"	
+	| parser |
+	parser := ((#any asParser, 'foo' asParser) / self tokenParser / #any asParser) plus.
+	self measure: parser on: (self changesSized: 100*1000) name: #backtrack.
+!
+
+benchmarkJava
+	| parser |
+	parser := PPJavaParser new.
+	self measure: parser on: sources javaLangMath name: #java.
+!
+
+benchmarkNegate
+"
+	self measure: self anyStar on: sources petitParserPackage.
+"	
+	| parser |
+	parser := ('a' asParser negate star, 'a' asParser) star, #any asParser star.
+	self measure: parser on: (self changesSized: 1000*1000) name: #negate.
+!
+
+benchmarkOpalCompiler
+	| parser time input |
+	parser := OpalCompiler new.
+	input := sources smalltalkSourcesBig.
+	time := [ input do: [ :source | parser parse: source ]] timeToRun asMilliseconds.
+	
+	self reportInput: input time: time name: 'Opal'
+!
+
+benchmarkSmalltalkGrammar
+	| parser time input context |
+	parser := PPSmalltalkGrammar new.
+	context := PPContext new.
+	context initializeFor: parser.
+	input := sources smalltalkSourcesBig.
+
+	time := [ input do: [ :source | parser parse: source withContext: context ]] timeToRun asMilliSeconds.
+	
+	self reportInput: input time: time name: 'Smalltalk Grammar'.
+!
+
+benchmarkSmalltalkGrammarCompiled
+	| parser time input context  |
+	parser := PPSmalltalkGrammar new compile.
+	context := PPCContext new.
+	context initializeFor: parser.
+	input := sources smalltalkSourcesBig.
+
+	time := [ input do: [ :source | parser parse: source withContext: context ]] timeToRun asMilliSeconds.
+	
+	self reportInput: input time: time name: 'Compiled Grammar'.
+
+"	
+	size := input inject: 0 into: [:r :e | r + e size  ].
+	Transcript crShow: 'Compiled Grammar time: ', time asString.
+	Transcript crShow: 'Time per character: ', (time / size * 1000.0) asString, ' microseconds'.
+"
+!
+
+benchmarkSmalltalkObject
+	| parser |
+	parser := PPSmalltalkGrammar new.
+	self measure: parser onSources: sources smalltalkObjectMethods name: #smalltalkObject.
+!
+
+benchmarkSmalltalkParser
+	| parser time input context |
+	parser := PPSmalltalkParser new.
+	context := PPContext new.
+	context initializeFor: parser.
+	input := sources smalltalkSourcesBig.
+
+	time := [ input do: [ :source | parser parse: source withContext: context ]] timeToRun asMilliSeconds.
+	
+	self reportInput: input time: time name: 'Smalltalk Parser'.
+!
+
+benchmarkSmalltalkParserCompiled
+	| parser time input context |
+	parser := PPSmalltalkParser new compile.
+	context := PPCContext new.
+	context initializeFor: parser.
+	input := sources smalltalkSourcesBig.
+
+	time := [ input do: [ :source | parser parse: source withContext: context ]] timeToRun asMilliSeconds.
+	
+		self reportInput: input time: time name: 'Smalltalk Parser Compiled'.
+!
+
+benchmarkToken
+"
+	self measure: self anyStar on: sources petitParserPackage.
+"	
+	| parser |
+	parser := (self tokenParser / #any asParser) star.
+	self measure: parser on: (self changesSized: 1000*1000) name: #token.
+!
+
+reportInput: input time: time name: name
+	| size |
+	size := input inject: 0 into: [:r :e | r + e size  ].
+	Transcript crShow: 'Size: ', size asString.
+	Transcript crShow: name, ' time: ', time asString.
+	Transcript crShow: 'Time per character: ', (time / size * 1000.0) asString, ' microseconds'.
+! !
+
+!PetitBenchmark methodsFor:'meta'!
+
+getMetaInfo: key
+	| info |
+	info := self metaInfo select: [ :each | each key = key ].
+	info isEmpty ifTrue: [ ^ 'unknown benchmark' ].
+	^ info anyOne value
+!
+
+metaInfo
+	^ { 
+		#anyStar -> '.* Parser'.
+		#token -> 'Token Parser'.
+		#backtrack -> 'Backtracking Parser'.
+		#negate -> 'Negate Parser'.
+		#java -> 'Standard Java Parser'.
+		#smalltalkObject -> 'All Smalltalk Object methods'
+	}
+! !
+
+!PetitBenchmark methodsFor:'parsers'!
+
+anyStar
+	^ #any asParser star
+!
+
+tokenParser
+	^ #letter asParser, (#letter asParser / #digit asParser) star trim
+! !
+
+!PetitBenchmark methodsFor:'settings'!
+
+compile: aBoolean
+	compile := aBoolean
+!
+
+contextClass: aClass
+	contextClass := aClass
+! !
+
+!PetitBenchmark methodsFor:'sources'!
+
+changesSized: size
+	| string changes |
+	changes := PharoFilesOpener default changesFileOrNil contents.
+	string :=  changes copyFrom: 1 to: size.
+	^ string
+	
+! !
+
+!PetitBenchmark methodsFor:'suites'!
+
+suite1
+	self startSuite.
+	
+	self benchmarkNegate.
+	self benchmarkBacktrack.
+	self benchmarkToken.
+	self benchmarkAnyStar.
+	self benchmarkJava.
+	
+	self endSuite.
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PetitBenchmarkSources.st	Sun Oct 26 01:03:31 2014 +0000
@@ -0,0 +1,5170 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+Object subclass:#PetitBenchmarkSources
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Benchmarks'
+!
+
+PetitBenchmarkSources comment:''
+!
+
+!PetitBenchmarkSources methodsFor:'as yet unclassified'!
+
+javaLangClass
+!
+
+javaLangMath
+	^ '/*
+ * @(#)Math.java	1.69 04/06/14
+ *
+ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ */
+
+package java.lang;
+import java.util.Random;
+
+
+/**
+ * The class <code>Math</code> contains methods for performing basic
+ * numeric operations such as the elementary exponential, logarithm,
+ * square root, and trigonometric functions.
+ * 
+ * <p>Unlike some of the numeric methods of class
+ * <code>StrictMath</code>, all implementations of the equivalent
+ * functions of class <code>Math</code> are not defined to return the
+ * bit-for-bit same results.  This relaxation permits
+ * better-performing implementations where strict reproducibility is
+ * not required.
+ * 
+ * <p>By default many of the <code>Math</code> methods simply call
+ * the equivalent method in <code>StrictMath</code> for their
+ * implementation.  Code generators are encouraged to use
+ * platform-specific native libraries or microprocessor instructions,
+ * where available, to provide higher-performance implementations of
+ * <code>Math</code> methods.  Such higher-performance
+ * implementations still must conform to the specification for
+ * <code>Math</code>.
+ * 
+ * <p>The quality of implementation specifications concern two
+ * properties, accuracy of the returned result and monotonicity of the
+ * method.  Accuracy of the floating-point <code>Math</code> methods
+ * is measured in terms of <i>ulps</i>, units in the last place.  For
+ * a given floating-point format, an ulp of a specific real number
+ * value is the distance between the two floating-point values
+ * bracketing that numerical value.  When discussing the accuracy of a
+ * method as a whole rather than at a specific argument, the number of
+ * ulps cited is for the worst-case error at any argument.  If a
+ * method always has an error less than 0.5 ulps, the method always
+ * returns the floating-point number nearest the exact result; such a
+ * method is <i>correctly rounded</i>.  A correctly rounded method is
+ * generally the best a floating-point approximation can be; however,
+ * it is impractical for many floating-point methods to be correctly
+ * rounded.  Instead, for the <code>Math</code> class, a larger error
+ * bound of 1 or 2 ulps is allowed for certain methods.  Informally,
+ * with a 1 ulp error bound, when the exact result is a representable
+ * number, the exact result should be returned as the computed result;
+ * otherwise, either of the two floating-point values which bracket
+ * the exact result may be returned.  For exact results large in
+ * magnitude, one of the endpoints of the bracket may be infinite.
+ * Besides accuracy at individual arguments, maintaining proper
+ * relations between the method at different arguments is also
+ * important.  Therefore, most methods with more than 0.5 ulp errors
+ * are required to be <i>semi-monotonic</i>: whenever the mathematical
+ * function is non-decreasing, so is the floating-point approximation,
+ * likewise, whenever the mathematical function is non-increasing, so
+ * is the floating-point approximation.  Not all approximations that
+ * have 1 ulp accuracy will automatically meet the monotonicity
+ * requirements.
+ * 
+ * @author  unascribed
+ * @author  Joseph D. Darcy
+ * @version 1.69, 06/14/04
+ * @since   JDK1.0
+ */
+
+public final class Math {
+
+    /**
+     * Don''t let anyone instantiate this class.
+     */
+    private Math() {}
+
+    /**
+     * The <code>double</code> value that is closer than any other to
+     * <i>e</i>, the base of the natural logarithms.
+     */
+    public static final double E = 2.7182818284590452354;
+
+    /**
+     * The <code>double</code> value that is closer than any other to
+     * <i>pi</i>, the ratio of the circumference of a circle to its
+     * diameter.
+     */
+    public static final double PI = 3.14159265358979323846;
+
+    /**
+     * Returns the trigonometric sine of an angle.  Special cases:
+     * <ul><li>If the argument is NaN or an infinity, then the 
+     * result is NaN.
+     * <li>If the argument is zero, then the result is a zero with the
+     * same sign as the argument.</ul>
+     * 
+     * <p>The computed result must be within 1 ulp of the exact result.
+     * Results must be semi-monotonic.
+     *
+     * @param   a   an angle, in radians.
+     * @return  the sine of the argument.
+     */
+    public static double sin(double a) {
+	return StrictMath.sin(a); // default impl. delegates to StrictMath
+    }
+    
+    /**
+     * Returns the trigonometric cosine of an angle. Special cases:
+     * <ul><li>If the argument is NaN or an infinity, then the 
+     * result is NaN.</ul>
+     * 
+     * <p>The computed result must be within 1 ulp of the exact result.
+     * Results must be semi-monotonic.
+     *
+     * @param   a   an angle, in radians.
+     * @return  the cosine of the argument.
+     */
+    public static double cos(double a) {
+	return StrictMath.cos(a); // default impl. delegates to StrictMath
+    }
+   
+    /**
+     * Returns the trigonometric tangent of an angle.  Special cases:
+     * <ul><li>If the argument is NaN or an infinity, then the result 
+     * is NaN.
+     * <li>If the argument is zero, then the result is a zero with the
+     * same sign as the argument.</ul>
+     * 
+     * <p>The computed result must be within 1 ulp of the exact result.
+     * Results must be semi-monotonic.
+     *
+     * @param   a   an angle, in radians.
+     * @return  the tangent of the argument.
+     */
+    public static double tan(double a) {
+	return StrictMath.tan(a); // default impl. delegates to StrictMath
+    }
+
+    /**
+     * Returns the arc sine of an angle, in the range of -<i>pi</i>/2 through
+     * <i>pi</i>/2. Special cases: 
+     * <ul><li>If the argument is NaN or its absolute value is greater 
+     * than 1, then the result is NaN.
+     * <li>If the argument is zero, then the result is a zero with the
+     * same sign as the argument.</ul>
+     * 
+     * <p>The computed result must be within 1 ulp of the exact result.
+     * Results must be semi-monotonic.
+     *
+     * @param   a   the value whose arc sine is to be returned.
+     * @return  the arc sine of the argument.
+     */
+    public static double asin(double a) {
+	return StrictMath.asin(a); // default impl. delegates to StrictMath
+    }
+
+    /**
+     * Returns the arc cosine of an angle, in the range of 0.0 through
+     * <i>pi</i>.  Special case:
+     * <ul><li>If the argument is NaN or its absolute value is greater 
+     * than 1, then the result is NaN.</ul>
+     * 
+     * <p>The computed result must be within 1 ulp of the exact result.
+     * Results must be semi-monotonic.
+     *
+     * @param   a   the value whose arc cosine is to be returned.
+     * @return  the arc cosine of the argument.
+     */
+    public static double acos(double a) {
+	return StrictMath.acos(a); // default impl. delegates to StrictMath
+    }
+
+    /**
+     * Returns the arc tangent of an angle, in the range of -<i>pi</i>/2
+     * through <i>pi</i>/2.  Special cases: 
+     * <ul><li>If the argument is NaN, then the result is NaN.
+     * <li>If the argument is zero, then the result is a zero with the
+     * same sign as the argument.</ul>
+     * 
+     * <p>The computed result must be within 1 ulp of the exact result.
+     * Results must be semi-monotonic.
+     *
+     * @param   a   the value whose arc tangent is to be returned.
+     * @return  the arc tangent of the argument.
+     */
+    public static double atan(double a) {
+	return StrictMath.atan(a); // default impl. delegates to StrictMath
+    }
+
+    /**
+     * Converts an angle measured in degrees to an approximately
+     * equivalent angle measured in radians.  The conversion from
+     * degrees to radians is generally inexact.
+     *
+     * @param   angdeg   an angle, in degrees
+     * @return  the measurement of the angle <code>angdeg</code>
+     *          in radians.
+     * @since   1.2
+     */
+    public static double toRadians(double angdeg) {
+	return angdeg / 180.0 * PI;
+    }
+
+    /**
+     * Converts an angle measured in radians to an approximately
+     * equivalent angle measured in degrees.  The conversion from
+     * radians to degrees is generally inexact; users should
+     * <i>not</i> expect <code>cos(toRadians(90.0))</code> to exactly
+     * equal <code>0.0</code>.
+     *
+     * @param   angrad   an angle, in radians
+     * @return  the measurement of the angle <code>angrad</code>
+     *          in degrees.
+     * @since   1.2
+     */
+    public static double toDegrees(double angrad) {
+	return angrad * 180.0 / PI;
+    }
+
+    /**
+     * Returns Euler''s number <i>e</i> raised to the power of a
+     * <code>double</code> value.  Special cases:
+     * <ul><li>If the argument is NaN, the result is NaN.
+     * <li>If the argument is positive infinity, then the result is 
+     * positive infinity.
+     * <li>If the argument is negative infinity, then the result is 
+     * positive zero.</ul>
+     * 
+     * <p>The computed result must be within 1 ulp of the exact result.
+     * Results must be semi-monotonic.
+     *
+     * @param   a   the exponent to raise <i>e</i> to.
+     * @return  the value <i>e</i><sup><code>a</code></sup>, 
+     *          where <i>e</i> is the base of the natural logarithms.
+     */
+    public static double exp(double a) {
+	return StrictMath.exp(a); // default impl. delegates to StrictMath
+    }
+
+    /**
+     * Returns the natural logarithm (base <i>e</i>) of a <code>double</code>
+     * value.  Special cases:
+     * <ul><li>If the argument is NaN or less than zero, then the result 
+     * is NaN.
+     * <li>If the argument is positive infinity, then the result is 
+     * positive infinity.
+     * <li>If the argument is positive zero or negative zero, then the 
+     * result is negative infinity.</ul>
+     * 
+     * <p>The computed result must be within 1 ulp of the exact result.
+     * Results must be semi-monotonic.
+     *
+     * @param   a   a value
+     * @return  the value ln&nbsp;<code>a</code>, the natural logarithm of
+     *          <code>a</code>.
+     */
+    public static double log(double a) {
+	return StrictMath.log(a); // default impl. delegates to StrictMath
+    }
+
+    /**
+     * Returns the base 10 logarithm of a <code>double</code> value.
+     * Special cases:
+     *
+     * <ul><li>If the argument is NaN or less than zero, then the result 
+     * is NaN.
+     * <li>If the argument is positive infinity, then the result is 
+     * positive infinity.
+     * <li>If the argument is positive zero or negative zero, then the 
+     * result is negative infinity.
+     * <li> If the argument is equal to 10<sup><i>n</i></sup> for
+     * integer <i>n</i>, then the result is <i>n</i>.
+     * </ul>
+     * 
+     * <p>The computed result must be within 1 ulp of the exact result.
+     * Results must be semi-monotonic.
+     *
+     * @param   a   a value
+     * @return  the base 10 logarithm of  <code>a</code>.
+     * @since 1.5
+     */
+    public static double log10(double a) {
+	return StrictMath.log10(a); // default impl. delegates to StrictMath
+    }
+
+    /**
+     * Returns the correctly rounded positive square root of a 
+     * <code>double</code> value.
+     * Special cases:
+     * <ul><li>If the argument is NaN or less than zero, then the result 
+     * is NaN. 
+     * <li>If the argument is positive infinity, then the result is positive 
+     * infinity. 
+     * <li>If the argument is positive zero or negative zero, then the 
+     * result is the same as the argument.</ul>
+     * Otherwise, the result is the <code>double</code> value closest to 
+     * the true mathematical square root of the argument value.
+     * 
+     * @param   a   a value.
+     * @return  the positive square root of <code>a</code>.
+     *          If the argument is NaN or less than zero, the result is NaN.
+     */
+    public static double sqrt(double a) {
+	return StrictMath.sqrt(a); // default impl. delegates to StrictMath
+				   // Note that hardware sqrt instructions
+				   // frequently can be directly used by JITs
+				   // and should be much faster than doing
+				   // Math.sqrt in software.
+    }
+
+
+    /**
+     * Returns the cube root of a <code>double</code> value.  For
+     * positive finite <code>x</code>, <code>cbrt(-x) ==
+     * -cbrt(x)</code>; that is, the cube root of a negative value is
+     * the negative of the cube root of that value''s magnitude.
+     * 
+     * Special cases: 
+     *
+     * <ul>
+     * 
+     * <li>If the argument is NaN, then the result is NaN.
+     *
+     * <li>If the argument is infinite, then the result is an infinity
+     * with the same sign as the argument.
+     *
+     * <li>If the argument is zero, then the result is a zero with the
+     * same sign as the argument.
+     * 
+     * </ul>
+     *
+     * <p>The computed result must be within 1 ulp of the exact result.
+     * 
+     * @param   a   a value.
+     * @return  the cube root of <code>a</code>.
+     * @since 1.5
+     */
+    public static double cbrt(double a) {
+	return StrictMath.cbrt(a);
+    }
+
+    /**
+     * Computes the remainder operation on two arguments as prescribed 
+     * by the IEEE 754 standard.
+     * The remainder value is mathematically equal to 
+     * <code>f1&nbsp;-&nbsp;f2</code>&nbsp;&times;&nbsp;<i>n</i>,
+     * where <i>n</i> is the mathematical integer closest to the exact 
+     * mathematical value of the quotient <code>f1/f2</code>, and if two 
+     * mathematical integers are equally close to <code>f1/f2</code>, 
+     * then <i>n</i> is the integer that is even. If the remainder is 
+     * zero, its sign is the same as the sign of the first argument. 
+     * Special cases:
+     * <ul><li>If either argument is NaN, or the first argument is infinite, 
+     * or the second argument is positive zero or negative zero, then the 
+     * result is NaN.
+     * <li>If the first argument is finite and the second argument is 
+     * infinite, then the result is the same as the first argument.</ul>
+     *
+     * @param   f1   the dividend.
+     * @param   f2   the divisor.
+     * @return  the remainder when <code>f1</code> is divided by
+     *          <code>f2</code>.
+     */
+    public static double IEEEremainder(double f1, double f2) {
+        return StrictMath.IEEEremainder(f1, f2); // delegate to StrictMath
+    }
+
+    /**
+     * Returns the smallest (closest to negative infinity)
+     * <code>double</code> value that is greater than or equal to the
+     * argument and is equal to a mathematical integer. Special cases:
+     * <ul><li>If the argument value is already equal to a
+     * mathematical integer, then the result is the same as the
+     * argument.  <li>If the argument is NaN or an infinity or
+     * positive zero or negative zero, then the result is the same as
+     * the argument.  <li>If the argument value is less than zero but
+     * greater than -1.0, then the result is negative zero.</ul> Note
+     * that the value of <code>Math.ceil(x)</code> is exactly the
+     * value of <code>-Math.floor(-x)</code>.
+     *
+     *
+     * @param   a   a value.
+     * @return  the smallest (closest to negative infinity) 
+     *          floating-point value that is greater than or equal to 
+     *          the argument and is equal to a mathematical integer. 
+     */
+    public static double ceil(double a) {
+	return StrictMath.ceil(a); // default impl. delegates to StrictMath
+    }
+
+    /**
+     * Returns the largest (closest to positive infinity)
+     * <code>double</code> value that is less than or equal to the
+     * argument and is equal to a mathematical integer. Special cases:
+     * <ul><li>If the argument value is already equal to a
+     * mathematical integer, then the result is the same as the
+     * argument.  <li>If the argument is NaN or an infinity or
+     * positive zero or negative zero, then the result is the same as
+     * the argument.</ul>
+     *
+     * @param   a   a value.
+     * @return  the largest (closest to positive infinity) 
+     *          floating-point value that less than or equal to the argument
+     *          and is equal to a mathematical integer. 
+     */
+    public static double floor(double a) {
+	return StrictMath.floor(a); // default impl. delegates to StrictMath
+    }
+
+    /**
+     * Returns the <code>double</code> value that is closest in value
+     * to the argument and is equal to a mathematical integer. If two
+     * <code>double</code> values that are mathematical integers are
+     * equally close, the result is the integer value that is
+     * even. Special cases:
+     * <ul><li>If the argument value is already equal to a mathematical 
+     * integer, then the result is the same as the argument. 
+     * <li>If the argument is NaN or an infinity or positive zero or negative 
+     * zero, then the result is the same as the argument.</ul>
+     *
+     * @param   a   a <code>double</code> value.
+     * @return  the closest floating-point value to <code>a</code> that is
+     *          equal to a mathematical integer.
+     */
+    public static double rint(double a) {
+	return StrictMath.rint(a); // default impl. delegates to StrictMath
+    }
+
+    /**
+     * Converts rectangular coordinates (<code>x</code>,&nbsp;<code>y</code>)
+     * to polar (r,&nbsp;<i>theta</i>).
+     * This method computes the phase <i>theta</i> by computing an arc tangent
+     * of <code>y/x</code> in the range of -<i>pi</i> to <i>pi</i>. Special 
+     * cases:
+     * <ul><li>If either argument is NaN, then the result is NaN. 
+     * <li>If the first argument is positive zero and the second argument 
+     * is positive, or the first argument is positive and finite and the 
+     * second argument is positive infinity, then the result is positive 
+     * zero. 
+     * <li>If the first argument is negative zero and the second argument 
+     * is positive, or the first argument is negative and finite and the 
+     * second argument is positive infinity, then the result is negative zero. 
+     * <li>If the first argument is positive zero and the second argument 
+     * is negative, or the first argument is positive and finite and the 
+     * second argument is negative infinity, then the result is the 
+     * <code>double</code> value closest to <i>pi</i>. 
+     * <li>If the first argument is negative zero and the second argument 
+     * is negative, or the first argument is negative and finite and the 
+     * second argument is negative infinity, then the result is the 
+     * <code>double</code> value closest to -<i>pi</i>. 
+     * <li>If the first argument is positive and the second argument is 
+     * positive zero or negative zero, or the first argument is positive 
+     * infinity and the second argument is finite, then the result is the 
+     * <code>double</code> value closest to <i>pi</i>/2. 
+     * <li>If the first argument is negative and the second argument is 
+     * positive zero or negative zero, or the first argument is negative 
+     * infinity and the second argument is finite, then the result is the 
+     * <code>double</code> value closest to -<i>pi</i>/2. 
+     * <li>If both arguments are positive infinity, then the result is the 
+     * <code>double</code> value closest to <i>pi</i>/4. 
+     * <li>If the first argument is positive infinity and the second argument 
+     * is negative infinity, then the result is the <code>double</code> 
+     * value closest to 3*<i>pi</i>/4. 
+     * <li>If the first argument is negative infinity and the second argument 
+     * is positive infinity, then the result is the <code>double</code> value 
+     * closest to -<i>pi</i>/4. 
+     * <li>If both arguments are negative infinity, then the result is the 
+     * <code>double</code> value closest to -3*<i>pi</i>/4.</ul>
+     * 
+     * <p>The computed result must be within 2 ulps of the exact result.
+     * Results must be semi-monotonic.
+     *
+     * @param   y   the ordinate coordinate
+     * @param   x   the abscissa coordinate
+     * @return  the <i>theta</i> component of the point
+     *          (<i>r</i>,&nbsp;<i>theta</i>)
+     *          in polar coordinates that corresponds to the point
+     *          (<i>x</i>,&nbsp;<i>y</i>) in Cartesian coordinates.
+     */
+    public static double atan2(double y, double x) {
+	return StrictMath.atan2(y, x); // default impl. delegates to StrictMath
+    }
+
+    /**
+     * Returns the value of the first argument raised to the power of the
+     * second argument. Special cases:
+     *
+     * <ul><li>If the second argument is positive or negative zero, then the 
+     * result is 1.0. 
+     * <li>If the second argument is 1.0, then the result is the same as the 
+     * first argument.
+     * <li>If the second argument is NaN, then the result is NaN. 
+     * <li>If the first argument is NaN and the second argument is nonzero, 
+     * then the result is NaN. 
+     *
+     * <li>If
+     * <ul>
+     * <li>the absolute value of the first argument is greater than 1
+     * and the second argument is positive infinity, or
+     * <li>the absolute value of the first argument is less than 1 and
+     * the second argument is negative infinity,
+     * </ul>
+     * then the result is positive infinity. 
+     *
+     * <li>If 
+     * <ul>
+     * <li>the absolute value of the first argument is greater than 1 and 
+     * the second argument is negative infinity, or 
+     * <li>the absolute value of the 
+     * first argument is less than 1 and the second argument is positive 
+     * infinity,
+     * </ul>
+     * then the result is positive zero. 
+     *
+     * <li>If the absolute value of the first argument equals 1 and the 
+     * second argument is infinite, then the result is NaN. 
+     *
+     * <li>If 
+     * <ul>
+     * <li>the first argument is positive zero and the second argument
+     * is greater than zero, or
+     * <li>the first argument is positive infinity and the second
+     * argument is less than zero,
+     * </ul>
+     * then the result is positive zero. 
+     *
+     * <li>If 
+     * <ul>
+     * <li>the first argument is positive zero and the second argument
+     * is less than zero, or
+     * <li>the first argument is positive infinity and the second
+     * argument is greater than zero,
+     * </ul>
+     * then the result is positive infinity.
+     *
+     * <li>If 
+     * <ul>
+     * <li>the first argument is negative zero and the second argument
+     * is greater than zero but not a finite odd integer, or
+     * <li>the first argument is negative infinity and the second
+     * argument is less than zero but not a finite odd integer,
+     * </ul>
+     * then the result is positive zero. 
+     *
+     * <li>If 
+     * <ul>
+     * <li>the first argument is negative zero and the second argument
+     * is a positive finite odd integer, or
+     * <li>the first argument is negative infinity and the second
+     * argument is a negative finite odd integer,
+     * </ul>
+     * then the result is negative zero. 
+     *
+     * <li>If
+     * <ul>
+     * <li>the first argument is negative zero and the second argument
+     * is less than zero but not a finite odd integer, or
+     * <li>the first argument is negative infinity and the second
+     * argument is greater than zero but not a finite odd integer,
+     * </ul>
+     * then the result is positive infinity. 
+     *
+     * <li>If 
+     * <ul>
+     * <li>the first argument is negative zero and the second argument
+     * is a negative finite odd integer, or
+     * <li>the first argument is negative infinity and the second
+     * argument is a positive finite odd integer,
+     * </ul>
+     * then the result is negative infinity. 
+     *
+     * <li>If the first argument is finite and less than zero
+     * <ul>
+     * <li> if the second argument is a finite even integer, the
+     * result is equal to the result of raising the absolute value of
+     * the first argument to the power of the second argument
+     *
+     * <li>if the second argument is a finite odd integer, the result
+     * is equal to the negative of the result of raising the absolute
+     * value of the first argument to the power of the second
+     * argument
+     *
+     * <li>if the second argument is finite and not an integer, then
+     * the result is NaN.
+     * </ul>
+     *
+     * <li>If both arguments are integers, then the result is exactly equal 
+     * to the mathematical result of raising the first argument to the power 
+     * of the second argument if that result can in fact be represented 
+     * exactly as a <code>double</code> value.</ul>
+     * 
+     * <p>(In the foregoing descriptions, a floating-point value is
+     * considered to be an integer if and only if it is finite and a
+     * fixed point of the method {@link #ceil <tt>ceil</tt>} or,
+     * equivalently, a fixed point of the method {@link #floor
+     * <tt>floor</tt>}. A value is a fixed point of a one-argument
+     * method if and only if the result of applying the method to the
+     * value is equal to the value.)
+     *
+     * <p>The computed result must be within 1 ulp of the exact result.
+     * Results must be semi-monotonic.
+     *
+     * @param   a   the base.
+     * @param   b   the exponent.
+     * @return  the value <code>a<sup>b</sup></code>.
+     */
+    public static double pow(double a, double b) {
+	return StrictMath.pow(a, b); // default impl. delegates to StrictMath
+    }
+
+    /**
+     * Returns the closest <code>int</code> to the argument. The 
+     * result is rounded to an integer by adding 1/2, taking the 
+     * floor of the result, and casting the result to type <code>int</code>. 
+     * In other words, the result is equal to the value of the expression:
+     * <p><pre>(int)Math.floor(a + 0.5f)</pre>
+     * <p>
+     * Special cases:
+     * <ul><li>If the argument is NaN, the result is 0.
+     * <li>If the argument is negative infinity or any value less than or 
+     * equal to the value of <code>Integer.MIN_VALUE</code>, the result is 
+     * equal to the value of <code>Integer.MIN_VALUE</code>. 
+     * <li>If the argument is positive infinity or any value greater than or 
+     * equal to the value of <code>Integer.MAX_VALUE</code>, the result is 
+     * equal to the value of <code>Integer.MAX_VALUE</code>.</ul> 
+     *
+     * @param   a   a floating-point value to be rounded to an integer.
+     * @return  the value of the argument rounded to the nearest
+     *          <code>int</code> value.
+     * @see     java.lang.Integer#MAX_VALUE
+     * @see     java.lang.Integer#MIN_VALUE
+     */
+    public static int round(float a) {
+	return (int)floor(a + 0.5f);
+    }
+
+    /**
+     * Returns the closest <code>long</code> to the argument. The result 
+     * is rounded to an integer by adding 1/2, taking the floor of the 
+     * result, and casting the result to type <code>long</code>. In other 
+     * words, the result is equal to the value of the expression:
+     * <p><pre>(long)Math.floor(a + 0.5d)</pre>
+     * <p>
+     * Special cases:
+     * <ul><li>If the argument is NaN, the result is 0.
+     * <li>If the argument is negative infinity or any value less than or 
+     * equal to the value of <code>Long.MIN_VALUE</code>, the result is 
+     * equal to the value of <code>Long.MIN_VALUE</code>. 
+     * <li>If the argument is positive infinity or any value greater than or 
+     * equal to the value of <code>Long.MAX_VALUE</code>, the result is 
+     * equal to the value of <code>Long.MAX_VALUE</code>.</ul> 
+     *
+     * @param   a   a floating-point value to be rounded to a 
+     *		<code>long</code>.
+     * @return  the value of the argument rounded to the nearest
+     *          <code>long</code> value.
+     * @see     java.lang.Long#MAX_VALUE
+     * @see     java.lang.Long#MIN_VALUE
+     */
+    public static long round(double a) {
+	return (long)floor(a + 0.5d);
+    }
+
+    private static Random randomNumberGenerator;
+
+    private static synchronized void initRNG() {
+        if (randomNumberGenerator == null) 
+            randomNumberGenerator = new Random();
+    }
+
+    /**
+     * Returns a <code>double</code> value with a positive sign, greater 
+     * than or equal to <code>0.0</code> and less than <code>1.0</code>. 
+     * Returned values are chosen pseudorandomly with (approximately) 
+     * uniform distribution from that range. 
+     * 
+     * <p>When this method is first called, it creates a single new
+     * pseudorandom-number generator, exactly as if by the expression
+     * <blockquote><pre>new java.util.Random</pre></blockquote> This
+     * new pseudorandom-number generator is used thereafter for all
+     * calls to this method and is used nowhere else.
+     * 
+     * <p>This method is properly synchronized to allow correct use by
+     * more than one thread. However, if many threads need to generate
+     * pseudorandom numbers at a great rate, it may reduce contention
+     * for each thread to have its own pseudorandom-number generator.
+     *  
+     * @return  a pseudorandom <code>double</code> greater than or equal 
+     * to <code>0.0</code> and less than <code>1.0</code>.
+     * @see     java.util.Random#nextDouble()
+     */
+    public static double random() {
+        if (randomNumberGenerator == null) initRNG();
+        return randomNumberGenerator.nextDouble();
+    }
+
+    /**
+     * Returns the absolute value of an <code>int</code> value.
+     * If the argument is not negative, the argument is returned.
+     * If the argument is negative, the negation of the argument is returned. 
+     * 
+     * <p>Note that if the argument is equal to the value of
+     * <code>Integer.MIN_VALUE</code>, the most negative representable
+     * <code>int</code> value, the result is that same value, which is
+     * negative.
+     *
+     * @param   a   the argument whose absolute value is to be determined
+     * @return  the absolute value of the argument.
+     * @see     java.lang.Integer#MIN_VALUE
+     */
+    public static int abs(int a) {
+	return (a < 0) ? -a : a;
+    }
+
+    /**
+     * Returns the absolute value of a <code>long</code> value.
+     * If the argument is not negative, the argument is returned.
+     * If the argument is negative, the negation of the argument is returned. 
+     * 
+     * <p>Note that if the argument is equal to the value of
+     * <code>Long.MIN_VALUE</code>, the most negative representable
+     * <code>long</code> value, the result is that same value, which
+     * is negative.
+     *
+     * @param   a   the argument whose absolute value is to be determined
+     * @return  the absolute value of the argument.
+     * @see     java.lang.Long#MIN_VALUE
+     */
+    public static long abs(long a) {
+	return (a < 0) ? -a : a;
+    }
+
+    /**
+     * Returns the absolute value of a <code>float</code> value.
+     * If the argument is not negative, the argument is returned.
+     * If the argument is negative, the negation of the argument is returned.
+     * Special cases:
+     * <ul><li>If the argument is positive zero or negative zero, the 
+     * result is positive zero. 
+     * <li>If the argument is infinite, the result is positive infinity. 
+     * <li>If the argument is NaN, the result is NaN.</ul>
+     * In other words, the result is the same as the value of the expression: 
+     * <p><pre>Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))</pre>
+     *
+     * @param   a   the argument whose absolute value is to be determined
+     * @return  the absolute value of the argument.
+     */
+    public static float abs(float a) {
+        return (a <= 0.0F) ? 0.0F - a : a;
+    }
+  
+    /**
+     * Returns the absolute value of a <code>double</code> value.
+     * If the argument is not negative, the argument is returned.
+     * If the argument is negative, the negation of the argument is returned.
+     * Special cases:
+     * <ul><li>If the argument is positive zero or negative zero, the result 
+     * is positive zero. 
+     * <li>If the argument is infinite, the result is positive infinity. 
+     * <li>If the argument is NaN, the result is NaN.</ul>
+     * In other words, the result is the same as the value of the expression: 
+     * <p><code>Double.longBitsToDouble((Double.doubleToLongBits(a)&lt;&lt;1)&gt;&gt;&gt;1)</code> 
+     *
+     * @param   a   the argument whose absolute value is to be determined
+     * @return  the absolute value of the argument.
+     */
+    public static double abs(double a) {
+        return (a <= 0.0D) ? 0.0D - a : a;
+    }
+
+    /**
+     * Returns the greater of two <code>int</code> values. That is, the 
+     * result is the argument closer to the value of 
+     * <code>Integer.MAX_VALUE</code>. If the arguments have the same value, 
+     * the result is that same value.
+     *
+     * @param   a   an argument.
+     * @param   b   another argument.
+     * @return  the larger of <code>a</code> and <code>b</code>.
+     * @see     java.lang.Long#MAX_VALUE
+     */
+    public static int max(int a, int b) {
+	return (a >= b) ? a : b;
+    }
+
+    /**
+     * Returns the greater of two <code>long</code> values. That is, the 
+     * result is the argument closer to the value of 
+     * <code>Long.MAX_VALUE</code>. If the arguments have the same value, 
+     * the result is that same value. 
+     *
+     * @param   a   an argument.
+     * @param   b   another argument.
+     * @return  the larger of <code>a</code> and <code>b</code>.
+     * @see     java.lang.Long#MAX_VALUE
+     */
+    public static long max(long a, long b) {
+	return (a >= b) ? a : b;
+    }
+
+    private static long negativeZeroFloatBits = Float.floatToIntBits(-0.0f);
+    private static long negativeZeroDoubleBits = Double.doubleToLongBits(-0.0d);
+
+    /**
+     * Returns the greater of two <code>float</code> values.  That is,
+     * the result is the argument closer to positive infinity. If the
+     * arguments have the same value, the result is that same
+     * value. If either value is NaN, then the result is NaN.  Unlike
+     * the numerical comparison operators, this method considers
+     * negative zero to be strictly smaller than positive zero. If one
+     * argument is positive zero and the other negative zero, the
+     * result is positive zero.
+     *
+     * @param   a   an argument.
+     * @param   b   another argument.
+     * @return  the larger of <code>a</code> and <code>b</code>.
+     */
+    public static float max(float a, float b) {
+        if (a !!= a) return a;	// a is NaN
+	if ((a == 0.0f) && (b == 0.0f)
+	    && (Float.floatToIntBits(a) == negativeZeroFloatBits)) {
+	    return b;
+	}
+	return (a >= b) ? a : b;
+    }
+
+    /**
+     * Returns the greater of two <code>double</code> values.  That
+     * is, the result is the argument closer to positive infinity. If
+     * the arguments have the same value, the result is that same
+     * value. If either value is NaN, then the result is NaN.  Unlike
+     * the numerical comparison operators, this method considers
+     * negative zero to be strictly smaller than positive zero. If one
+     * argument is positive zero and the other negative zero, the
+     * result is positive zero.
+     *
+     * @param   a   an argument.
+     * @param   b   another argument.
+     * @return  the larger of <code>a</code> and <code>b</code>.
+     */
+    public static double max(double a, double b) {
+        if (a !!= a) return a;	// a is NaN
+	if ((a == 0.0d) && (b == 0.0d)
+	    && (Double.doubleToLongBits(a) == negativeZeroDoubleBits)) {
+	    return b;
+	}
+	return (a >= b) ? a : b;
+    }
+
+    /**
+     * Returns the smaller of two <code>int</code> values. That is,
+     * the result the argument closer to the value of
+     * <code>Integer.MIN_VALUE</code>.  If the arguments have the same
+     * value, the result is that same value.
+     *
+     * @param   a   an argument.
+     * @param   b   another argument.
+     * @return  the smaller of <code>a</code> and <code>b</code>.
+     * @see     java.lang.Long#MIN_VALUE
+     */
+    public static int min(int a, int b) {
+	return (a <= b) ? a : b;
+    }
+
+    /**
+     * Returns the smaller of two <code>long</code> values. That is,
+     * the result is the argument closer to the value of
+     * <code>Long.MIN_VALUE</code>. If the arguments have the same
+     * value, the result is that same value.
+     *
+     * @param   a   an argument.
+     * @param   b   another argument.
+     * @return  the smaller of <code>a</code> and <code>b</code>.
+     * @see     java.lang.Long#MIN_VALUE
+     */
+    public static long min(long a, long b) {
+	return (a <= b) ? a : b;
+    }
+
+    /**
+     * Returns the smaller of two <code>float</code> values.  That is,
+     * the result is the value closer to negative infinity. If the
+     * arguments have the same value, the result is that same
+     * value. If either value is NaN, then the result is NaN.  Unlike
+     * the numerical comparison operators, this method considers
+     * negative zero to be strictly smaller than positive zero.  If
+     * one argument is positive zero and the other is negative zero,
+     * the result is negative zero.
+     *
+     * @param   a   an argument.
+     * @param   b   another argument.
+     * @return  the smaller of <code>a</code> and <code>b.</code>
+     */
+    public static float min(float a, float b) {
+        if (a !!= a) return a;	// a is NaN
+	if ((a == 0.0f) && (b == 0.0f)
+	    && (Float.floatToIntBits(b) == negativeZeroFloatBits)) {
+	    return b;
+	}
+	return (a <= b) ? a : b;
+    }
+
+    /**
+     * Returns the smaller of two <code>double</code> values.  That
+     * is, the result is the value closer to negative infinity. If the
+     * arguments have the same value, the result is that same
+     * value. If either value is NaN, then the result is NaN.  Unlike
+     * the numerical comparison operators, this method considers
+     * negative zero to be strictly smaller than positive zero. If one
+     * argument is positive zero and the other is negative zero, the
+     * result is negative zero.
+     *
+     * @param   a   an argument.
+     * @param   b   another argument.
+     * @return  the smaller of <code>a</code> and <code>b</code>.
+     */
+    public static double min(double a, double b) {
+        if (a !!= a) return a;	// a is NaN
+	if ((a == 0.0d) && (b == 0.0d)
+	    && (Double.doubleToLongBits(b) == negativeZeroDoubleBits)) {
+	    return b;
+	}
+	return (a <= b) ? a : b;
+    }
+
+    /**
+     * Returns the size of an ulp of the argument.  An ulp of a
+     * <code>double</code> value is the positive distance between this
+     * floating-point value and the <code>double</code> value next
+     * larger in magnitude.  Note that for non-NaN <i>x</i>,
+     * <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
+     * 
+     * <p>Special Cases:
+     * <ul>
+     * <li> If the argument is NaN, then the result is NaN.
+     * <li> If the argument is positive or negative infinity, then the
+     * result is positive infinity.
+     * <li> If the argument is positive or negative zero, then the result is
+     * <code>Double.MIN_VALUE</code>.
+     * <li> If the argument is &plusmn;<code>Double.MAX_VALUE</code>, then
+     * the result is equal to 2<sup>971</sup>.
+     * </ul>
+     *
+     * @param d the floating-point value whose ulp is to be returned
+     * @return the size of an ulp of the argument
+     * @author Joseph D. Darcy
+     * @since 1.5
+     */
+    public static double ulp(double d) {
+	return sun.misc.FpUtils.ulp(d);
+    }
+
+    /**
+     * Returns the size of an ulp of the argument.  An ulp of a
+     * <code>float</code> value is the positive distance between this
+     * floating-point value and the <code>float</code> value next
+     * larger in magnitude.  Note that for non-NaN <i>x</i>,
+     * <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
+     * 
+     * <p>Special Cases:
+     * <ul>
+     * <li> If the argument is NaN, then the result is NaN.
+     * <li> If the argument is positive or negative infinity, then the
+     * result is positive infinity.
+     * <li> If the argument is positive or negative zero, then the result is
+     * <code>Float.MIN_VALUE</code>.
+     * <li> If the argument is &plusmn;<code>Float.MAX_VALUE</code>, then
+     * the result is equal to 2<sup>104</sup>.
+     * </ul>
+     *
+     * @param f the floating-point value whose ulp is to be returned
+     * @return the size of an ulp of the argument
+     * @author Joseph D. Darcy
+     * @since 1.5
+     */
+    public static float ulp(float f) {
+	return sun.misc.FpUtils.ulp(f);
+    }
+
+    /**
+     * Returns the signum function of the argument; zero if the argument
+     * is zero, 1.0 if the argument is greater than zero, -1.0 if the
+     * argument is less than zero.
+     *
+     * <p>Special Cases:
+     * <ul>
+     * <li> If the argument is NaN, then the result is NaN.
+     * <li> If the argument is positive zero or negative zero, then the
+     *      result is the same as the argument.
+     * </ul>
+     *
+     * @param d the floating-point value whose signum is to be returned
+     * @return the signum function of the argument
+     * @author Joseph D. Darcy
+     * @since 1.5
+     */
+    public static double signum(double d) {
+	return sun.misc.FpUtils.signum(d);
+    }
+
+    /**
+     * Returns the signum function of the argument; zero if the argument
+     * is zero, 1.0f if the argument is greater than zero, -1.0f if the
+     * argument is less than zero.
+     *
+     * <p>Special Cases:
+     * <ul>
+     * <li> If the argument is NaN, then the result is NaN.
+     * <li> If the argument is positive zero or negative zero, then the
+     *      result is the same as the argument.
+     * </ul>
+     *
+     * @param f the floating-point value whose signum is to be returned
+     * @return the signum function of the argument
+     * @author Joseph D. Darcy
+     * @since 1.5
+     */
+    public static float signum(float f) {
+	return sun.misc.FpUtils.signum(f);
+    }
+
+    /**
+     * Returns the hyperbolic sine of a <code>double</code> value.
+     * The hyperbolic sine of <i>x</i> is defined to be
+     * (<i>e<sup>x</sup>&nbsp;-&nbsp;e<sup>-x</sup></i>)/2
+     * where <i>e</i> is {@linkplain Math#E Euler''s number}.
+     *
+     * <p>Special cases:
+     * <ul>
+     *
+     * <li>If the argument is NaN, then the result is NaN.
+     *
+     * <li>If the argument is infinite, then the result is an infinity
+     * with the same sign as the argument.
+     *
+     * <li>If the argument is zero, then the result is a zero with the
+     * same sign as the argument.
+     *
+     * </ul>
+     *
+     * <p>The computed result must be within 2.5 ulps of the exact result.
+     *
+     * @param   x The number whose hyperbolic sine is to be returned.
+     * @return  The hyperbolic sine of <code>x</code>.
+     * @since 1.5
+     */
+    public static double sinh(double x) {
+	return StrictMath.sinh(x);
+    }
+
+    /**
+     * Returns the hyperbolic cosine of a <code>double</code> value.
+     * The hyperbolic cosine of <i>x</i> is defined to be
+     * (<i>e<sup>x</sup>&nbsp;+&nbsp;e<sup>-x</sup></i>)/2
+     * where <i>e</i> is {@linkplain Math#E Euler''s number}.
+     *
+     * <p>Special cases:
+     * <ul>
+     *
+     * <li>If the argument is NaN, then the result is NaN.
+     *
+     * <li>If the argument is infinite, then the result is positive
+     * infinity.
+     *
+     * <li>If the argument is zero, then the result is <code>1.0</code>.
+     *
+     * </ul>
+     *
+     * <p>The computed result must be within 2.5 ulps of the exact result.
+     *
+     * @param   x The number whose hyperbolic cosine is to be returned.
+     * @return  The hyperbolic cosine of <code>x</code>.
+     * @since 1.5
+     */
+    public static double cosh(double x) {
+	return StrictMath.cosh(x);
+    }
+
+    /**
+     * Returns the hyperbolic tangent of a <code>double</code> value.
+     * The hyperbolic tangent of <i>x</i> is defined to be
+     * (<i>e<sup>x</sup>&nbsp;-&nbsp;e<sup>-x</sup></i>)/(<i>e<sup>x</sup>&nbsp;+&nbsp;e<sup>-x</sup></i>),
+     * in other words, {@linkplain Math#sinh
+     * sinh(<i>x</i>)}/{@linkplain Math#cosh cosh(<i>x</i>)}.  Note
+     * that the absolute value of the exact tanh is always less than
+     * 1.
+     *
+     * <p>Special cases:
+     * <ul>
+     *
+     * <li>If the argument is NaN, then the result is NaN.
+     *
+     * <li>If the argument is zero, then the result is a zero with the
+     * same sign as the argument.
+     *
+     * <li>If the argument is positive infinity, then the result is
+     * <code>+1.0</code>.
+     *
+     * <li>If the argument is negative infinity, then the result is
+     * <code>-1.0</code>.
+     *  
+     * </ul>
+     *
+     * <p>The computed result must be within 2.5 ulps of the exact result.
+     * The result of <code>tanh</code> for any finite input must have
+     * an absolute value less than or equal to 1.  Note that once the
+     * exact result of tanh is within 1/2 of an ulp of the limit value
+     * of &plusmn;1, correctly signed &plusmn;<code>1.0</code> should
+     * be returned.
+     *
+     * @param   x The number whose hyperbolic tangent is to be returned.
+     * @return  The hyperbolic tangent of <code>x</code>.
+     * @since 1.5
+     */
+    public static double tanh(double x) {
+	return StrictMath.tanh(x);
+    }
+
+    /**
+     * Returns sqrt(<i>x</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>)
+     * without intermediate overflow or underflow.
+     *
+     * <p>Special cases:
+     * <ul>
+     *
+     * <li> If either argument is infinite, then the result
+     * is positive infinity.
+     *
+     * <li> If either argument is NaN and neither argument is infinite,
+     * then the result is NaN.
+     *
+     * </ul>
+     *
+     * <p>The computed result must be within 1 ulp of the exact
+     * result.  If one parameter is held constant, the results must be
+     * semi-monotonic in the other parameter.
+     *
+     * @param x a value
+     * @param y a value
+     * @return sqrt(<i>x</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>)
+     * without intermediate overflow or underflow
+     * @since 1.5
+     */
+    public static double hypot(double x, double y) {
+	return StrictMath.hypot(x, y);
+    }
+
+    /**
+     * Returns <i>e</i><sup>x</sup>&nbsp;-1.  Note that for values of
+     * <i>x</i> near 0, the exact sum of
+     * <code>expm1(x)</code>&nbsp;+&nbsp;1 is much closer to the true
+     * result of <i>e</i><sup>x</sup> than <code>exp(x)</code>.
+     *
+     * <p>Special cases:
+     * <ul>
+     * <li>If the argument is NaN, the result is NaN.
+     *
+     * <li>If the argument is positive infinity, then the result is
+     * positive infinity.
+     *
+     * <li>If the argument is negative infinity, then the result is
+     * -1.0.
+     *
+     * <li>If the argument is zero, then the result is a zero with the
+     * same sign as the argument.
+     *
+     * </ul>
+     *
+     * <p>The computed result must be within 1 ulp of the exact result.
+     * Results must be semi-monotonic.  The result of
+     * <code>expm1</code> for any finite input must be greater than or
+     * equal to <code>-1.0</code>.  Note that once the exact result of
+     * <i>e</i><sup><code>x</code></sup>&nbsp;-&nbsp;1 is within 1/2
+     * ulp of the limit value -1, <code>-1.0</code> should be
+     * returned.
+     *
+     * @param   x   the exponent to raise <i>e</i> to in the computation of
+     *              <i>e</i><sup><code>x</code></sup>&nbsp;-1.
+     * @return  the value <i>e</i><sup><code>x</code></sup>&nbsp;-&nbsp;1.
+     */
+    public static double expm1(double x) {
+	return StrictMath.expm1(x);
+    }
+
+    /**
+     * Returns the natural logarithm of the sum of the argument and 1.
+     * Note that for small values <code>x</code>, the result of
+     * <code>log1p(x)</code> is much closer to the true result of ln(1
+     * + <code>x</code>) than the floating-point evaluation of
+     * <code>log(1.0+x)</code>.
+     *
+     * <p>Special cases:
+     *
+     * <ul>
+     *
+     * <li>If the argument is NaN or less than -1, then the result is
+     * NaN.
+     *
+     * <li>If the argument is positive infinity, then the result is
+     * positive infinity.
+     *
+     * <li>If the argument is negative one, then the result is
+     * negative infinity.
+     *
+     * <li>If the argument is zero, then the result is a zero with the
+     * same sign as the argument.
+     *
+     * </ul>
+     *
+     * <p>The computed result must be within 1 ulp of the exact result.
+     * Results must be semi-monotonic.
+     *
+     * @param   x   a value
+     * @return the value ln(<code>x</code>&nbsp;+&nbsp;1), the natural
+     * log of <code>x</code>&nbsp;+&nbsp;1
+     */
+    public static double log1p(double x) {
+	return StrictMath.log1p(x);
+    }
+}
+'
+!
+
+petitParserPackage
+^ '
+Object subclass: #PPCharSetPredicate
+	instanceVariableNames: ''block classification''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Tools''!!
+!!PPCharSetPredicate commentStamp: ''<historical>'' prior: 0!!
+!!
+
+
+!!PPCharSetPredicate methodsFor: ''initialization'' stamp: ''lr 8/30/2010 12:19''!!
+initializeOn: aBlock
+	block := aBlock.
+	classification := Array new: 255.
+	1 to: classification size do: [ :index |
+		classification at: index put: (block
+			value: (Character value: index)) ]!! !!
+
+
+!!PPCharSetPredicate methodsFor: ''evaluating'' stamp: ''lr 8/30/2010 12:19''!!
+value: aCharacter
+	| index |
+	index := aCharacter asInteger.
+	index == 0
+		ifTrue: [ ^ block value: aCharacter ].
+	index > 255
+		ifTrue: [ ^ block value: aCharacter ].
+	^ classification at: index!! !!
+
+"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!!
+
+PPCharSetPredicate class
+	instanceVariableNames: ''''!!
+!!PPCharSetPredicate class commentStamp: ''<historical>'' prior: 0!!
+!!
+
+
+!!PPCharSetPredicate class methodsFor: ''instance creation'' stamp: ''lr 8/25/2010 11:05''!!
+on: aBlock
+	^ self basicNew initializeOn: aBlock!! !!
+
+
+PPDelegateParser subclass: #PPExpressionParser
+	instanceVariableNames: ''operators''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Tools''!!
+!!PPExpressionParser commentStamp: ''<historical>'' prior: 0!!
+A PPExpressionParser is a parser to conveniently define an expression grammar with prefix, postfix, and left- and right-associative infix operators.
+
+The following code initializes a parser for arithmetic expressions. First we instantiate an expression parser, a simple parser for expressions in parenthesis and a simple parser for integer numbers.
+
+	expression := PPExpressionParser new.
+	parens := $( asParser token trim , expression , $) asParser token trim 
+		==> [ :nodes | nodes second ].
+	integer := #digit asParser plus token trim
+		==> [ :token | token value asInteger ].
+	
+Then we define on what term the expression grammar is built on:
+
+	expression term: parens / integer.
+	
+Finally we define the operator-groups in descending precedence. Note, that the action blocks receive both, the terms and the parsed operator in the order they appear in the parsed input. 
+	
+	expression
+		group: [ :g |
+			g prefix: $- asParser token trim do: [ :op :a | a negated ] ];
+		group: [ :g |
+			g postfix: ''++'' asParser token trim do: [ :a :op | a + 1 ].
+			g postfix: ''--'' asParser token trim do: [ :a :op | a - 1 ] ];
+		group: [ :g |
+			g right: $^ asParser token trim do: [ :a :op :b | a raisedTo: b ] ];
+		group: [ :g |
+			g left: $* asParser token trim do: [ :a :op :b | a * b ].
+			g left: $/ asParser token trim do: [ :a :op :b | a / b ] ];
+		group: [ :g |
+			g left: $+ asParser token trim do: [ :a :op :b | a + b ].
+			g left: $- asParser token trim do: [ :a :op :b | a - b ] ].
+		
+After evaluating the above code the ''expression'' is an efficient parser that evaluates examples like:
+
+	expression parse: ''-8++''.
+	expression parse: ''1+2*3''.
+	expression parse: ''1*2+3''.
+	expression parse: ''(1+2)*3''.
+	expression parse: ''8/4/2''.
+	expression parse: ''8/(4/2)''.
+	expression parse: ''2^2^3''.
+	expression parse: ''(2^2)^3''.
+	
+Instance Variables:
+	operators	<Dictionary>	The operators defined in the current group.!!
+
+
+!!PPExpressionParser methodsFor: ''private'' stamp: ''FirstnameLastname 11/26/2009 20:48''!!
+build: aParser right: aChoiceParser
+	^ (aParser separatedBy: aChoiceParser) foldRight: [ :a :op :b | op first value: a value: op second value: b ]!! !!
+
+!!PPExpressionParser methodsFor: ''private'' stamp: ''FirstnameLastname 11/26/2009 20:48''!!
+build: aParser left: aChoiceParser
+	^ (aParser separatedBy: aChoiceParser) foldLeft: [ :a :op :b | op first value: a value: op second value: b ]!! !!
+
+!!PPExpressionParser methodsFor: ''private'' stamp: ''lr 12/4/2009 17:38''!!
+build: aParser postfix: aChoiceParser
+	^ aParser , aChoiceParser star map: [ :term :ops | ops inject: term into: [ :result :operator | operator first value: result value: operator second ] ]!! !!
+
+!!PPExpressionParser methodsFor: ''private'' stamp: ''FirstnameLastname 11/26/2009 21:15''!!
+buildOn: aParser
+	^ self buildSelectors inject: aParser into: [ :term :selector |
+		| list |
+		list := operators at: selector ifAbsent: [ #() ].
+		list isEmpty
+			ifTrue: [ term ]
+			ifFalse: [
+				self
+					perform: selector with: term 
+					with: (list size = 1
+						ifTrue: [ list first first ==> [ :operator | Array with: list first second with: operator ] ]
+						ifFalse: [ 
+							list
+								inject: PPChoiceParser new
+								into: [ :choice :each | choice / (each first ==> [ :operator | Array with: each second with: operator ]) ] ]) ] ]!! !!
+
+!!PPExpressionParser methodsFor: ''private'' stamp: ''lr 12/4/2009 17:39''!!
+build: aParser prefix: aChoiceParser
+	^ aChoiceParser star , aParser map: [ :ops :term | ops reversed inject: term into: [ :result :operator | operator first value: operator second value: result ] ]!! !!
+
+!!PPExpressionParser methodsFor: ''private'' stamp: ''FirstnameLastname 11/26/2009 20:48''!!
+buildSelectors
+	^ #(build:prefix: build:postfix: build:right: build:left:)!! !!
+
+!!PPExpressionParser methodsFor: ''private'' stamp: ''lr 2/7/2010 23:23''!!
+operator: aSymbol parser: aParser do: aBlock
+	parser isNil
+		ifTrue: [ ^ self error: ''You did not specify a term when creating the receiver.'' ].
+	operators isNil
+		ifTrue: [ ^ self error: ''Use #group: to define precedence groups in descending order.'' ].
+	(operators at: aSymbol ifAbsentPut: [ OrderedCollection new ])
+		addLast: (Array with: aParser asParser with: aBlock)!! !!
+
+
+!!PPExpressionParser methodsFor: ''specifying'' stamp: ''FirstnameLastname 11/26/2009 21:26''!!
+term: aParser
+	"Defines the initial term aParser of the receiver."
+	
+	parser isNil
+		ifTrue: [ parser := aParser ]
+		ifFalse: [ self error: ''Unable to redefine the term.'' ]!! !!
+
+!!PPExpressionParser methodsFor: ''specifying'' stamp: ''FirstnameLastname 11/26/2009 20:49''!!
+postfix: aParser do: aTwoArgumentBlock
+	"Define a postfix operator aParser. Evaluate aTwoArgumentBlock with the term and the operator."
+
+	self operator: #build:postfix: parser: aParser do: aTwoArgumentBlock!! !!
+
+!!PPExpressionParser methodsFor: ''specifying'' stamp: ''FirstnameLastname 11/26/2009 20:49''!!
+left: aParser do: aThreeArgumentBlock
+	"Define an operator aParser that is left-associative. Evaluate aThreeArgumentBlock with the first term, the operator, and the second term."
+	
+	self operator: #build:left: parser: aParser do: aThreeArgumentBlock!! !!
+
+!!PPExpressionParser methodsFor: ''specifying'' stamp: ''FirstnameLastname 11/26/2009 20:49''!!
+prefix: aParser do: aTwoArgumentBlock
+	"Define a prefix operator aParser. Evaluate aTwoArgumentBlock with the operator and the term."
+
+	self operator: #build:prefix: parser: aParser do: aTwoArgumentBlock!! !!
+
+!!PPExpressionParser methodsFor: ''specifying'' stamp: ''FirstnameLastname 11/26/2009 20:49''!!
+right: aParser do: aThreeArgumentBlock
+	"Define an operator aParser that is right-associative. Evaluate aThreeArgumentBlock with the first term, the operator, and the second term."
+	
+	self operator: #build:right: parser: aParser do: aThreeArgumentBlock!! !!
+
+!!PPExpressionParser methodsFor: ''specifying'' stamp: ''lr 2/7/2010 23:20''!!
+group: aOneArgumentBlock
+	"Defines a priority group by evaluating aOneArgumentBlock."
+	
+	operators := Dictionary new.
+	parser := [ 
+		aOneArgumentBlock value: self.
+	 	self buildOn: parser ]
+			ensure: [ operators := nil ]!! !!
+
+
+PPDelegateParser subclass: #PPCompositeParser
+	instanceVariableNames: ''dependencies''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Tools''!!
+!!PPCompositeParser commentStamp: ''lr 12/4/2009 18:38'' prior: 0!!
+A PPCompositeParser is composed parser built from various primitive parsers. 
+
+Every production in the receiver is specified as a method that returns its parser. Note that every production requires an instance variable of the same name, otherwise the production is not cached and cannot be used in recursive grammars. Productions should refer to each other by reading the respective inst-var. Note: these inst-vars are typically not written, as the assignment happens in the initialize method using reflection.
+
+The start production is defined in the method start. It is aliased to the inst-var parser defined in the superclass of PPCompositeParser.!!
+
+
+!!PPCompositeParser methodsFor: ''querying'' stamp: ''lr 6/4/2010 13:37''!!
+productionAt: aSymbol ifAbsent: aBlock
+	"Answer the production named aSymbol, if there is no such production answer the result of evaluating aBlock."
+	
+	(self class ignoredNames includes: aSymbol asString)
+		ifTrue: [ ^ aBlock value ].
+	(self class startSymbol = aSymbol)
+		ifTrue: [ ^ parser ].
+	^ self instVarAt: (self class allInstVarNames
+		indexOf: aSymbol asString
+		ifAbsent: [ ^ aBlock value ])!! !!
+
+!!PPCompositeParser methodsFor: ''querying'' stamp: ''lr 5/8/2011 15:45''!!
+productionNames
+	"Answer a dictionary of slot indexes and production names."
+	
+	| productionNames ignoredNames |
+	productionNames := Dictionary new.
+	ignoredNames := self class ignoredNames
+		collect: [ :each | each asSymbol ].
+	self class allInstVarNames keysAndValuesDo: [ :key :value |
+		(ignoredNames includes: value asSymbol)
+			ifFalse: [ productionNames at: key put: value asSymbol ] ].
+	^ productionNames!! !!
+
+!!PPCompositeParser methodsFor: ''querying'' stamp: ''lr 3/16/2013 21:41''!!
+dependencyAt: aClass
+	"Answer the dependent parser aClass. Throws an error if this parser class is not declared in the method #dependencies on the class-side of the receiver."
+	
+	^ dependencies at: aClass ifAbsent: [ self error: ''Undeclared dependency in '' , self class name , '' to '' , aClass name ]!! !!
+
+!!PPCompositeParser methodsFor: ''querying'' stamp: ''lr 12/4/2009 18:39''!!
+productionAt: aSymbol
+	"Answer the production named aSymbol."
+	
+	^ self productionAt: aSymbol ifAbsent: [ nil ]!! !!
+
+
+!!PPCompositeParser methodsFor: ''initialization'' stamp: ''lr 3/16/2013 17:15''!!
+initializeStartingAt: aSymbol dependencies: aDictionary
+	self initialize.
+	parser := PPDelegateParser named: aSymbol.
+	self productionNames keysAndValuesDo: [ :key :value |
+		self instVarAt: key put: (PPDelegateParser named: value) ].
+	dependencies := aDictionary!! !!
+
+
+!!PPCompositeParser methodsFor: ''accessing'' stamp: ''lr 5/16/2008 17:32''!!
+start
+	"Answer the production to start this parser with."
+	
+	self subclassResponsibility!! !!
+
+"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!!
+
+PPCompositeParser class
+	instanceVariableNames: ''''!!
+!!PPCompositeParser class commentStamp: ''<historical>'' prior: 0!!
+!!
+
+
+!!PPCompositeParser class methodsFor: ''accessing'' stamp: ''lr 1/29/2010 11:35''!!
+ignoredNames
+	"Answer a collection of instance-variables that should not be automatically initialized with productions, but that are used internal to the composite parser."
+
+	^ PPCompositeParser allInstVarNames!! !!
+
+!!PPCompositeParser class methodsFor: ''accessing'' stamp: ''lr 12/7/2009 08:20''!!
+startSymbol
+	"Answer the method that represents the default start symbol."
+
+	^ #start!! !!
+
+!!PPCompositeParser class methodsFor: ''accessing'' stamp: ''lr 3/16/2013 21:42''!!
+dependencies
+	"Answer a collection of PPCompositeParser classes that this parser directly dependends on. Override this method in subclasses to declare dependent parsers. The default implementation does not depend on other PPCompositeParser."
+
+	^ #()!! !!
+
+
+!!PPCompositeParser class methodsFor: ''*petitgui-debug'' stamp: ''JanKurs 12/19/2013 15:40''!!
+debug: anObject startingAt: aSymbol onError: aBlock
+	^ (self newStartingAt: aSymbol) debug: anObject onError: aBlock!! !!
+
+!!PPCompositeParser class methodsFor: ''*petitgui-debug'' stamp: ''JanKurs 12/19/2013 15:39''!!
+debug: anObject startingAt: aSymbol
+	^ (self newStartingAt: aSymbol) debug: anObject!! !!
+
+!!PPCompositeParser class methodsFor: ''*petitgui-debug'' stamp: ''JanKurs 12/19/2013 15:40''!!
+debug: anObject onError: aBlock
+	^ self debug: anObject startingAt: self startSymbol onError: aBlock!! !!
+
+!!PPCompositeParser class methodsFor: ''*petitgui-debug'' stamp: ''JanKurs 12/19/2013 15:39''!!
+debug: anObject
+	^ self debug: anObject startingAt: self startSymbol!! !!
+
+
+!!PPCompositeParser class methodsFor: ''instance creation'' stamp: ''lr 3/16/2013 21:21''!!
+newStartingAt: aSymbol
+	"Answer a new parser starting at aSymbol. The code makes sure to resolve all dependent parsers correctly."
+
+	| parsers remaining |
+	parsers := IdentityDictionary new.
+	remaining := OrderedCollection with: self.
+	[ remaining isEmpty ] whileFalse: [
+		| dependency |
+		dependency := remaining removeLast.
+		(parsers includesKey: dependency) ifFalse: [
+			parsers at: dependency put: dependency basicNew.
+			remaining addAll: dependency dependencies ] ].
+	parsers keysAndValuesDo: [ :class :parser |
+		| dependencies |
+		dependencies := IdentityDictionary new.
+		class dependencies 
+			do: [ :dependency | dependencies at: dependency put: (parsers at: dependency) ].
+		parser 
+			initializeStartingAt: (class == self
+				ifTrue: [ aSymbol ]
+				ifFalse: [ class startSymbol ]) 
+			dependencies: dependencies ].
+	parsers keysAndValuesDo: [ :class :parser |
+		parser setParser: (parser perform: parser children first name).
+		parser productionNames keysAndValuesDo: [ :key :value |
+			(parser instVarAt: key) setParser: (parser perform: value) ] ].
+	^ parsers at: self!! !!
+
+!!PPCompositeParser class methodsFor: ''instance creation'' stamp: ''lr 12/7/2009 08:24''!!
+new
+	"Answer a new parser starting at the default start symbol."
+
+	^ self newStartingAt: self startSymbol!! !!
+
+
+!!PPCompositeParser class methodsFor: ''parsing'' stamp: ''lr 2/7/2010 21:02''!!
+parse: anObject onError: aBlock
+	^ self parse: anObject startingAt: self startSymbol onError: aBlock!! !!
+
+!!PPCompositeParser class methodsFor: ''parsing'' stamp: ''lr 2/7/2010 21:02''!!
+parse: anObject startingAt: aSymbol onError: aBlock
+	^ (self newStartingAt: aSymbol) parse: anObject onError: aBlock!! !!
+
+!!PPCompositeParser class methodsFor: ''parsing'' stamp: ''lr 2/7/2010 20:57''!!
+parse: anObject startingAt: aSymbol
+	^ (self newStartingAt: aSymbol) parse: anObject!! !!
+
+!!PPCompositeParser class methodsFor: ''parsing'' stamp: ''lr 2/7/2010 20:57''!!
+parse: anObject
+	^ self parse: anObject startingAt: self startSymbol!! !!
+
+
+PPParser subclass: #PPUnresolvedParser
+	instanceVariableNames: ''''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Tools''!!
+!!PPUnresolvedParser commentStamp: ''lr 11/28/2009 18:50'' prior: 0!!
+This is a temporary placeholder or forward reference to a parser that has not been defined yet. If everything goes well it will eventually be replaced with the real parser instance.!!
+
+
+!!PPUnresolvedParser methodsFor: ''parsing'' stamp: ''lr 2/7/2010 20:51''!!
+parseOn: aStream
+	self error: self printString , '' need to be resolved before execution.''!! !!
+
+
+!!PPUnresolvedParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/13/2009 14:15''!!
+displayColor
+	^ Color red!! !!
+
+
+!!PPUnresolvedParser methodsFor: ''testing'' stamp: ''lr 10/27/2008 11:29''!!
+isUnresolved
+	^ true!! !!
+Object subclass: #PPParser
+	instanceVariableNames: ''properties''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPParser commentStamp: ''<historical>'' prior: 0!!
+An abstract parser for all parsers in PetitParser. Subclasses implement #parseOn: to perform the actual recursive-descent parsing. All parsers support a variety of methods to perform an actual parse, see the methods in the #parsing protocol. Parsers are combined with a series of operators that can be found in the #operations protocol.
+
+Instance Variables:
+	properties	<Dictionary>	Stores additional state in the parser object.!!
+
+
+!!PPParser methodsFor: ''*petitjava-operations'' stamp: ''sback 9/2/2010 23:01''!!
+javaToken
+	^ PPJavaTokenParser on: self!! !!
+
+
+!!PPParser methodsFor: ''*petitgui'' stamp: ''TudorGirba 12/18/2013 06:41''!!
+gtInspectorParserInspectorIn: composite
+	<gtInspectorPresentationOrder: 30>
+	composite custom: (
+		PPVerticalParserInspector new 
+			title: ''Sampler'';
+			startOn: self)!! !!
+
+!!PPParser methodsFor: ''*petitgui'' stamp: ''AlexandreBergel 12/18/2013 16:40''!!
+gtGraphViewIn: composite
+	<gtInspectorPresentationOrder: 50>
+
+	composite roassal
+		title: ''Graph''; 
+		painting: [ :view |
+			self visualizeStructureInGraphOn: view.	
+		].!! !!
+
+!!PPParser methodsFor: ''*petitgui'' stamp: ''TudorGirba 6/24/2013 23:44''!!
+gtNamedTreeViewIn: composite
+	<gtInspectorPresentationOrder: 40>
+
+	composite tree
+		title: ''Named Tree'';
+		children: [:n | n namedChildren ];
+		format: [:n| n name ifNil: [ n asString ] ];
+		shouldExpandToLevel: 3!! !!
+
+!!PPParser methodsFor: ''*petitgui'' stamp: ''TudorGirba 6/24/2013 23:44''!!
+gtTreeViewIn: composite
+	<gtInspectorPresentationOrder: 40>
+
+	composite tree
+			title: ''Tree'';
+			children: [:n | n children ];
+			format: [:n| n name ifNil: [ n asString ] ifNotNil: [n name] ];
+			shouldExpandToLevel: 6!! !!
+
+
+!!PPParser methodsFor: ''*petitgui-morphic'' stamp: ''lr 1/30/2013 19:35''!!
+morphicShapeDefault
+	^ self newRowMorph
+		addMorphBack: (self newColumnMorph
+			addMorphBack: (self newSpacerMorph);
+			addMorphBack: (LineMorph from: 0 @ 0 to: 20 @ 0 color: Color black width: 1)	
+				makeForwardArrow;
+			yourself);
+		addMorphBack: (self newRowMorph
+			borderWidth: 1;
+			layoutInset: 3;
+			color: Color white;
+			addMorphBack: (StringMorph new
+				contents: self displayName;
+				color: self displayColor;
+				yourself);
+			yourself);
+		yourself!! !!
+
+!!PPParser methodsFor: ''*petitgui-morphic'' stamp: ''lr 11/18/2009 10:56''!!
+morphicProduction
+	^ self newRowMorph
+		layoutInset: 4;
+		addMorphBack: (self newRowMorph
+			layoutInset: 4;
+			addMorphBack: (StringMorph new
+				contents: self displayName;
+				emphasis: TextEmphasis bold emphasisCode;
+				yourself);
+			yourself);
+		addMorphBack: (self morphicShapeSeen: IdentitySet new depth: 0);
+		addMorphBack: (self newColumnMorph
+			addMorphBack: (self newSpacerMorph);
+			addMorphBack: (LineMorph from: 0 @ 0 to: 20 @ 0 color: Color black width: 1)	
+				makeForwardArrow;
+			yourself);
+		yourself!! !!
+
+!!PPParser methodsFor: ''*petitgui-morphic'' stamp: ''lr 11/13/2009 13:24''!!
+morphicShapeSeen: aSet depth: anInteger
+	^ self morphicShapeDefault!! !!
+
+!!PPParser methodsFor: ''*petitgui-morphic'' stamp: ''lr 11/13/2009 13:43''!!
+morphicShapeSeen: aSet depth: anInteger do: aBlock
+	" avoid recursion "
+	(aSet includes: self)
+		ifTrue: [ ^ self morphicShapeDefault ].
+	" display nice name when possible "
+	(anInteger > 0 and: [ self name notNil ]) 
+		ifTrue: [ ^ self morphicShapeDefault ].
+	" don''t do it too deep "
+	(anInteger > 10)
+		ifTrue: [ ^ self morphicShapeDefault ].
+	aSet add: self. 
+	^ aBlock value: [ :parser |
+		parser 
+			morphicShapeSeen: aSet 
+			depth: anInteger + 1 ]!! !!
+
+
+!!PPParser methodsFor: ''*petitanalyzer-transforming'' stamp: ''lr 10/30/2010 11:54''!!
+transform: aBlock
+	"Answer a copy of all parsers reachable from the receiver transformed using aBlock."
+
+	| mapping root |
+	mapping := IdentityDictionary new.
+	self allParsersDo: [ :each |
+		mapping
+			at: each
+			put: (aBlock value: each copy) ].
+	root := mapping at: self.
+	[	| changed |
+		changed := false.
+		root allParsersDo: [ :each |
+			each children do: [ :old |
+				mapping at: old ifPresent: [ :new |
+					each replace: old with: new.
+					changed := true ] ] ].
+		changed ] whileTrue.
+	^ root!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-transforming'' stamp: ''lr 4/13/2010 09:38''!!
+replace: aParser with: anotherParser
+	"Replace the references of the receiver pointing to aParser with anotherParser."!! !!
+
+
+!!PPParser methodsFor: ''*petitanalyzer-named'' stamp: ''lr 11/23/2010 10:55''!!
+namedChildrenDo: aBlock
+	"Iterate over the named children of the receiver."
+
+	self namedChildrenDo: aBlock seen: IdentitySet new!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-named'' stamp: ''lr 11/23/2010 10:01''!!
+allNamedParsers
+	"Answer all the named parse nodes of the receiver."
+
+	| result |
+	result := OrderedCollection new.
+	self allNamedParsersDo: [ :parser | result addLast: parser ].
+	^ result!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-named'' stamp: ''lr 11/23/2010 10:55''!!
+namedChildrenDo: aBlock seen: aSet
+	"Iterate over the named children of the receiver."
+	
+	self children do: [ :each |
+		(aSet includes: each)
+			ifTrue: [ ^ self ].
+		aSet add: each.
+		each name isNil
+			ifTrue: [ each namedChildrenDo: aBlock seen: aSet ]
+			ifFalse: [ aBlock value: each ] ]!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-named'' stamp: ''lr 12/3/2010 16:45''!!
+innerChildren
+	"Answer the inner children of the receiver."
+
+	| result |
+	result := OrderedCollection new.
+	self innerChildrenDo: [ :parser | result addLast: parser ].
+	^ result!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-named'' stamp: ''lr 12/3/2010 16:51''!!
+innerChildrenDo: aBlock seen: aSet
+	"Iterate over the inner children of the receiver."
+	
+	self children do: [ :each |
+		(aSet includes: each)
+			ifTrue: [ ^ self ].
+		aSet add: each.
+		each name isNil ifTrue: [
+			aBlock value: each.
+			each innerChildrenDo: aBlock seen: aSet ] ]!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-named'' stamp: ''lr 12/3/2010 16:48''!!
+innerChildrenDo: aBlock
+	"Iterate over the inner children of the receiver."
+
+	self innerChildrenDo: aBlock seen: IdentitySet new!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-named'' stamp: ''lr 11/23/2010 10:12''!!
+allNamedParsersDo: aBlock
+	"Iterate over all the named parse nodes of the receiver."
+
+	self allParsersDo: [ :each | 
+		each name notNil
+			ifTrue: [ aBlock value: each ] ]!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-named'' stamp: ''lr 11/23/2010 10:55''!!
+namedChildren
+	"Answer the named children of the receiver."
+
+	| result |
+	result := OrderedCollection new.
+	self namedChildrenDo: [ :parser | result addLast: parser ].
+	^ result!! !!
+
+
+!!PPParser methodsFor: ''operators-mapping'' stamp: ''lr 7/11/2011 11:03''!!
+trimBlanks
+	"Answer a new parser that consumes blanks before and after the receiving parser."
+	
+	^ self trim: #blank asParser!! !!
+
+!!PPParser methodsFor: ''operators-mapping'' stamp: ''lr 2/19/2010 07:42''!!
+answer: anObject
+	"Answer a new parser that always returns anObject from a successful parse."
+
+	^ self ==> [ :nodes | anObject ]!! !!
+
+!!PPParser methodsFor: ''operators-mapping'' stamp: ''lr 7/11/2011 11:03''!!
+trim: aParser
+	"Answer a new parser that consumes and ignores aParser repeatedly before and after the receiving parser."
+	
+	^ PPTrimmingParser on: self trimmer: aParser!! !!
+
+!!PPParser methodsFor: ''operators-mapping'' stamp: ''lr 5/6/2011 20:28''!!
+map: aBlock
+	"Answer a new parser that works on the receiving sequence an passes in each element as a block argument."
+	
+	^ aBlock numArgs = 1
+		ifTrue: [ self ==> aBlock ]
+		ifFalse: [ self error: aBlock numArgs asString , '' arguments expected.'' ]
+!! !!
+
+!!PPParser methodsFor: ''operators-mapping'' stamp: ''lr 6/29/2010 14:25''!!
+token
+	"Answer a new parser that transforms the input to a token."
+	
+	^ PPTokenParser on: self!! !!
+
+!!PPParser methodsFor: ''operators-mapping'' stamp: ''lr 4/3/2011 14:59''!!
+foldRight: aBlock
+	"Answer a new parser that that folds the result of the receiver from right-to-left into aBlock. The argument aBlock must take two or more arguments."
+
+	| size args |
+	size := aBlock numArgs.
+	args := Array new: size.
+	^ self ==> [ :nodes |
+		args at: size put: nodes last.
+		nodes size - size + 1 to: 1 by: 1 - size do: [ :index |
+			args
+				replaceFrom: 1 to: size - 1 with: nodes startingAt: index;
+				at: size put: (aBlock valueWithArguments: args) ].
+		args at: size ]!! !!
+
+!!PPParser methodsFor: ''operators-mapping'' stamp: ''lr 7/11/2011 11:03''!!
+trimSpaces
+	"Answer a new parser that consumes spaces before and after the receiving parser."
+	
+	^ self trim: #space asParser!! !!
+
+!!PPParser methodsFor: ''operators-mapping'' stamp: ''lr 5/15/2008 16:08''!!
+flatten
+	"Answer a new parser that flattens the underlying collection."
+	
+	^ PPFlattenParser on: self!! !!
+
+!!PPParser methodsFor: ''operators-mapping'' stamp: ''lr 7/31/2010 12:06''!!
+trim
+	"Answer a new parser that consumes spaces before and after the receiving parser."
+	
+	^ self trimSpaces!! !!
+
+!!PPParser methodsFor: ''operators-mapping'' stamp: ''lr 6/12/2010 10:20''!!
+>=> aBlock
+	"Answer a new parser that wraps the receiving parser with a two argument block. The first argument is the parsed stream, the second argument a continuation block on the delegate parser."
+
+	^ PPWrappingParser on: self block: aBlock!! !!
+
+!!PPParser methodsFor: ''operators-mapping'' stamp: ''lr 5/12/2010 20:32''!!
+==> aBlock
+	"Answer a new parser that performs aBlock as action handler on success."
+
+	^ PPActionParser on: self block: aBlock!! !!
+
+!!PPParser methodsFor: ''operators-mapping'' stamp: ''lr 4/3/2011 15:00''!!
+foldLeft: aBlock
+	"Answer a new parser that that folds the result of the receiver from left-to-right into aBlock. The argument aBlock must take two or more arguments."
+	
+	| size args |
+	size := aBlock numArgs.
+	args := Array new: size.
+	^ self ==> [ :nodes |
+		args at: 1 put: nodes first.
+		2 to: nodes size by: size - 1 do: [ :index |
+			args
+				replaceFrom: 2 to: size with: nodes startingAt: index;
+				at: 1 put: (aBlock valueWithArguments: args) ].
+		args first ]!! !!
+
+!!PPParser methodsFor: ''operators-mapping'' stamp: ''lr 4/6/2010 19:26''!!
+token: aTokenClass
+	"Answer a new parser that transforms the input to a token of class aTokenClass."
+	
+	^ self token tokenClass: aTokenClass!! !!
+
+
+!!PPParser methodsFor: ''operators-repeating'' stamp: ''lr 4/3/2011 14:57''!!
+max: anInteger lazy: aParser
+	"Answer a new parser that parses the receiver at most anInteger times until it reaches aParser. This is a lazy non-blind implementation. aParser is not consumed."
+	
+	^ (self starLazy: aParser) setMax: anInteger!! !!
+
+!!PPParser methodsFor: ''operators-repeating'' stamp: ''lr 4/2/2011 10:01''!!
+starLazy: aParser
+	"Answer a new parser that parses the receiver zero or more times until it reaches aParser. This is a lazy non-blind implementation of the star operator. aParser is not consumed."
+	
+	^ PPLazyRepeatingParser on: self limit: aParser!! !!
+
+!!PPParser methodsFor: ''operators-repeating'' stamp: ''lr 9/15/2010 09:34''!!
+times: anInteger
+	"Answer a new parser that parses the receiver exactly anInteger times."
+	
+	^ self min: anInteger max: anInteger!! !!
+
+!!PPParser methodsFor: ''operators-repeating'' stamp: ''lr 4/3/2011 14:56''!!
+min: aMinInteger max: aMaxInteger greedy: aParser
+	"Answer a new parser that parses the receiver at least aMinInteger and at most aMaxInteger times until it reaches aParser. This is a greedy non-blind implementation. aParser is not consumed."
+	
+	^ (self starGreedy: aParser) setMin: aMinInteger; setMax: aMaxInteger!! !!
+
+!!PPParser methodsFor: ''operators-repeating'' stamp: ''lr 4/2/2011 10:02''!!
+star
+	"Answer a new parser that parses the receiver zero or more times. This is a greedy and blind implementation that tries to consume as much input as possible and it does not consider what comes afterwards."
+
+	^ PPPossessiveRepeatingParser on: self!! !!
+
+!!PPParser methodsFor: ''operators-repeating'' stamp: ''lr 4/1/2011 21:02''!!
+min: anInteger
+	"Answer a new parser that parses the receiver at least anInteger times."
+	
+	^ self star setMin: anInteger!! !!
+
+!!PPParser methodsFor: ''operators-repeating'' stamp: ''lr 4/1/2011 21:03''!!
+min: aMinInteger max: aMaxInteger
+	"Answer a new parser that parses the receiver at least aMinInteger and at most aMaxInteger times."
+	
+	^ self star setMin: aMinInteger; setMax: aMaxInteger!! !!
+
+!!PPParser methodsFor: ''operators-repeating'' stamp: ''lr 4/2/2011 10:01''!!
+starGreedy: aParser
+	"Answer a new parser that parses the receiver zero or more times until it reaches aParser. This is a greedy non-blind implementation of the star operator. aParser is not consumed."
+	
+	^ PPGreedyRepeatingParser on: self limit: aParser!! !!
+
+!!PPParser methodsFor: ''operators-repeating'' stamp: ''lr 4/3/2011 14:57''!!
+min: aMinInteger max: aMaxInteger lazy: aParser
+	"Answer a new parser that parses the receiver at least aMinInteger and at most aMaxInteger times until it reaches aParser. This is a greedy non-blind implementation. aParser is not consumed."
+	
+	^ (self starLazy: aParser) setMin: aMinInteger; setMax: aMaxInteger!! !!
+
+!!PPParser methodsFor: ''operators-repeating'' stamp: ''lr 4/3/2011 14:57''!!
+min: anInteger lazy: aParser
+	"Answer a new parser that parses the receiver at least anInteger times until it reaches aParser. This is a lazy non-blind implementation. aParser is not consumed."
+	
+	^ (self starLazy: aParser) setMin: anInteger!! !!
+
+!!PPParser methodsFor: ''operators-repeating'' stamp: ''lr 4/3/2011 14:56''!!
+max: anInteger greedy: aParser
+	"Answer a new parser that parses the receiver at most anInteger times until it reaches aParser. This is a greedy non-blind implementation. aParser is not consumed."
+	
+	^ (self starGreedy: aParser) setMax: anInteger!! !!
+
+!!PPParser methodsFor: ''operators-repeating'' stamp: ''lr 4/1/2011 21:03''!!
+plus
+	"Answer a new parser that parses the receiver one or more times."
+
+	^ self star setMin: 1!! !!
+
+!!PPParser methodsFor: ''operators-repeating'' stamp: ''lr 4/3/2011 14:56''!!
+min: anInteger greedy: aParser
+	"Answer a new parser that parses the receiver at least anInteger times until it reaches aParser. This is a greedy non-blind implementation. aParser is not consumed."
+	
+	^ (self starGreedy: aParser) setMin: anInteger!! !!
+
+!!PPParser methodsFor: ''operators-repeating'' stamp: ''lr 4/1/2011 21:03''!!
+max: anInteger
+	"Answer a new parser that parses the receiver at most anInteger times."
+	
+	^ self star setMax: anInteger!! !!
+
+!!PPParser methodsFor: ''operators-repeating'' stamp: ''lr 4/1/2011 21:04''!!
+plusGreedy: aParser
+	"Answer a new parser that parses the receiver one or more times until it reaches aParser. This is a greedy non-blind implementation of the star operator. aParser is not consumed."
+	
+	^ (self starGreedy: aParser) setMin: 1!! !!
+
+!!PPParser methodsFor: ''operators-repeating'' stamp: ''lr 4/1/2011 21:04''!!
+plusLazy: aParser
+	"Answer a new parser that parses the receiver one or more times until it reaches aParser. This is a lazy non-blind implementation of the star operator. aParser is not consumed."
+	
+	^ (self starLazy: aParser) setMin: 1!! !!
+
+
+!!PPParser methodsFor: ''*petitsmalltalk-operations'' stamp: ''lr 6/29/2010 14:27''!!
+smalltalkToken
+	^ PPSmalltalkTokenParser on: self!! !!
+
+
+!!PPParser methodsFor: ''*petitanalyzer-testing'' stamp: ''lr 5/22/2010 10:45''!!
+isTerminal
+	"Answer true if the receiver is a terminal or leaf parser, that means it does not delegate to any other parser."
+
+	^ self children isEmpty!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-testing'' stamp: ''JanKurs 5/31/2013 11:49''!!
+isFirstSetTerminal
+	"Answer true if the receiver is a terminal or leaf parser, that means it does not delegate to any other parser."
+
+	^ self children isEmpty!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-testing'' stamp: ''lr 11/12/2009 17:25''!!
+isNullable
+	"Answer true if the receiver is a nullable parser, e.g. it can successfully parse nothing."
+	
+	^ false!! !!
+
+
+!!PPParser methodsFor: ''converting'' stamp: ''lr 11/29/2011 20:48''!!
+asParser
+	"Answer the receiving parser."
+	
+	^ self!! !!
+
+
+!!PPParser methodsFor: ''printing'' stamp: ''lr 4/16/2010 16:36''!!
+printNameOn: aStream
+	self name isNil
+		ifTrue: [ aStream print: self hash ]
+		ifFalse: [ aStream nextPutAll: self name ]!! !!
+
+!!PPParser methodsFor: ''printing'' stamp: ''lr 4/16/2010 16:36''!!
+printOn: aStream
+	super printOn: aStream.
+	aStream nextPut: $(.
+	self printNameOn: aStream.
+	aStream nextPut: $)!! !!
+
+
+!!PPParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/9/2009 14:37''!!
+example
+	^ String streamContents: [ :stream | self exampleOn: stream ] limitedTo: 1024!! !!
+
+!!PPParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/9/2009 14:20''!!
+exampleOn: aStream!! !!
+
+!!PPParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 9/12/2011 18:34''!!
+displayColor
+	^ self isTerminal
+		ifTrue: [ Color r: 0.5 g: 0.0 b: 0.5 ]
+		ifFalse: [ Color blue ]!! !!
+
+!!PPParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/6/2009 18:31''!!
+displayName
+	^ self name isNil
+		ifFalse: [ self name asString ]
+		ifTrue: [ self class name asString ]!! !!
+
+!!PPParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/13/2009 14:11''!!
+backgroundForDepth: anInteger
+	^ Color gray: 1.0 - (anInteger / 20.0)!! !!
+
+
+!!PPParser methodsFor: ''parsing'' stamp: ''lr 10/29/2010 17:05''!!
+parse: anObject onError: aBlock
+	"Parse anObject with the receiving parser and answer the parse-result or answer the result of evaluating aBlock. Depending on the number of arguments of the block it is simply evaluated, evaluated with the failure object, or evaluated with the error message and position."
+	
+	| result |
+	result := self parse: anObject.
+	result isPetitFailure
+		ifFalse: [ ^ result ].
+	aBlock numArgs = 0
+		ifTrue: [ ^ aBlock value ].
+	aBlock numArgs = 1
+		ifTrue: [ ^ aBlock value: result ].
+	^ aBlock value: result message value: result position!! !!
+
+!!PPParser methodsFor: ''parsing'' stamp: ''lr 6/4/2011 18:12''!!
+matchesIn: anObject
+	"Search anObject repeatedly for the matches of the receiver. Answered an OrderedCollection of the matched parse-trees."
+
+	| result |
+	result := OrderedCollection new.
+	self 
+		matchesIn: anObject
+		do: [ :each | result addLast: each ].
+	^ result!! !!
+
+!!PPParser methodsFor: ''parsing'' stamp: ''lr 8/16/2011 07:26''!!
+matchesSkipIn: anObject
+	"Search anObject repeatedly for the matches of the receiver. Answer an OrderedCollection of the matched parse-trees. Skip over matches."
+
+	| result |
+	result := OrderedCollection new.
+	self 
+		matchesSkipIn: anObject
+		do: [ :each | result addLast: each ].
+	^ result!! !!
+
+!!PPParser methodsFor: ''parsing'' stamp: ''lr 2/25/2013 23:42''!!
+matchingSkipRangesIn: anObject do: aBlock
+	"Search anObject repeatedly for the matches of the receiver. Skip over matches. Evaluate aBlock with the range of each match (index of first character to: index of last character)."
+	
+	self token
+		matchesSkipIn: anObject
+		do: [ :token | aBlock value: (token start to: token stop) ]!! !!
+
+!!PPParser methodsFor: ''parsing'' stamp: ''DamienCassou 10/29/2011 19:18''!!
+matchingSkipRangesIn: anObject
+	"Search anObject repeatedly for the matches of the receiver. Skip over matches. Answer an OrderedCollection of ranges of each match (index of first character to: index of last character)."
+	
+	| result |
+	result := OrderedCollection new.
+	self
+		matchingSkipRangesIn: anObject
+		do: [ :value | result addLast: value ].
+	^ result!! !!
+
+!!PPParser methodsFor: ''parsing'' stamp: ''lr 6/4/2011 18:12''!!
+matchingRangesIn: anObject
+	"Search anObject repeatedly for the matches of the receiver. Answer an OrderedCollection of ranges of each match (index of first character to: index of last character)."
+	
+	| result |
+	result := OrderedCollection new.
+	self
+		matchingRangesIn: anObject
+		do: [ :value | result addLast: value ].
+	^ result!! !!
+
+!!PPParser methodsFor: ''parsing'' stamp: ''lr 8/16/2011 07:26''!!
+matchesSkipIn: anObject do: aBlock
+	"Search anObject repeatedly for the matches of the receiver. Evaluate aBlock for each match with the matched parse-tree as the argument. Skip over matches."
+
+	(self ==> aBlock / #any asParser) star parse: anObject!! !!
+
+!!PPParser methodsFor: ''parsing'' stamp: ''lr 2/25/2013 23:41''!!
+matchingRangesIn: anObject do: aBlock
+	"Search anObject repeatedly for the matches of the receiver. Evaluate aBlock with the range of each match (index of first character to: index of last character)."
+
+	self token
+		matchesIn: anObject
+		do: [ :token | aBlock value: (token start to: token stop) ]!! !!
+
+!!PPParser methodsFor: ''parsing'' stamp: ''lr 2/8/2010 00:30''!!
+matches: anObject
+	"Answer if anObject can be parsed by the receiver."
+	
+	^ (self parse: anObject) isPetitFailure not!! !!
+
+!!PPParser methodsFor: ''parsing'' stamp: ''lr 3/1/2010 21:51''!!
+matchesIn: anObject do: aBlock
+	"Search anObject repeatedly for the matches of the receiver. Evaluate aBlock for each match with the matched parse-tree as the argument. Make sure to always consume exactly one character with each step, to not miss any match."
+
+	((self and ==> aBlock , #any asParser) / #any asParser) star parse: anObject!! !!
+
+
+!!PPParser methodsFor: ''*petitanalyzer-matching'' stamp: ''lr 5/31/2010 18:37''!!
+matchList: matchList index: matchIndex against: parserList index: parserIndex inContext: aDictionary seen: aSet
+	| parser currentIndex currentDictionary currentSeen parsers |
+	matchList size < matchIndex
+		ifTrue: [ ^ parserList size < parserIndex ].
+	parser := matchList at: matchIndex.
+	parser class = PPListPattern ifTrue: [
+		currentIndex := parserIndex - 1.
+		[ currentDictionary := aDictionary copy.
+		currentSeen := aSet copy.
+		parserList size < currentIndex or: [ 
+			parsers := parserList copyFrom: parserIndex to: currentIndex.
+			(currentDictionary at: parser ifAbsentPut: [ parsers ]) = parsers and: [ 
+				(self
+					matchList: matchList
+					index: matchIndex + 1
+					against: parserList
+					index: currentIndex + 1
+					inContext: currentDictionary
+					seen: currentSeen)
+					ifTrue: [ 
+						currentDictionary keysAndValuesDo: [ :key :value | aDictionary at: key put: value ].
+						^ true ].
+				false ] ] ] whileFalse: [ currentIndex := currentIndex + 1 ].
+		^ false ].
+	parserList size < parserIndex
+		ifTrue: [ ^ false ].
+	(parser match: (parserList at: parserIndex) inContext: aDictionary seen: aSet)
+		ifFalse: [ ^ false ].
+	^ self
+		matchList: matchList
+		index: matchIndex + 1
+		against: parserList
+		index: parserIndex + 1
+		inContext: aDictionary
+		seen: aSet!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-matching'' stamp: ''lr 7/17/2011 11:53''!!
+copyInContext: aDictionary seen: aSeenDictionary
+	| copy |
+	aSeenDictionary 
+		at: self 
+		ifPresent: [ :value | ^ value ].
+	copy := aSeenDictionary
+		at: self
+		put: self copy.
+	copy children do: [ :each |
+		copy
+			replace: each
+			with: (each copyInContext: aDictionary seen: aSeenDictionary) ].
+	^ copy!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-matching'' stamp: ''lr 4/30/2010 07:49''!!
+copyInContext: aDictionary
+	^ self copyInContext: aDictionary seen: IdentityDictionary new!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-matching'' stamp: ''lr 4/29/2010 23:07''!!
+matchList: matchList against: parserList inContext: aDictionary seen: aSet
+	^ self matchList: matchList index: 1 against: parserList index: 1 inContext: aDictionary seen: aSet!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-matching'' stamp: ''lr 6/18/2010 14:09''!!
+match: aParser inContext: aDictionary seen: anIdentitySet
+	"This is the default implementation to match two parsers. This code can properly handle recursion. This is code is supposed to be overridden in subclasses that add new state."
+
+	(self == aParser or: [ anIdentitySet includes: self ])
+		ifTrue: [ ^ true ].
+	anIdentitySet add: self.
+	^ self class = aParser class and: [ self matchList: self children against: aParser children inContext: aDictionary seen: anIdentitySet ]!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-matching'' stamp: ''lr 4/29/2010 23:14''!!
+match: aParser inContext: aDictionary
+	^ self match: aParser inContext: aDictionary seen: IdentitySet new!! !!
+
+
+!!PPParser methodsFor: ''testing'' stamp: ''lr 10/27/2008 11:28''!!
+isUnresolved
+	^ false!! !!
+
+!!PPParser methodsFor: ''testing'' stamp: ''lr 8/6/2010 16:44''!!
+isPetitParser
+	^ true!! !!
+
+
+!!PPParser methodsFor: ''accessing-properties'' stamp: ''lr 4/19/2010 10:32''!!
+propertyAt: aKey ifAbsentPut: aBlock
+	"Answer the property associated with aKey or, if aKey isn''t found store the result of evaluating aBlock as new value."
+	
+	^ self propertyAt: aKey ifAbsent: [ self propertyAt: aKey put: aBlock value ]!! !!
+
+!!PPParser methodsFor: ''accessing-properties'' stamp: ''lr 4/19/2010 10:33''!!
+removeProperty: aKey ifAbsent: aBlock
+	"Remove the property with aKey. Answer the value or, if aKey isn''t found, answer the result of evaluating aBlock."
+	
+	| answer |
+	properties isNil ifTrue: [ ^ aBlock value ].
+	answer := properties removeKey: aKey ifAbsent: aBlock.
+	properties isEmpty ifTrue: [ properties := nil ].
+	^ answer!! !!
+
+!!PPParser methodsFor: ''accessing-properties'' stamp: ''lr 4/19/2010 10:32''!!
+propertyAt: aKey
+	"Answer the property value associated with aKey."
+	
+	^ self propertyAt: aKey ifAbsent: [ self error: ''Property not found'' ]!! !!
+
+!!PPParser methodsFor: ''accessing-properties'' stamp: ''lr 4/19/2010 10:32''!!
+propertyAt: aKey ifAbsent: aBlock
+	"Answer the property value associated with aKey or, if aKey isn''t found, answer the result of evaluating aBlock."
+	
+	^ properties isNil
+		ifTrue: [ aBlock value ]
+		ifFalse: [ properties at: aKey ifAbsent: aBlock ]!! !!
+
+!!PPParser methodsFor: ''accessing-properties'' stamp: ''lr 4/19/2010 10:33''!!
+propertyAt: aKey put: anObject
+	"Set the property at aKey to be anObject. If aKey is not found, create a new entry for aKey and set is value to anObject. Answer anObject."
+
+	^ (properties ifNil: [ properties := Dictionary new: 1 ])
+		at: aKey put: anObject!! !!
+
+!!PPParser methodsFor: ''accessing-properties'' stamp: ''lr 4/19/2010 10:32''!!
+hasProperty: aKey
+	"Test if the property aKey is present."
+	
+	^ properties notNil and: [ properties includesKey: aKey ]!! !!
+
+!!PPParser methodsFor: ''accessing-properties'' stamp: ''lr 4/19/2010 10:33''!!
+removeProperty: aKey
+	"Remove the property with aKey. Answer the property or raise an error if aKey isn''t found."
+	
+	^ self removeProperty: aKey ifAbsent: [ self error: ''Property not found'' ]!! !!
+
+
+!!PPParser methodsFor: ''*petitgui-mondrian'' stamp: ''AlexandreBergel 12/18/2013 16:41''!!
+visualizationGraphType
+	^ nil!! !!
+
+!!PPParser methodsFor: ''*petitgui-mondrian'' stamp: ''AlexandreBergel 12/18/2013 17:26''!!
+visualizeStructureInGraphOn: view
+	view shape rectangle 
+		borderWidth: 1;
+		if: [ :p | p name isNil ] fillColor: Color lightGray.
+	
+	view interaction
+		item: ''Explore'' action: #explore;
+		highlightWhenOver: [ :p | 
+			self allParsers select: [ :ch | ch children includes: p ]
+		] color: Color orange muchLighter;
+		highlightWhenOver: [ :p | |children|
+			children := p namedChildren.
+		] color: Color orange muchDarker;
+		highlightWhenOver: [ :p | Array with: p ] color: Color orange;
+		popupText: [:p | p class name asString ].
+	
+	view
+		nodes: self allParsers
+		forEach: [ :aParser | |labels|
+			labels := OrderedCollection new.
+			aParser name notNil ifTrue: [ labels add: aParser name ].
+			aParser visualizationGraphType notNil ifTrue: [ labels add: aParser visualizationGraphType ].
+			labels isEmpty ifFalse: [ 
+					view shape label.
+					view interaction forwarder.
+					view nodes: labels asArray ].
+		].
+	
+	view shape: (ROLine new add: (ROArrow new size: 4) offset: 0.1).
+	view edgesToAll: #children.	
+	view treeLayout
+		layered;
+		on: ROLayoutEnd do: [ :evt | ROFocusView on: (view raw elementFromModel: self) ].
+		
+	view zoomInButton.
+	view zoomOutButton.!! !!
+
+!!PPParser methodsFor: ''*petitgui-mondrian'' stamp: ''tg 8/25/2010 00:32''!!
+namedParsersDo: aBlock
+    self namedParsersDo: aBlock seen: IdentitySet new!! !!
+
+!!PPParser methodsFor: ''*petitgui-mondrian'' stamp: ''VincentBlondeau 2/14/2014 17:06''!!
+viewAllNamedParsersWithSelection: aCollectionOfNames previewing: aBlock on: view
+	view shape label
+		color: [ :each | 
+					(aCollectionOfNames includes: each name)
+						ifFalse: [ Color black ]
+						ifTrue: [ Color red ] ];
+		text: [ :each | each displayName ].
+	view interaction popupText: aBlock.
+	view interaction item: ''Explore'' action: #explore.
+	view nodes: (self allParsers reject: [ :each | each name isEmptyOrNil ]).
+	view edges: (self allParsers reject: [ :each | each name isEmptyOrNil ]) from: #yourself toAll: #namedParsers.
+	view horizontalDominanceTreeLayout
+		verticalGap: 10;
+		layered!! !!
+
+!!PPParser methodsFor: ''*petitgui-mondrian'' stamp: ''AlexandreBergel 12/18/2013 17:21''!!
+visualizeStructureInGraph
+
+	"
+	PPSmalltalkParser new visualize
+	
+	
+	"
+	| view |
+	
+	view := ROMondrianViewBuilder new.
+	self visualizeStructureInGraphOn: view.
+	view open.
+	^ view!! !!
+
+!!PPParser methodsFor: ''*petitgui-mondrian'' stamp: ''VincentBlondeau 2/14/2014 17:06''!!
+viewAllNamedParsersOn: view
+	view shape
+		rectangleWithoutBorder;
+		withText: #displayName.
+	view nodes: (self allParsers reject: [ :each | each name isEmptyOrNil ]).
+	view edgesToAll: #namedParsers.
+	view horizontalDominanceTreeLayout layered!! !!
+
+!!PPParser methodsFor: ''*petitgui-mondrian'' stamp: ''TudorGirba 12/6/2011 07:43''!!
+viewAllNamedParsersWithSelection: aCollectionOfNames on: view
+	self viewAllNamedParsersWithSelection: aCollectionOfNames previewing: [ :each | each name ] on: view!! !!
+
+!!PPParser methodsFor: ''*petitgui-mondrian'' stamp: ''TudorGirba 12/14/2011 12:40''!!
+namedParsersDo: aBlock seen: aSet
+    self children do: [ :each | 
+        (aSet includes: each)
+            ifFalse: [
+		        aSet add: each.
+		        each name isEmptyOrNil
+		            ifFalse: [ aBlock value: each ]
+		            ifTrue: [ each namedParsersDo: aBlock seen: aSet ] ] ]!! !!
+
+!!PPParser methodsFor: ''*petitgui-mondrian'' stamp: ''TudorGirba 6/5/2013 23:01''!!
+viewAllNamedParsers
+	| view |
+	view := ROMondrianViewBuilder new.
+	self viewAllNamedParsersOn: view.
+	^ view open setLabel: ''All named parsers''!! !!
+
+!!PPParser methodsFor: ''*petitgui-mondrian'' stamp: ''tg 8/25/2010 00:31''!!
+namedParsers
+    | result |
+    result := OrderedCollection new.
+    self namedParsersDo: [ :parser | result addLast: parser ].
+    ^ result!! !!
+
+
+!!PPParser methodsFor: ''*petitanalyzer-enumerating'' stamp: ''lr 4/13/2010 08:36''!!
+allParsers
+	"Answer all the parse nodes of the receiver."
+
+	| result |
+	result := OrderedCollection new.
+	self allParsersDo: [ :parser | result addLast: parser ].
+	^ result!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-enumerating'' stamp: ''lr 4/13/2010 08:36''!!
+allParsersDo: aBlock
+	"Iterate over all the parse nodes of the receiver."
+
+	self allParsersDo: aBlock seen: IdentitySet new!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-enumerating'' stamp: ''lr 4/13/2010 08:35''!!
+allParsersDo: aBlock seen: aSet
+	"Iterate over all the parse nodes of the receiver, do not visit and follow the ones contained in aSet."
+
+	(aSet includes: self)
+		ifTrue: [ ^ self ].
+	aSet add: self.
+	aBlock value: self.
+	self children
+		do: [ :each | each allParsersDo: aBlock seen: aSet ]!! !!
+
+
+!!PPParser methodsFor: ''operators-convenience'' stamp: ''lr 2/19/2010 07:56''!!
+separatedBy: aParser
+	"Answer a new parser that parses the receiver one or more times, separated by aParser."
+	
+	^ (PPSequenceParser with: self with: (PPSequenceParser with: aParser with: self) star) ==> [ :nodes |
+		| result |
+		result := Array new: 2 * nodes second size + 1.
+		result at: 1 put: nodes first.
+		nodes second 
+			keysAndValuesDo: [ :index :pair | result replaceFrom: 2 * index to: 2 * index + 1 with: pair startingAt: 1 ].
+		result ]!! !!
+
+!!PPParser methodsFor: ''operators-convenience'' stamp: ''lr 2/19/2010 07:42''!!
+delimitedBy: aParser
+	"Answer a new parser that parses the receiver one or more times, separated and possibly ended by aParser."
+	
+	^ (self separatedBy: aParser) , (aParser optional) ==> [ :node |
+		node second isNil
+			ifTrue: [ node first ]
+			ifFalse: [ node first copyWith: node second ] ]!! !!
+
+!!PPParser methodsFor: ''operators-convenience'' stamp: ''lr 2/25/2012 16:54''!!
+withoutSeparators
+	"Filters out the separators from a parse result produced by one of the productions #delimitedBy: or #separatedBy:."
+	
+	^ self ==> [ :items |
+		| result |
+		result := Array new: items size + 1 // 2.
+		1 to: result size do: [ :index | result at: index put: (items at: 2 * index - 1) ].
+		result ]!! !!
+
+
+!!PPParser methodsFor: ''copying'' stamp: ''lr 4/19/2010 10:33''!!
+postCopy
+	super postCopy.
+	properties := properties copy!! !!
+
+
+!!PPParser methodsFor: ''initialization'' stamp: ''lr 4/24/2008 10:33''!!
+initialize!! !!
+
+
+!!PPParser methodsFor: ''*petitgui-morphic-creational'' stamp: ''lr 11/17/2009 21:58''!!
+newColumnMorph
+	^ AlignmentMorph newColumn
+		cellPositioning: #topLeft;
+		color: Color transparent;
+		listCentering: #topLeft;
+		vResizing: #shrinkWrap;
+		hResizing: #shrinkWrap;
+		layoutInset: 0;
+		yourself!! !!
+
+!!PPParser methodsFor: ''*petitgui-morphic-creational'' stamp: ''lr 11/17/2009 21:57''!!
+newRowMorph
+	^ AlignmentMorph newRow
+		cellPositioning: #topLeft;
+		color: Color transparent;
+		listCentering: #topLeft;
+		vResizing: #shrinkWrap;
+		hResizing: #shrinkWrap;
+		layoutInset: 0;
+		yourself!! !!
+
+!!PPParser methodsFor: ''*petitgui-morphic-creational'' stamp: ''lr 11/17/2009 22:03''!!
+newSpacerMorph
+	^ Morph new
+		color: Color transparent;
+		borderWidth: 0;
+		extent: 7 @ 7;
+		yourself!! !!
+
+
+!!PPParser methodsFor: ''*petitanalyzer-querying'' stamp: ''lr 9/16/2010 17:55''!!
+followSets
+	"Answer a dictionary with all the parsers reachable from the receiver as key and their follow-set as value. The follow-set of a parser is the list of terminal parsers that can appear immediately to the right of that parser."
+	
+	| current previous continue firstSets followSets |
+	current := previous := 0.
+	firstSets := self firstSets.
+	followSets := IdentityDictionary new.
+	self allParsersDo: [ :each | followSets at: each put: IdentitySet new ].
+	(followSets at: self) add: PPSentinel instance.
+	[	followSets keysAndValuesDo: [ :parser :follow |
+			parser 
+				followSets: followSets
+				firstSets: firstSets
+				into: follow ].
+		current := followSets
+			inject: 0
+			into: [ :result :each | result + each size ].
+		continue := previous < current.
+		previous := current.
+		continue ] whileTrue.
+	^ followSets!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-querying'' stamp: ''lr 10/22/2009 19:59''!!
+firstSet
+	"Answer the first-set of the receiver. Note, this implementation is inefficient when called on different receivers of the same grammar, instead use #firstSets to calculate the first-sets at once."
+	
+	^ self firstSets at: self!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-querying'' stamp: ''lr 11/19/2009 23:49''!!
+cycleSet
+	"Answer a set of all nodes that are within one or more cycles of left-recursion. This is generally not a problem if at least one of the nodes is memoized, but it might make the grammar very inefficient and should be avoided if possible."
+	
+	| cycles |
+	cycles := IdentitySet new.
+	self cycleSet: OrderedCollection new firstSets: self firstSets into: cycles.
+	^ cycles!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-querying'' stamp: ''JanKurs 5/31/2013 11:49''!!
+firstSets
+	"Answer a dictionary with all the parsers reachable from the receiver as key and their first-set as value. The first-set of a parser is the list of terminal parsers that begin the parser derivable from that parser."
+	
+	| firstSets |
+	firstSets := IdentityDictionary new.
+	self allParsersDo: [ :each |
+		firstSets at: each put: (each isFirstSetTerminal
+			ifTrue: [ IdentitySet with: each ]
+			ifFalse: [ IdentitySet new ]).
+		each isNullable
+			ifTrue: [ (firstSets at: each) add: PPSentinel instance ] ].
+	[	| changed tally |
+		changed := false.
+		firstSets keysAndValuesDo: [ :parser :first |
+			tally := first size.
+			parser firstSets: firstSets into: first.
+			changed := changed or: [ tally ~= first size ] ].
+		changed ] whileTrue.
+	^ firstSets!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-querying'' stamp: ''lr 11/12/2009 21:13''!!
+followSet
+	"Answer the follow-set of the receiver starting at the receiver. Note, this implementation is inefficient when called on different receivers of the same grammar, instead use #followSets to calculate the follow-sets at once."
+
+	^ self followSets at: self!! !!
+
+
+!!PPParser methodsFor: ''pp-context'' stamp: ''JanKurs 11/11/2013 09:30''!!
+parseOn: aPPContext
+	"Parse aStream with the receiving parser and answer the parse-result or an instance of PPFailure. Override this method in subclasses to specify custom parse behavior. Do not call this method from outside, instead use #parse:."
+	
+	self subclassResponsibility!! !!
+
+!!PPParser methodsFor: ''pp-context'' stamp: ''JanKurs 3/17/2014 13:15''!!
+debugWithContext: aPPContext
+	
+	^ self enableDebug parseWithContext: aPPContext !! !!
+
+!!PPParser methodsFor: ''pp-context'' stamp: ''JanKurs 3/11/2014 13:33''!!
+updateContext: aPPContext
+	"nothing to do"!! !!
+
+!!PPParser methodsFor: ''pp-context'' stamp: ''JanKurs 8/19/2014 13:26''!!
+parse: anObject withContext: aPPContext
+	"Parse anObject with the receiving parser and answer the parse-result or an instance of PPFailure."
+
+	aPPContext stream: anObject asPetitStream.
+	^ self parseWithContext: aPPContext.
+!! !!
+
+!!PPParser methodsFor: ''pp-context'' stamp: ''JanKurs 8/19/2014 13:25''!!
+parse: anObject
+	"Parse anObject with the receiving parser and answer the parse-result or an instance of PPFailure."
+
+	^ self parse: anObject withContext: PPContext new!! !!
+
+!!PPParser methodsFor: ''pp-context'' stamp: ''JanKurs 3/19/2014 16:34''!!
+parseWithContext: context
+	context root: self.
+	self updateContext: context.
+	^ self parseOn: context!! !!
+
+
+!!PPParser methodsFor: ''accessing'' stamp: ''lr 10/21/2009 16:38''!!
+children
+	"Answer a set of child parsers that could follow the receiver."
+
+	^ #()!! !!
+
+!!PPParser methodsFor: ''accessing'' stamp: ''lr 4/19/2010 10:38''!!
+name: aString
+	self propertyAt: #name put: aString!! !!
+
+!!PPParser methodsFor: ''accessing'' stamp: ''lr 4/19/2010 10:35''!!
+name
+	"Answer the production name of the receiver."
+	
+	^ self propertyAt: #name ifAbsent: [ nil ]!! !!
+
+
+!!PPParser methodsFor: ''*petitanalyzer-private'' stamp: ''lr 11/19/2009 23:47''!!
+cycleSet: aDictionary
+	"PRIVATE: Answer the children that could be part of a cycle-set with the receiver, subclasses might restrict the number of children returned. aDictionary is pre-calcualted first-sets."
+
+	^ self children!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-private'' stamp: ''lr 5/22/2010 10:45''!!
+cycleSet: aStack firstSets: aDictionary into: aSet
+	"PRIVATE: Try to find a cycle, where aStack contains the previously visited parsers. The method returns quickly when the receiver is a terminal, terminals cannot be part of a cycle. If aStack already contains the receiver, then we are in a cycle. In this case we don''t process the children further and add the nodes to aSet."
+
+	| index |
+	self isTerminal
+		ifTrue: [ ^ self ].	
+	(index := aStack indexOf: self) > 0
+		ifTrue: [ ^ aSet addAll: (aStack copyFrom: index to: aStack size) ].
+	aStack addLast: self.
+	(self cycleSet: aDictionary)
+		do: [ :each | each cycleSet: aStack firstSets: aDictionary into: aSet ].
+	aStack removeLast!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-private'' stamp: ''lr 11/12/2009 21:25''!!
+firstSets: aFirstDictionary into: aSet
+	"PRIVATE: Try to add additional elements to the first-set aSet of the receiver, use the incomplete aFirstDictionary."
+
+	self children do: [ :parser | aSet addAll: (aFirstDictionary at: parser) ]!! !!
+
+!!PPParser methodsFor: ''*petitanalyzer-private'' stamp: ''lr 11/12/2009 21:25''!!
+followSets: aFollowDictionary firstSets: aFirstDictionary into: aSet
+	"PRIVATE: Try to add additional elements to the follow-set aSet of the receiver, use the incomplete aFollowDictionary and the complete aFirstDictionary."
+	
+	self children do: [ :parser | (aFollowDictionary at: parser) addAll: aSet ]!! !!
+
+
+!!PPParser methodsFor: ''*petitgui-debug'' stamp: ''JanKurs 1/16/2014 15:41''!!
+debug: anObject
+	"Parse anObject with the receiving parser and answer the parse-result or an instance of PPFailure."
+	
+	^ self enableDebug parse: anObject asPetitStream!! !!
+
+!!PPParser methodsFor: ''*petitgui-debug'' stamp: ''JanKurs 3/18/2014 12:21''!!
+enableDebuggerOutput 
+	self debuggerOutput: true.!! !!
+
+!!PPParser methodsFor: ''*petitgui-debug'' stamp: ''JanKurs 4/22/2013 18:04''!!
+debuggerOutput: aBoolean
+	self propertyAt: #debuggerOutput put: aBoolean!! !!
+
+!!PPParser methodsFor: ''*petitgui-debug'' stamp: ''JanKurs 3/18/2014 12:21''!!
+disableDebuggerOutput 
+	self debuggerOutput: false.	!! !!
+
+!!PPParser methodsFor: ''*petitgui-debug'' stamp: ''JanKurs 3/18/2014 17:01''!!
+enableDebug
+   | root newParser  |
+	root := PPParserDebuggerResult new.
+	
+	newParser := self transform: [:each |
+		each >=> [:stream :continuation | 
+			| result child |
+			child := PPParserDebuggerResult new 
+					parser: each;
+					parent: root.
+			root := root children add: child.
+ 			child start: stream position + 1.
+			child showChildren: each debuggerOutput.
+			result := continuation value.
+			child end: stream position.
+			root result: result.
+			root := root parent.
+			result 
+		]
+	].
+	
+	^ PPDebugParser on: newParser root: root.
+!! !!
+
+!!PPParser methodsFor: ''*petitgui-debug'' stamp: ''JanKurs 4/22/2013 18:04''!!
+debuggerOutput
+	^ self propertyAt: #debuggerOutput ifAbsentPut: true.!! !!
+
+
+!!PPParser methodsFor: ''operators'' stamp: ''lr 2/19/2010 07:36''!!
+negate
+	"Answer a new parser consumes any input token but the receiver."
+	
+	^ self not , #any asParser ==> #second!! !!
+
+!!PPParser methodsFor: ''operators'' stamp: ''lr 9/1/2010 22:03''!!
+optional
+	"Answer a new parser that parses the receiver, if possible."
+
+	^ PPOptionalParser on: self!! !!
+
+!!PPParser methodsFor: ''operators'' stamp: ''lr 12/3/2010 11:34''!!
+def: aParser
+	"Redefine the receiver as the argument aParser. This method is useful when defining recursive parsers: instantiate a PPUnresolvedParser and later redefine it with another one."
+
+	^ self becomeForward: (aParser name: self name)!! !!
+
+!!PPParser methodsFor: ''operators'' stamp: ''lr 10/23/2008 14:05''!!
+wrapped
+	"Answer a new parser that is simply wrapped."
+	
+	^ PPDelegateParser on: self!! !!
+
+!!PPParser methodsFor: ''operators'' stamp: ''lr 5/31/2010 16:34''!!
+memoized
+	"Answer a new memoized parser, for refraining redundant computations. This ensures polynomial time O(n^4) for left-recursive grammars and O(n^3) for non left-recursive grammars in the worst case. Not necessary for most grammars that are carefully written and in O(n) anyway."
+	
+	^ PPMemoizedParser on: self!! !!
+
+!!PPParser methodsFor: ''operators'' stamp: ''lr 5/31/2010 15:12''!!
+and
+	"Answer a new parser (logical and-predicate) that succeeds whenever the receiver does, but never consumes input."
+
+	^ PPAndParser on: self!! !!
+
+!!PPParser methodsFor: ''operators'' stamp: ''lr 4/14/2010 11:46''!!
+/ aParser 
+	"Answer a new parser that parses the receiver, if the receiver fails try with aParser (ordered-choice)."
+	
+	^ PPChoiceParser with: self with: aParser!! !!
+
+!!PPParser methodsFor: ''operators'' stamp: ''lr 4/30/2010 12:13''!!
+end
+	"Answer a new parser that succeeds at the end of the input and return the result of the receiver."
+
+	^ PPEndOfInputParser on: self!! !!
+
+!!PPParser methodsFor: ''operators'' stamp: ''lr 5/31/2010 15:12''!!
+not
+	"Answer a new parser (logical not-predicate) that succeeds whenever the receiver fails, but never consumes input."
+
+	^ PPNotParser on: self!! !!
+
+!!PPParser methodsFor: ''operators'' stamp: ''lr 4/14/2010 11:53''!!
+| aParser
+	"Answer a new parser that either parses the receiver or aParser. Fail if both pass or fail (exclusive choice, unordered choice)."
+
+	^ (self not , aParser) / (aParser not , self) ==> #second!! !!
+
+!!PPParser methodsFor: ''operators'' stamp: ''lr 9/23/2008 18:32''!!
+, aParser 
+	"Answer a new parser that parses the receiver followed by aParser."
+
+	^ PPSequenceParser with: self with: aParser!! !!
+
+"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!!
+
+PPParser class
+	instanceVariableNames: ''''!!
+!!PPParser class commentStamp: ''<historical>'' prior: 0!!
+!!
+
+
+!!PPParser class methodsFor: ''instance creation'' stamp: ''lr 10/27/2008 11:17''!!
+named: aString
+	^ self new name: aString!! !!
+
+!!PPParser class methodsFor: ''instance creation'' stamp: ''lr 4/18/2008 14:00''!!
+new
+	^ self basicNew initialize!! !!
+
+
+PPParser subclass: #PPPluggableParser
+	instanceVariableNames: ''block''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPPluggableParser commentStamp: ''<historical>'' prior: 0!!
+A pluggable parser that passes the parser stream into a block. This enables users to perform manual parsing or to embed other parser frameworks into PetitParser.
+
+Instance Variables:
+	block	<BlockClosure>	The pluggable one-argument block.
+!!
+
+
+!!PPPluggableParser methodsFor: ''*petitanalyzer-matching'' stamp: ''lr 6/18/2010 14:09''!!
+match: aParser inContext: aDictionary seen: anIdentitySet
+	^ (super match: aParser inContext: aDictionary seen: anIdentitySet) and: [ self block = aParser block ]!! !!
+
+
+!!PPPluggableParser methodsFor: ''initialization'' stamp: ''lr 5/2/2010 16:52''!!
+initializeOn: aBlock
+	block := aBlock!! !!
+
+
+!!PPPluggableParser methodsFor: ''pp-context'' stamp: ''JanKurs 11/11/2013 09:42''!!
+parseOn: aPPContext
+	| position result |
+	position := aPPContext remember.
+	result := block value: aPPContext.
+	result isPetitFailure
+		ifTrue: [ aPPContext restore: position ].
+	^ result!! !!
+
+
+!!PPPluggableParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/13/2009 14:41''!!
+displayName
+	^ String streamContents: [ :stream | block decompile shortPrintOn: stream ]!! !!
+
+
+!!PPPluggableParser methodsFor: ''accessing'' stamp: ''lr 4/30/2010 11:10''!!
+block
+	"Answer the pluggable block."
+
+	^ block!! !!
+
+"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!!
+
+PPPluggableParser class
+	instanceVariableNames: ''''!!
+!!PPPluggableParser class commentStamp: ''<historical>'' prior: 0!!
+!!
+
+
+!!PPPluggableParser class methodsFor: ''instance creation'' stamp: ''lr 5/2/2010 16:52''!!
+on: aBlock
+	^ self new initializeOn: aBlock!! !!
+
+
+PPParser subclass: #PPFailingParser
+	instanceVariableNames: ''message''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPFailingParser commentStamp: ''<historical>'' prior: 0!!
+A parser that consumes nothing and always fails.
+
+Instance Variables:
+	message <String>	The failure message.!!
+
+
+!!PPFailingParser methodsFor: ''initialization'' stamp: ''lr 5/2/2010 19:16''!!
+setMessage: aString
+	message := aString!! !!
+
+
+!!PPFailingParser methodsFor: ''pp-context'' stamp: ''JanKurs 8/19/2014 16:59''!!
+parseOn: aPPContext
+	^ PPFailure message: message context: aPPContext!! !!
+
+
+!!PPFailingParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/6/2009 18:43''!!
+displayName
+	^ message!! !!
+
+!!PPFailingParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/13/2009 14:16''!!
+displayColor
+	^ Color red!! !!
+
+
+!!PPFailingParser methodsFor: ''printing'' stamp: ''lr 4/16/2010 21:27''!!
+printNameOn: aStream
+	super printNameOn: aStream.
+	aStream nextPutAll: '', ''; print: message!! !!
+
+
+!!PPFailingParser methodsFor: ''*petitanalyzer-matching'' stamp: ''lr 4/30/2010 12:01''!!
+match: aParser inContext: aDictionary seen: anIdentitySet
+	^ (super match: aParser inContext: aDictionary seen: anIdentitySet) and: [ self message = aParser message ]!! !!
+
+
+!!PPFailingParser methodsFor: ''accessing'' stamp: ''lr 4/30/2010 11:10''!!
+message
+	"Answer the error message of the receiving parser."
+
+	^ message!! !!
+
+"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!!
+
+PPFailingParser class
+	instanceVariableNames: ''''!!
+!!PPFailingParser class commentStamp: ''<historical>'' prior: 0!!
+!!
+
+
+!!PPFailingParser class methodsFor: ''instance creation'' stamp: ''lr 5/2/2010 19:16''!!
+message: aString
+	^ self new setMessage: aString!! !!
+
+
+PPParser subclass: #PPLiteralParser
+	instanceVariableNames: ''literal message''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPLiteralParser commentStamp: ''<historical>'' prior: 0!!
+Abstract literal parser that parses some kind of literal type (to be specified by subclasses).
+
+Instance Variables:
+	literal	<Object>	The literal object to be parsed.
+	message	<String>	The error message to be generated.
+!!
+
+
+!!PPLiteralParser methodsFor: ''*petitanalyzer-matching'' stamp: ''lr 9/15/2010 12:08''!!
+match: aParser inContext: aDictionary seen: anIdentitySet
+	^ (super match: aParser inContext: aDictionary seen: anIdentitySet) and: [ self literal = aParser literal and: [ self message = aParser message ] ]!! !!
+
+
+!!PPLiteralParser methodsFor: ''*petitgui-mondrian'' stamp: ''AlexandreBergel 12/18/2013 17:25''!!
+visualizationGraphType
+	^ literal printString!! !!
+
+
+!!PPLiteralParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/13/2009 14:19''!!
+displayName
+	^ literal printString!! !!
+
+
+!!PPLiteralParser methodsFor: ''accessing'' stamp: ''lr 5/2/2010 13:26''!!
+message
+	"Answer the failure message."
+	
+	^ message!! !!
+
+!!PPLiteralParser methodsFor: ''accessing'' stamp: ''lr 5/2/2010 13:26''!!
+literal
+	"Answer the parsed literal."
+
+	^ literal!! !!
+
+
+!!PPLiteralParser methodsFor: ''operators'' stamp: ''lr 6/1/2010 22:24''!!
+caseInsensitive
+	"Answer a parser that can parse the receiver case-insensitive."
+	
+	self subclassResponsibility!! !!
+
+
+!!PPLiteralParser methodsFor: ''initialization'' stamp: ''lr 5/2/2010 13:25''!!
+initializeOn: anObject message: aString
+	literal := anObject.
+	message := aString!! !!
+
+
+!!PPLiteralParser methodsFor: ''printing'' stamp: ''lr 4/16/2010 16:38''!!
+printNameOn: aStream
+	super printNameOn: aStream.
+	aStream nextPutAll: '', ''; print: literal!! !!
+
+"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!!
+
+PPLiteralParser class
+	instanceVariableNames: ''''!!
+!!PPLiteralParser class commentStamp: ''<historical>'' prior: 0!!
+!!
+
+
+!!PPLiteralParser class methodsFor: ''instance creation'' stamp: ''lr 1/7/2010 15:29''!!
+on: anObject message: aString
+	^ self new initializeOn: anObject message: aString!! !!
+
+!!PPLiteralParser class methodsFor: ''instance creation'' stamp: ''lr 1/7/2010 15:30''!!
+on: anObject
+	^ self on: anObject message: anObject printString , '' expected''!! !!
+
+
+PPLiteralParser subclass: #PPLiteralObjectParser
+	instanceVariableNames: ''''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPLiteralObjectParser commentStamp: ''<historical>'' prior: 0!!
+A parser that accepts a single literal object, such as a character. This is the same as the predicate parser ''PPPredicateParser expect: literal'' but slightly more efficient.!!
+
+
+!!PPLiteralObjectParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/9/2009 14:25''!!
+exampleOn: aStream
+	aStream nextPut: literal!! !!
+
+
+!!PPLiteralObjectParser methodsFor: ''pp-context'' stamp: ''JanKurs 8/19/2014 17:00''!!
+parseOn: aPPContext
+	^ (aPPContext stream atEnd not and: [ literal = aPPContext stream uncheckedPeek ])
+		ifFalse: [ PPFailure message: message context: aPPContext ]
+		ifTrue: [ aPPContext stream next ]!! !!
+
+
+!!PPLiteralObjectParser methodsFor: ''operators'' stamp: ''lr 8/18/2010 20:16''!!
+caseInsensitive
+	"Answer a parser that can parse the receiver case-insensitive."
+	
+	literal asUppercase = literal asLowercase ifTrue: [ ^ self ].
+	^ PPPredicateObjectParser on: [ :value | literal sameAs: value ] message: message!! !!
+
+!!PPLiteralObjectParser methodsFor: ''operators'' stamp: ''lr 4/28/2011 20:02''!!
+negate
+	^ (PPPredicateObjectParser expect: literal message: message) negate!! !!
+
+
+PPParser subclass: #PPPredicateParser
+	instanceVariableNames: ''predicate predicateMessage negated negatedMessage''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPPredicateParser commentStamp: ''<historical>'' prior: 0!!
+An abstract parser that accepts if a given predicate holds.
+
+Instance Variables:
+	predicate	<BlockClosure>	The block testing for the predicate.
+	predicateMessage	<String>	The error message of the predicate.
+	negated	<BlockClosure>	The block testing for the negation of the predicate.
+	negatedMessage	<String>	The error message of the negated predicate.!!
+
+
+!!PPPredicateParser methodsFor: ''*petitanalyzer-matching'' stamp: ''lr 9/15/2010 11:56''!!
+match: aParser inContext: aDictionary seen: anIdentitySet
+	^ (super match: aParser inContext: aDictionary seen: anIdentitySet) and: [ self block = aParser block and: [ self message = aParser message ] ]!! !!
+
+
+!!PPPredicateParser methodsFor: ''printing'' stamp: ''lr 5/2/2010 13:37''!!
+printNameOn: aStream
+	super printNameOn: aStream.
+	aStream nextPutAll: '', ''; print: predicateMessage!! !!
+
+
+!!PPPredicateParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 5/1/2010 17:05''!!
+exampleOn: aStream
+	"Produce a random character that is valid. If there are characters in the alpha-numeric range prefer those over all others."
+
+	| valid normal |
+	valid := Character allCharacters
+		select: [ :char | self matches: (String with: char) ].
+	normal := valid
+		select: [ :char | char asInteger < 127 and: [ char isAlphaNumeric ] ].
+	aStream nextPut: (normal isEmpty
+		ifTrue: [ valid atRandom ]
+		ifFalse: [ normal atRandom ])!! !!
+
+!!PPPredicateParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 5/2/2010 19:35''!!
+displayName
+	^ predicateMessage!! !!
+
+
+!!PPPredicateParser methodsFor: ''accessing'' stamp: ''lr 5/2/2010 13:36''!!
+message
+	"Answer the failure message."
+	
+	^ predicateMessage!! !!
+
+!!PPPredicateParser methodsFor: ''accessing'' stamp: ''lr 5/2/2010 13:36''!!
+block
+	"Answer the predicate block of the receiver."
+	
+	^ predicate!! !!
+
+
+PPPredicateParser subclass: #PPPredicateObjectParser
+	instanceVariableNames: ''''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPPredicateObjectParser commentStamp: ''<historical>'' prior: 0!!
+A parser that accepts if a given predicate on one element of the input sequence holds.!!
+
+
+!!PPPredicateObjectParser methodsFor: ''operators'' stamp: ''lr 6/12/2010 09:12''!!
+negate
+	"Answer a parser that is the negation of the receiving predicate parser."
+	
+	^ self class 
+		on: negated message: negatedMessage 
+		negated: predicate message: predicateMessage!! !!
+
+
+!!PPPredicateObjectParser methodsFor: ''pp-context'' stamp: ''JanKurs 8/19/2014 17:03''!!
+parseOn: aPPContext
+	^ (aPPContext stream atEnd not and: [ predicate value: aPPContext stream uncheckedPeek ])
+		ifFalse: [ PPFailure message: predicateMessage context: aPPContext ]
+		ifTrue: [ aPPContext stream next ]!! !!
+
+
+!!PPPredicateObjectParser methodsFor: ''initialization'' stamp: ''lr 6/12/2010 09:12''!!
+initializeOn: aBlock message: aString negated: aNegatedBlock message: aNegatedString
+	predicate := aBlock.
+	predicateMessage := aString.
+	negated := aNegatedBlock.
+	negatedMessage := aNegatedString!! !!
+
+"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!!
+
+PPPredicateObjectParser class
+	instanceVariableNames: ''''!!
+!!PPPredicateObjectParser class commentStamp: ''<historical>'' prior: 0!!
+!!
+
+
+!!PPPredicateObjectParser class methodsFor: ''*petitregex-chars'' stamp: ''lr 8/30/2010 14:48''!!
+control
+	^ self chars: ((0 to: 31) collect: [ :each | Character value: each ]) message: ''control character expected''!! !!
+
+
+!!PPPredicateObjectParser class methodsFor: ''factory-objects'' stamp: ''lr 8/25/2010 10:57''!!
+expect: anObject
+	^ self expect: anObject message: anObject printString , '' expected''!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-objects'' stamp: ''lr 4/1/2011 20:05''!!
+anyExceptAnyOf: aCollection
+	^ self
+		on: [ :each | (aCollection includes: each) not ] message: ''any except '' , aCollection printString , '' expected''
+		negated: [ :each | aCollection includes: each ] message: aCollection printString ,  '' not expected''!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-objects'' stamp: ''lr 4/1/2011 20:05''!!
+anyOf: aCollection
+	^ self
+		on: [ :each | aCollection includes: each ] message: ''any of '' , aCollection printString , '' expected''
+		negated: [ :each | (aCollection includes: each) not ] message: ''none of '' , aCollection printString ,  ''expected''!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-objects'' stamp: ''lr 6/12/2010 09:10''!!
+any
+	^ self
+		on: [ :each | true ] message: ''input expected''
+		negated: [ :each | false ] message: ''no input expected''!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-objects'' stamp: ''lr 6/12/2010 09:10''!!
+between: min and: max
+	^ self
+		on: [ :each | each >= min and: [ each <= max ] ] message: min printString , ''..'' , max printString , '' expected''
+		negated: [ :each | each < min or: [ each > max ] ] message: min printString , ''..'' , max printString , '' not expected''!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-objects'' stamp: ''lr 8/25/2010 10:57''!!
+expect: anObject message: aString
+	^ self 
+		on: [ :each | each = anObject ] message: aString
+		negated: [ :each | each ~= anObject ] message: ''no '' , aString!! !!
+
+
+!!PPPredicateObjectParser class methodsFor: ''instance creation'' stamp: ''lr 6/12/2010 09:10''!!
+on: aBlock message: aString
+	^ self on: aBlock message: aString negated: [ :each | (aBlock value: each) not ] message: ''no '' , aString!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''instance creation'' stamp: ''lr 6/12/2010 09:10''!!
+on: aBlock message: aString negated: aNegatedBlock message: aNegatedString
+	^ self new initializeOn: aBlock message: aString negated: aNegatedBlock message: aNegatedString!! !!
+
+
+!!PPPredicateObjectParser class methodsFor: ''factory-chars'' stamp: ''lr 8/25/2010 11:02''!!
+char: aCharacter
+	^ self expect: aCharacter message: (String with: $" with: aCharacter with: $") , '' expected''!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-chars'' stamp: ''lr 8/25/2010 11:04''!!
+punctuation
+	^ self chars: ''.,"''''?!!!!;:#$%&()*+-/<>=@[]\^_{}|~'' message: ''punctuation expected''!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-chars'' stamp: ''lr 8/25/2010 11:02''!!
+blank
+	^ self chars: (String with: Character space with: Character tab) message: ''blank expected''!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-chars'' stamp: ''lr 8/25/2010 11:06''!!
+hex
+	^ self 
+		on: (PPCharSetPredicate on: [ :char | 
+			(char between: $0 and: $9) 
+				or: [ (char between: $a and: $f) 
+				or: [ (char between: $A and: $F) ] ] ])
+		message: ''hex digit expected''!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-chars'' stamp: ''lr 8/25/2010 11:04''!!
+newline
+	^ self chars: (String with: Character cr with: Character lf) message: ''newline expected''!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-chars'' stamp: ''lr 8/25/2010 11:06''!!
+word
+	^ self on: (PPCharSetPredicate on: [ :char | char isAlphaNumeric ]) message: ''letter or digit expected''!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-chars'' stamp: ''lr 6/12/2010 09:10''!!
+lf
+	^ self char: Character lf!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-chars'' stamp: ''lr 8/25/2010 11:06''!!
+digit
+	^ self on: (PPCharSetPredicate on: [ :char | char isDigit ]) message: ''digit expected''!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-chars'' stamp: ''lr 8/25/2010 11:05''!!
+letter
+	^ self on: (PPCharSetPredicate on: [ :char | char isLetter ]) message: ''letter expected''!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-chars'' stamp: ''lr 8/25/2010 11:06''!!
+uppercase
+	^ self on: (PPCharSetPredicate on: [ :char | char isUppercase ]) message: ''uppercase letter expected''!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-chars'' stamp: ''lr 8/25/2010 11:02''!!
+cr
+	^ self char: Character cr message: ''carriage return expected''!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-chars'' stamp: ''lr 8/25/2010 11:06''!!
+space
+	^ self on: (PPCharSetPredicate on: [ :char | char isSeparator ]) message: ''separator expected''!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-chars'' stamp: ''lr 8/25/2010 11:06''!!
+lowercase
+	^ self on: (PPCharSetPredicate on: [ :char | char isLowercase ]) message: ''lowercase letter expected''!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-chars'' stamp: ''lr 8/25/2010 11:04''!!
+tab
+	^ self char: Character tab message: ''tab expected''!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-chars'' stamp: ''lr 8/25/2010 11:06''!!
+chars: aCollection message: aString
+	^ self on: (PPCharSetPredicate on: [ :char | aCollection includes: char ]) message: aString!! !!
+
+!!PPPredicateObjectParser class methodsFor: ''factory-chars'' stamp: ''lr 8/25/2010 10:57''!!
+char: aCharacter message: aString
+	^ self expect: aCharacter message: aString!! !!
+
+
+PPPredicateParser subclass: #PPPredicateSequenceParser
+	instanceVariableNames: ''size''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPPredicateSequenceParser commentStamp: ''<historical>'' prior: 0!!
+A parser that accepts if a given predicate on an arbitrary number of elements of the input sequence holds.
+
+Instance Variables:
+	size	<Integer>	The number of elements to consume.!!
+
+
+!!PPPredicateSequenceParser methodsFor: ''*petitanalyzer-matching'' stamp: ''lr 6/18/2010 14:09''!!
+match: aParser inContext: aDictionary seen: anIdentitySet
+	^ (super match: aParser inContext: aDictionary seen: anIdentitySet) and: [ self size = aParser size ]!! !!
+
+
+!!PPPredicateSequenceParser methodsFor: ''operators'' stamp: ''lr 6/12/2010 09:14''!!
+negate
+	"Answer a parser that is the negation of the receiving predicate parser."
+	
+	^ self class 
+		on: negated message: negatedMessage
+		negated: predicate message: predicateMessage
+		size: size!! !!
+
+
+!!PPPredicateSequenceParser methodsFor: ''pp-context'' stamp: ''JanKurs 8/19/2014 17:03''!!
+parseOn: aPPContext
+	| position result |
+	position := aPPContext remember.
+	result := aPPContext stream next: size.
+	(result size = size and: [ predicate value: result ])
+		ifTrue: [ ^ result ].
+	aPPContext restore: position.
+	^ PPFailure message: predicateMessage context: aPPContext!! !!
+
+
+!!PPPredicateSequenceParser methodsFor: ''accessing'' stamp: ''lr 6/12/2010 08:58''!!
+size
+	"Answer the sequence size of the receiver."
+
+	^ size!! !!
+
+
+!!PPPredicateSequenceParser methodsFor: ''initialization'' stamp: ''lr 6/12/2010 09:13''!!
+initializeOn: aBlock message: aString negated: aNegatedBlock message: aNegatedString size: anInteger
+	predicate := aBlock.
+	predicateMessage := aString.
+	negated := aNegatedBlock.
+	negatedMessage := aNegatedString.
+	size := anInteger !! !!
+
+"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!!
+
+PPPredicateSequenceParser class
+	instanceVariableNames: ''''!!
+!!PPPredicateSequenceParser class commentStamp: ''<historical>'' prior: 0!!
+!!
+
+
+!!PPPredicateSequenceParser class methodsFor: ''instance creation'' stamp: ''lr 6/12/2010 09:14''!!
+on: aBlock message: aString negated: aNegatedBlock message: aNegatedString size: anInteger 
+	^ self new initializeOn: aBlock message: aString negated: aNegatedBlock message: aNegatedString size: anInteger!! !!
+
+!!PPPredicateSequenceParser class methodsFor: ''instance creation'' stamp: ''lr 6/12/2010 09:14''!!
+on: aBlock message: aString size: anInteger
+	^ self on: aBlock message: aString negated: [ :each | (aBlock value: each) not ] message: ''no '' , aString size: anInteger !! !!
+
+
+PPParser subclass: #PPDelegateParser
+	instanceVariableNames: ''parser''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPDelegateParser commentStamp: ''<historical>'' prior: 0!!
+A parser that delegates to another parser.
+
+Instance Variables:
+	parser	<PPParser>	The parser to delegate to.!!
+
+
+!!PPDelegateParser methodsFor: ''accessing'' stamp: ''lr 10/21/2009 16:37''!!
+children
+	^ Array with: parser!! !!
+
+
+!!PPDelegateParser methodsFor: ''*petitanalyzer-transforming'' stamp: ''lr 4/13/2010 09:39''!!
+replace: aParser with: anotherParser
+	super replace: aParser with: anotherParser.
+	parser == aParser ifTrue: [ parser := anotherParser ]!! !!
+
+
+!!PPDelegateParser methodsFor: ''pp-context'' stamp: ''JanKurs 11/11/2013 09:31''!!
+parseOn: aPPContext
+	^ parser parseOn: aPPContext!! !!
+
+
+!!PPDelegateParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/9/2009 14:27''!!
+exampleOn: aStream
+	parser exampleOn: aStream!! !!
+
+!!PPDelegateParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/13/2009 14:20''!!
+displayDescription
+	^ nil!! !!
+
+
+!!PPDelegateParser methodsFor: ''initialization'' stamp: ''lr 4/20/2008 16:23''!!
+setParser: aParser
+	parser := aParser!! !!
+
+
+!!PPDelegateParser methodsFor: ''*petitgui-morphic'' stamp: ''lr 11/18/2009 11:21''!!
+morphicShapeSeen: aSet depth: anInteger
+	^ self morphicShapeSeen: aSet depth: anInteger do: [ :cc |
+		self displayDescription isNil
+			ifTrue: [ cc value: parser ]
+			ifFalse: [
+				self newRowMorph
+					addMorphBack: (self newColumnMorph
+						addMorphBack: (self newSpacerMorph height: 10);
+						addMorphBack: (LineMorph from: 0 @ 0 to: 20 @ 0 color: Color black width: 1);
+						yourself);
+					addMorphBack: (self newRowMorph
+						color: (self backgroundForDepth: anInteger);
+						addMorphBack: (self newColumnMorph
+							addMorphBack: (cc value: parser);
+							addMorphBack: (self newRowMorph
+								hResizing: #spaceFill;
+								addMorphBack: (self newSpacerMorph
+									width: 20;
+									yourself);
+								addMorphBack: (self newColumnMorph
+									hResizing: #spaceFill;
+									listCentering: #center;
+									addMorphBack: (self newSpacerMorph);
+									addMorphBack: (StringMorph new
+										contents: self displayDescription;
+										yourself);
+									yourself);
+								yourself);
+							yourself);		
+						addMorphBack: (self newColumnMorph
+							addMorphBack: (self newSpacerMorph height: 10);
+							addMorphBack: (LineMorph from: 0 @ 0 to: 20 @ 0 color: Color black width: 1);
+							yourself);
+						yourself);
+					yourself ] ]!! !!
+
+"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!!
+
+PPDelegateParser class
+	instanceVariableNames: ''''!!
+!!PPDelegateParser class commentStamp: ''<historical>'' prior: 0!!
+!!
+
+
+!!PPDelegateParser class methodsFor: ''instance creation'' stamp: ''lr 4/20/2008 16:22''!!
+on: aParser
+	^ self new setParser: aParser!! !!
+
+
+PPDelegateParser subclass: #PPAndParser
+	instanceVariableNames: ''''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPAndParser commentStamp: ''TudorGirba 2/27/2011 22:22'' prior: 0!!
+The and-predicate, a parser that succeeds whenever its delegate does, but does not consume the input stream [Parr 1994, 1995].!!
+
+
+!!PPAndParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 5/1/2010 16:16''!!
+exampleOn: aStream!! !!
+
+!!PPAndParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/13/2009 14:17''!!
+displayDescription
+	^ ''and''!! !!
+
+
+!!PPAndParser methodsFor: ''operators'' stamp: ''lr 5/1/2010 16:16''!!
+and
+	^ self!! !!
+
+
+!!PPAndParser methodsFor: ''pp-context'' stamp: ''JanKurs 1/15/2014 15:50''!!
+parseOn: aPPContext
+	| element position |
+	position := aPPContext remember.
+	element := parser parseOn: aPPContext.
+	aPPContext restore: position.
+	^ element!! !!
+
+
+PPDelegateParser subclass: #PPTrimmingParser
+	instanceVariableNames: ''trimmer''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPTrimmingParser commentStamp: ''lr 4/6/2010 19:27'' prior: 0!!
+A parser that silently consumes spaces before and after the delegate parser.!!
+
+
+!!PPTrimmingParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 4/14/2010 20:48''!!
+exampleOn: aStream
+	super exampleOn: aStream.
+	aStream nextPut: Character space!! !!
+
+
+!!PPTrimmingParser methodsFor: ''pp-context'' stamp: ''JanKurs 1/15/2014 15:42''!!
+parseOn: aPPContext
+	| position element |
+	position := aPPContext remember.
+	[ (trimmer parseOn: aPPContext) isPetitFailure ]
+		whileFalse.
+	element := parser parseOn: aPPContext.
+	element isPetitFailure ifTrue: [
+		aPPContext restore: position.
+		^ element ].
+	[ (trimmer parseOn: aPPContext) isPetitFailure ]
+		whileFalse.
+	^ element!! !!
+
+
+!!PPTrimmingParser methodsFor: ''initialization'' stamp: ''lr 7/31/2010 12:00''!!
+setTrimmer: aParser
+	trimmer := aParser!! !!
+
+"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!!
+
+PPTrimmingParser class
+	instanceVariableNames: ''''!!
+!!PPTrimmingParser class commentStamp: ''<historical>'' prior: 0!!
+!!
+
+
+!!PPTrimmingParser class methodsFor: ''instance creation'' stamp: ''lr 7/31/2010 12:01''!!
+on: aParser trimmer: aTrimParser
+	^ self new
+		setParser: aParser;
+		setTrimmer: aTrimParser;
+		yourself!! !!
+
+
+PPDelegateParser subclass: #PPMemoizedParser
+	instanceVariableNames: ''buffer context''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPMemoizedParser commentStamp: ''<historical>'' prior: 0!!
+A memoized parser, for refraining redundant computations.
+
+Instance Variables:
+	stream	<PositionableStream>	The stream of the associated memento objects.
+	buffer	<Array of: PPMemento>	The buffer of memento objects.
+!!
+
+
+!!PPMemoizedParser methodsFor: ''operators'' stamp: ''lr 4/2/2009 19:48''!!
+memoized
+	"Ther is no point in memoizing more than once."
+
+	^ self!! !!
+
+
+!!PPMemoizedParser methodsFor: ''pp-context'' stamp: ''JanKurs 8/19/2014 13:20''!!
+reset: aPPContext
+	context := aPPContext.
+	buffer := Dictionary new.!! !!
+
+!!PPMemoizedParser methodsFor: ''pp-context'' stamp: ''JanKurs 8/19/2014 17:00''!!
+parseOn: aPPContext
+	| memento contextMemento  aStream |
+	"TODO: JK memoizing needs review!!!!"
+	
+	contextMemento := aPPContext remember.
+	context == aPPContext
+		ifFalse: [ self reset: aPPContext ].
+	memento := (buffer at: contextMemento ifAbsentPut: [ PPMemento new ]).
+	
+	memento contextMemento isNil
+		ifTrue: [
+			aStream := aPPContext stream.
+			memento result: (aStream size - aStream position + 2 < memento count
+				ifTrue: [ PPFailure message: ''overflow'' context: aPPContext ]
+				ifFalse: [ memento increment. parser parseOn: aPPContext ]).
+			memento contextMemento: aPPContext remember ]
+		ifFalse: [ context restore: memento contextMemento ].
+	^ memento result.!! !!
+
+
+PPDelegateParser subclass: #PPEndOfInputParser
+	instanceVariableNames: ''''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPEndOfInputParser commentStamp: ''lr 4/18/2008 13:46'' prior: 0!!
+A parser that succeeds only at the end of the input stream.!!
+
+
+!!PPEndOfInputParser methodsFor: ''pp-context'' stamp: ''JanKurs 8/19/2014 16:58''!!
+parseOn: aPPContext
+	| position result |
+	position := aPPContext remember.
+	result := parser parseOn: aPPContext.
+	(result isPetitFailure or: [ aPPContext stream atEnd ])
+		ifTrue: [ ^ result ].
+	result := PPFailure
+		message: ''end of input expected''
+		context: aPPContext.
+	aPPContext restore: position.
+	^ result!! !!
+
+
+!!PPEndOfInputParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/13/2009 14:18''!!
+displayDescription
+	^ ''end of input''!! !!
+
+
+!!PPEndOfInputParser methodsFor: ''operators'' stamp: ''lr 12/7/2009 08:53''!!
+end
+	^ self!! !!
+
+
+PPDelegateParser subclass: #PPActionParser
+	instanceVariableNames: ''block''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPActionParser commentStamp: ''<historical>'' prior: 0!!
+A parser that performs an action block with the successful parse result of the delegate.
+
+Instance Variables:
+	block	<BlockClosure>	The action block to be executed.
+!!
+
+
+!!PPActionParser methodsFor: ''initialization'' stamp: ''lr 5/2/2010 16:58''!!
+setBlock: aBlock
+	block := aBlock!! !!
+
+
+!!PPActionParser methodsFor: ''*petitgui-mondrian'' stamp: ''AlexandreBergel 12/18/2013 16:41''!!
+visualizationGraphType
+	^ ''[]''!! !!
+
+
+!!PPActionParser methodsFor: ''pp-context'' stamp: ''JanKurs 11/11/2013 09:31''!!
+parseOn: aPPContext
+	| element |
+	^ (element := parser parseOn: aPPContext) isPetitFailure
+		ifFalse: [ block value: element ]
+		ifTrue: [ element ]!! !!
+
+
+!!PPActionParser methodsFor: ''accessing'' stamp: ''lr 4/30/2010 11:10''!!
+block
+	"Answer the action block of the receiver."
+
+	^ block!! !!
+
+
+!!PPActionParser methodsFor: ''*petitanalyzer-matching'' stamp: ''lr 5/7/2011 15:08''!!
+match: aParser inContext: aDictionary seen: anIdentitySet
+	^ (super match: aParser inContext: aDictionary seen: anIdentitySet) and: [ self block = aParser block ]!! !!
+
+"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!!
+
+PPActionParser class
+	instanceVariableNames: ''''!!
+!!PPActionParser class commentStamp: ''<historical>'' prior: 0!!
+!!
+
+
+!!PPActionParser class methodsFor: ''instance creation'' stamp: ''lr 5/2/2010 16:58''!!
+on: aParser block: aBlock
+	^ (self on: aParser) setBlock: aBlock!! !!
+
+
+PPActionParser subclass: #PPWrappingParser
+	instanceVariableNames: ''''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPWrappingParser commentStamp: ''<historical>'' prior: 0!!
+A parser that performs an action block upon activation with the stream and a continuation block.!!
+
+
+!!PPWrappingParser methodsFor: ''pp-context'' stamp: ''JanKurs 11/11/2013 09:31''!!
+parseOn: aPPContext
+	^ block value: aPPContext value: [ parser parseOn: aPPContext ]!! !!
+
+
+PPParser subclass: #PPListParser
+	instanceVariableNames: ''parsers''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPListParser commentStamp: ''<historical>'' prior: 0!!
+Abstract parser that parses a list of things in some way (to be specified by the subclasses).
+
+Instance Variables:
+	parsers	<SequenceableCollection of: PPParser>	A sequence of other parsers to delegate to.!!
+
+
+!!PPListParser methodsFor: ''*petitanalyzer-matching'' stamp: ''lr 4/30/2010 08:15''!!
+copyInContext: aDictionary seen: aSeenDictionary
+	| copy copies |
+	aSeenDictionary at: self ifPresent: [ :value | ^ value ].
+	copy := aSeenDictionary at: self put: self copy.
+	copies := OrderedCollection new.
+	parsers do: [ :each |
+		| result |
+		result := each 
+			copyInContext: aDictionary
+			seen: aSeenDictionary.
+		result isCollection
+			ifTrue: [ copies addAll: result ]
+			ifFalse: [ copies add: result ] ].
+	^ copy
+		setParsers: copies;
+		yourself!! !!
+
+
+!!PPListParser methodsFor: ''*petitanalyzer-transforming'' stamp: ''lr 5/22/2010 10:24''!!
+replace: aParser with: anotherParser
+	super replace: aParser with: anotherParser.
+	parsers keysAndValuesDo: [ :index :parser |
+		parser == aParser
+			ifTrue: [ parsers at: index put: anotherParser ] ]!! !!
+
+
+!!PPListParser methodsFor: ''initialization'' stamp: ''lr 4/29/2010 10:12''!!
+setParsers: aCollection
+	parsers := aCollection asArray!! !!
+
+!!PPListParser methodsFor: ''initialization'' stamp: ''lr 4/29/2010 10:12''!!
+initialize
+	super initialize.
+	self setParsers: #()!! !!
+
+
+!!PPListParser methodsFor: ''accessing'' stamp: ''lr 10/21/2009 16:37''!!
+children
+	^ parsers!! !!
+
+
+!!PPListParser methodsFor: ''copying'' stamp: ''lr 9/17/2008 22:36''!!
+copyWith: aParser
+	^ self species withAll: (parsers copyWith: aParser)!! !!
+
+!!PPListParser methodsFor: ''copying'' stamp: ''lr 5/22/2010 10:26''!!
+postCopy
+	super postCopy.
+	parsers := parsers copy!! !!
+
+"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!!
+
+PPListParser class
+	instanceVariableNames: ''''!!
+!!PPListParser class commentStamp: ''<historical>'' prior: 0!!
+!!
+
+
+!!PPListParser class methodsFor: ''instance creation'' stamp: ''lr 9/23/2008 18:32''!!
+with: aFirstParser with: aSecondParser
+	^ self withAll: (Array with: aFirstParser with: aSecondParser)!! !!
+
+!!PPListParser class methodsFor: ''instance creation'' stamp: ''lr 5/3/2010 20:26''!!
+with: aParser
+	^ self withAll: (Array with: aParser)!! !!
+
+!!PPListParser class methodsFor: ''instance creation'' stamp: ''lr 4/29/2010 10:12''!!
+withAll: aCollection
+	^ self basicNew setParsers: aCollection!! !!
+
+
+PPListParser subclass: #PPChoiceParser
+	instanceVariableNames: ''''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPChoiceParser commentStamp: ''lr 4/18/2008 15:35'' prior: 0!!
+A parser that uses the first parser that succeeds.!!
+
+
+!!PPChoiceParser methodsFor: ''*petitgui-mondrian'' stamp: ''AlexandreBergel 12/18/2013 16:42''!!
+visualizationGraphType
+	^ ''/''!! !!
+
+
+!!PPChoiceParser methodsFor: ''operators'' stamp: ''lr 9/17/2008 00:16''!!
+/ aRule 
+	^ self copyWith: aRule!! !!
+
+
+!!PPChoiceParser methodsFor: ''pp-context'' stamp: ''JanKurs 11/11/2013 09:31''!!
+parseOn: aPPContext
+	"This is optimized code that avoids unnecessary block activations, do not change. When all choices fail, the last failure is answered."
+
+	| element |
+	1 to: parsers size do: [ :index |
+		element := (parsers at: index)
+			parseOn: aPPContext.
+		element isPetitFailure
+			ifFalse: [ ^ element ] ].
+	^ element!! !!
+
+
+!!PPChoiceParser methodsFor: ''*petitgui-morphic'' stamp: ''lr 5/2/2010 20:15''!!
+exampleOn: aStream
+	"If there is already a lot written, try to pick an empty possiblity."
+	
+	aStream position > 512 ifTrue: [
+		(parsers anySatisfy: [ :each | each isNullable ])
+			ifTrue: [ ^ self ] ].
+	parsers atRandom exampleOn: aStream!! !!
+
+!!PPChoiceParser methodsFor: ''*petitgui-morphic'' stamp: ''lr 11/18/2009 11:14''!!
+morphicShapeSeen: aSet depth: anInteger
+	^ self morphicShapeSeen: aSet depth: anInteger do: [ :cc |
+		| morph |
+		morph := self newColumnMorph 
+			cellInset: 5;
+			yourself.
+		self children do: [ :each | 
+			morph addMorphBack: (self newRowMorph
+				hResizing: #spaceFill;
+				addMorphBack: (cc value: each);
+				addMorphBack: (self newColumnMorph
+					hResizing: #spaceFill;
+					addMorphBack: (self newSpacerMorph height: 10);
+					addMorphBack: ((LineMorph from: 0 @ 0 to: 20 @ 0 color: Color black width: 1)
+						hResizing: #spaceFill;
+						minWidth: 20;
+						yourself);
+					yourself);
+				yourself) ].
+		morph fullBounds.
+		self newRowMorph
+			addMorphBack: (self newColumnMorph
+				addMorphBack: (self newSpacerMorph height: 10);
+				addMorphBack: (LineMorph from: 0 @ 0 to: 20 @ 0 color: Color black width: 1);
+				yourself);
+			addMorphBack: (self newColumnMorph
+				addMorphBack: (self newSpacerMorph width: 1; height: 10);
+				addMorphBack: (LineMorph from: 0 @ 0 to: 0 @ (morph height - 23) color: Color black width: 1);
+				yourself);
+			addMorphBack: morph;
+			addMorphBack: (self newColumnMorph
+				addMorphBack: (self newSpacerMorph width: 1; height: 10);
+				addMorphBack: (LineMorph from: 0 @ (morph height - 23) to: 0 @ 0 color: Color black width: 1)
+					makeForwardArrow;
+					width: 1;
+				yourself);
+			yourself ]!! !!
+
+
+PPDelegateParser subclass: #PPNotParser
+	instanceVariableNames: ''''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPNotParser commentStamp: ''<historical>'' prior: 0!!
+The not-predicate, a parser that succeeds whenever its delegate does not, but consumes no input [Parr 1994, 1995].!!
+
+
+!!PPNotParser methodsFor: ''*petitanalyzer-testing'' stamp: ''JanKurs 5/31/2013 11:50''!!
+isFirstSetTerminal
+	^ true!! !!
+
+
+!!PPNotParser methodsFor: ''pp-context'' stamp: ''JanKurs 8/19/2014 17:01''!!
+parseOn: aPPContext
+	| element position |
+	position := aPPContext remember.
+	element := parser parseOn: aPPContext.
+	aPPContext restore: position.
+	^ element isPetitFailure
+		ifFalse: [ PPFailure message: '''' context: aPPContext ]!! !!
+
+
+!!PPNotParser methodsFor: ''*petitanalyzer-private'' stamp: ''JanKurs 5/31/2013 11:50''!!
+firstSets: aFirstDictionary into: aSet
+	!! !!
+
+
+!!PPNotParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/11/2009 21:09''!!
+exampleOn: aStream!! !!
+
+!!PPNotParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/13/2009 14:17''!!
+displayDescription
+	^ ''not''!! !!
+
+
+PPLiteralParser subclass: #PPLiteralSequenceParser
+	instanceVariableNames: ''size''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPLiteralSequenceParser commentStamp: ''lr 12/4/2009 18:39'' prior: 0!!
+A parser accepts a sequence of literal objects, such as a String. This is an optimization to avoid having to compose longer sequences from PPSequenceParser.!!
+
+
+!!PPLiteralSequenceParser methodsFor: ''pp-context'' stamp: ''JanKurs 8/19/2014 16:38''!!
+parseOn: aPPContext
+	| memento result |
+	memento := aPPContext remember.
+	result := aPPContext stream next: size.
+	literal = result ifTrue: [ ^ result ].
+	aPPContext restore: memento.
+	^ PPFailure message: message context: aPPContext!! !!
+
+
+!!PPLiteralSequenceParser methodsFor: ''initialization'' stamp: ''lr 6/1/2010 22:21''!!
+initializeOn: anObject message: aString
+	super initializeOn: anObject message: aString.
+	size := literal size!! !!
+
+
+!!PPLiteralSequenceParser methodsFor: ''accessing'' stamp: ''lr 9/15/2010 11:16''!!
+size
+	"Answer the sequence size of the receiver."
+
+	^ size!! !!
+
+
+!!PPLiteralSequenceParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/9/2009 14:25''!!
+exampleOn: aStream
+	aStream nextPutAll: literal!! !!
+
+
+!!PPLiteralSequenceParser methodsFor: ''operators'' stamp: ''lr 8/18/2010 20:16''!!
+caseInsensitive
+	"Answer a parser that can parse the receiver case-insensitive."
+	
+	literal asUppercase = literal asLowercase ifTrue: [ ^ self ].
+	^ PPPredicateSequenceParser on: [ :value | literal sameAs: value ] message: message size: size!! !!
+
+
+PPDelegateParser subclass: #PPOptionalParser
+	instanceVariableNames: ''''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPOptionalParser commentStamp: ''lr 4/3/2011 14:46'' prior: 0!!
+A parser that optionally parsers its delegate, or answers nil.!!
+
+
+!!PPOptionalParser methodsFor: ''*petitanalyzer-testing'' stamp: ''lr 9/1/2010 22:10''!!
+isNullable
+	^ true!! !!
+
+
+!!PPOptionalParser methodsFor: ''*petitgui-mondrian'' stamp: ''AlexandreBergel 12/18/2013 16:44''!!
+visualizationGraphType
+	^ ''?''!! !!
+
+
+!!PPOptionalParser methodsFor: ''pp-context'' stamp: ''JanKurs 3/19/2014 15:12''!!
+parseOn: aPPContext
+	| element |
+	element := parser parseOn: aPPContext.
+	^ element isPetitFailure ifFalse: [ element ]!! !!
+
+
+PPDelegateParser subclass: #PPFlattenParser
+	instanceVariableNames: ''''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPFlattenParser commentStamp: ''lr 11/22/2009 13:09'' prior: 0!!
+A parser that answers a flat copy of the range my delegate parses.!!
+
+
+!!PPFlattenParser methodsFor: ''private'' stamp: ''lr 2/25/2013 23:31''!!
+on: aCollection start: aStartInteger stop: aStopInteger value: anObject
+	^ aCollection copyFrom: aStartInteger to: aStopInteger!! !!
+
+
+!!PPFlattenParser methodsFor: ''pp-context'' stamp: ''JanKurs 1/15/2014 15:42''!!
+parseOn: aPPContext
+	| start element |
+	start := aPPContext stream position.
+	element := parser parseOn: aPPContext.
+	element isPetitFailure ifTrue: [ ^ element ].
+	^ self on: aPPContext stream collection start: start + 1 stop: aPPContext stream position value: element!! !!
+
+
+PPFlattenParser subclass: #PPTokenParser
+	instanceVariableNames: ''tokenClass''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPTokenParser commentStamp: ''lr 2/25/2013 23:31'' prior: 0!!
+A parser that answers a token with the value of my delegate parses.
+
+Instance Variables:
+	tokenClass	<PPToken class>	The token sub-class to be used.!!
+
+
+!!PPTokenParser methodsFor: ''private'' stamp: ''lr 4/6/2010 19:18''!!
+defaultTokenClass
+	^ PPToken!! !!
+
+!!PPTokenParser methodsFor: ''private'' stamp: ''lr 2/25/2013 23:32''!!
+on: aCollection start: aStartInteger stop: aStopInteger value: anObject
+	^ self tokenClass on: aCollection start: aStartInteger stop: aStopInteger value: anObject!! !!
+
+
+!!PPTokenParser methodsFor: ''initialization'' stamp: ''lr 4/6/2010 19:19''!!
+initialize
+	tokenClass := self defaultTokenClass
+	!! !!
+
+
+!!PPTokenParser methodsFor: ''accessing'' stamp: ''lr 4/6/2010 19:23''!!
+tokenClass
+	^ tokenClass!! !!
+
+!!PPTokenParser methodsFor: ''accessing'' stamp: ''lr 4/6/2010 19:24''!!
+tokenClass: aTokenClass
+	tokenClass := aTokenClass!! !!
+
+
+!!PPTokenParser methodsFor: ''*petitanalyzer-matching'' stamp: ''lr 6/18/2010 14:09''!!
+match: aParser inContext: aDictionary seen: anIdentitySet
+	^ (super match: aParser inContext: aDictionary seen: anIdentitySet) and: [ self tokenClass = aParser tokenClass ]!! !!
+
+
+PPDelegateParser subclass: #PPRepeatingParser
+	instanceVariableNames: ''min max''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPRepeatingParser commentStamp: ''lr 4/3/2011 14:45'' prior: 0!!
+An abstract parser that repeatedly parses between ''min'' and ''max'' instances of its delegate. The default configuration parses an infinite number of elements, as ''min'' is set to 0 and ''max'' to infinity (SmallInteger maxVal).
+
+Instance Variables:
+	min	<Integer>	The minimum number of repetitions.
+	max	<Integer>	The maximum number of repetitions.!!
+
+
+!!PPRepeatingParser methodsFor: ''*petitanalyzer-matching'' stamp: ''lr 6/18/2010 14:09''!!
+match: aParser inContext: aDictionary seen: anIdentitySet
+	^ (super match: aParser inContext: aDictionary seen: anIdentitySet) and: [ self min = aParser min and: [ self max = aParser max ] ]!! !!
+
+
+!!PPRepeatingParser methodsFor: ''initialization'' stamp: ''lr 4/1/2011 21:00''!!
+setMax: anInteger
+	max := anInteger!! !!
+
+!!PPRepeatingParser methodsFor: ''initialization'' stamp: ''lr 4/1/2011 21:01''!!
+setMin: anInteger
+	min := anInteger!! !!
+
+!!PPRepeatingParser methodsFor: ''initialization'' stamp: ''lr 4/1/2011 21:06''!!
+initialize
+	super initialize.
+	self setMin: 0; setMax: SmallInteger maxVal!! !!
+
+
+!!PPRepeatingParser methodsFor: ''accessing'' stamp: ''lr 4/30/2010 11:08''!!
+max
+	"Answer the maximum number of repetitions."
+
+	^ max!! !!
+
+!!PPRepeatingParser methodsFor: ''accessing'' stamp: ''lr 4/30/2010 11:08''!!
+min
+	"Answer the minimum number of repetitions."
+	
+	^ min!! !!
+
+
+!!PPRepeatingParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/11/2009 20:57''!!
+exampleOn: aStream
+	"Perform the minimal repeatitions required, and a random amount of more if possible and if not that much output has been produced yet."
+	
+	min timesRepeat: [ 
+		super exampleOn: aStream ].
+	(max - min min: 5) atRandom timesRepeat: [
+		aStream position > 512
+			ifTrue: [ ^ self ].
+		super exampleOn: aStream ]!! !!
+
+!!PPRepeatingParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/13/2009 14:18''!!
+displayDescription
+	^ String streamContents: [ :stream |
+		min = 0 
+			ifFalse: [ stream print: min; nextPutAll: ''..'' ].
+		max = SmallInteger maxVal
+			ifTrue: [ stream nextPut: $* ]
+			ifFalse: [ stream print: max ] ]!! !!
+
+
+!!PPRepeatingParser methodsFor: ''*petitanalyzer-testing'' stamp: ''lr 10/21/2009 12:13''!!
+isNullable
+	^ min = 0!! !!
+
+
+!!PPRepeatingParser methodsFor: ''*petitanalyzer-private'' stamp: ''JanKurs 5/31/2013 11:51''!!
+followSets: aFollowDictionary firstSets: aFirstDictionary into: aSet
+	| firstSet |
+	super followSets: aFollowDictionary firstSets:  aFirstDictionary into: aSet.
+	
+	firstSet := aFirstDictionary at: self.
+	self children do: [:p | (aFollowDictionary at: p) addAll: (firstSet reject: [:each | each isNullable]) ]!! !!
+
+
+!!PPRepeatingParser methodsFor: ''*petitgui-mondrian'' stamp: ''AlexandreBergel 12/18/2013 16:44''!!
+visualizationGraphType
+	^ ''*''!! !!
+
+
+!!PPRepeatingParser methodsFor: ''printing'' stamp: ''lr 6/3/2010 14:00''!!
+printOn: aStream
+	super printOn: aStream.
+	aStream nextPutAll: '' [''; print: min; nextPutAll: '', ''; nextPutAll: (max = SmallInteger maxVal
+		ifTrue: [ ''*'' ] ifFalse: [ max printString ]); nextPut: $]!! !!
+
+
+PPRepeatingParser subclass: #PPPossessiveRepeatingParser
+	instanceVariableNames: ''''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPPossessiveRepeatingParser commentStamp: ''lr 4/3/2011 14:35'' prior: 0!!
+The default repeating parser with standard PEG semantics (i.e. possessive, blind, eager).!!
+
+
+!!PPPossessiveRepeatingParser methodsFor: ''pp-context'' stamp: ''JanKurs 1/15/2014 15:43''!!
+parseOn: aPPContext
+	| start element elements |
+	start := aPPContext remember.
+	elements := OrderedCollection new.
+	[ elements size < min ] whileTrue: [
+		(element := parser parseOn: aPPContext) isPetitFailure ifTrue: [
+			aPPContext restore: start.
+			^ element ].
+		elements addLast: element ].
+	[ elements size < max ] whileTrue: [
+	 	(element := parser parseOn: aPPContext) isPetitFailure
+			ifTrue: [ ^ elements asArray ].
+		elements addLast: element ].
+	^ elements asArray!! !!
+
+
+PPRepeatingParser subclass: #PPLimitedRepeatingParser
+	instanceVariableNames: ''limit''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPLimitedRepeatingParser commentStamp: ''lr 4/3/2011 14:37'' prior: 0!!
+An abstract parser that repeatedly parses between ''min'' and ''max'' instances of my delegate and that requires the input to be completed with a specified parser ''limit''. Subclasses provide repeating behavior as typically seen in regular expression implementations (non-blind).
+
+Instance Variables:
+	limit	<PPParser>	The parser to complete the input with.!!
+
+
+!!PPLimitedRepeatingParser methodsFor: ''*petitanalyzer-transforming'' stamp: ''lr 4/4/2011 18:46''!!
+replace: aParser with: anotherParser
+	super replace: aParser with: anotherParser.
+	limit == aParser ifTrue: [ limit := anotherParser ]!! !!
+
+
+!!PPLimitedRepeatingParser methodsFor: ''initialization'' stamp: ''lr 4/2/2011 10:00''!!
+setLimit: aParser
+	limit := aParser!! !!
+
+
+!!PPLimitedRepeatingParser methodsFor: ''accessing'' stamp: ''lr 4/4/2011 18:46''!!
+children
+	^ Array with: parser with: limit!! !!
+
+!!PPLimitedRepeatingParser methodsFor: ''accessing'' stamp: ''lr 4/2/2011 10:00''!!
+limit
+	"Answer the parser that limits (or ends) this repetition."
+	
+	^ limit!! !!
+
+
+!!PPLimitedRepeatingParser methodsFor: ''pp-context'' stamp: ''JanKurs 1/15/2014 16:04''!!
+matchesLimitOn: aPPContext
+	| element position |
+	position := aPPContext remember.
+	element := limit parseOn: aPPContext.
+	aPPContext restore: position.
+	^ element isPetitFailure not!! !!
+
+"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!!
+
+PPLimitedRepeatingParser class
+	instanceVariableNames: ''''!!
+!!PPLimitedRepeatingParser class commentStamp: ''<historical>'' prior: 0!!
+!!
+
+
+!!PPLimitedRepeatingParser class methodsFor: ''instance creation'' stamp: ''lr 4/3/2011 14:58''!!
+on: aParser limit: aLimitParser
+	^ (self on: aParser) setLimit: aLimitParser!! !!
+
+
+PPLimitedRepeatingParser subclass: #PPGreedyRepeatingParser
+	instanceVariableNames: ''''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPGreedyRepeatingParser commentStamp: ''lr 4/3/2011 15:08'' prior: 0!!
+A greedy repeating parser, commonly seen in regular expression implementations. It aggressively consumes as much input as possible and then backtracks to meet the ''limit'' condition.
+
+This class essentially implements the iterative version of the following recursive parser composition:
+
+	| parser |
+	parser := PPChoiceParser new.
+	parser setParsers: (Array
+		with: (self , parser map: [ :each :rest | rest addFirst: each; yourself ])
+		with: (limit and ==> [ :each | OrderedCollection new ])).
+	^ parser ==> [ :rest | rest asArray ]!!
+
+
+!!PPGreedyRepeatingParser methodsFor: ''pp-context'' stamp: ''JanKurs 8/19/2014 16:59''!!
+parseOn: aPPContext
+	| start element elements positions |
+	start := aPPContext remember.
+	elements := OrderedCollection new.
+	[ elements size < min ] whileTrue: [ 
+		(element := parser parseOn: aPPContext) isPetitFailure ifTrue: [ 
+			aPPContext restore: start.
+			^ element ].
+		elements addLast: element ].
+	positions := OrderedCollection with: aPPContext remember.
+	[ elements size < max and: [ (element := parser parseOn: aPPContext) isPetitFailure not ] ] whileTrue: [
+		elements addLast: element.
+		positions addLast: aPPContext remember ].
+	[ positions isEmpty ] whileFalse: [
+		aPPContext restore: positions last.
+		element := limit parseOn: aPPContext.
+		element isPetitFailure ifFalse: [
+			aPPContext restore: positions last.
+			^ elements asArray ].
+		elements isEmpty ifTrue: [
+			aPPContext restore: start.
+			^ element ].
+		elements removeLast.
+		positions removeLast ].
+	aPPContext restore: start.
+	^ PPFailure message: ''overflow'' context: aPPContext at: start!! !!
+
+
+PPParser subclass: #PPEpsilonParser
+	instanceVariableNames: ''''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPEpsilonParser commentStamp: ''lr 5/15/2008 15:09'' prior: 0!!
+A parser that consumes nothing and always succeeds.!!
+
+
+!!PPEpsilonParser methodsFor: ''*petitanalyzer-testing'' stamp: ''lr 10/21/2009 12:11''!!
+isNullable
+	^ true!! !!
+
+
+!!PPEpsilonParser methodsFor: ''*petitgui-morphic'' stamp: ''lr 11/18/2009 11:15''!!
+morphicShapeSeen: aSet depth: anInteger
+	^ self morphicShapeSeen: aSet depth: anInteger do: [ :cc |
+		self newRowMorph
+			addMorphBack: (self newColumnMorph
+				addMorphBack: (self newSpacerMorph height: 10);
+				addMorphBack: (LineMorph from: 0 @ 0 to: 20 @ 0 color: Color black width: 1);
+				yourself);
+			yourself ]!! !!
+
+
+!!PPEpsilonParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/6/2009 18:42''!!
+displayName
+	^ ''epsilon''!! !!
+
+
+!!PPEpsilonParser methodsFor: ''parsing'' stamp: ''lr 2/7/2010 20:49''!!
+parseOn: aStream
+	^ nil!! !!
+
+
+PPLimitedRepeatingParser subclass: #PPLazyRepeatingParser
+	instanceVariableNames: ''''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPLazyRepeatingParser commentStamp: ''lr 4/3/2011 15:08'' prior: 0!!
+A lazy repeating parser, commonly seen in regular expression implementations. It limits its consumption to meet the ''limit'' condition as early as possible.
+
+This class essentially implements the iterative version of the following recursive parser composition:
+
+	| parser |
+	parser := PPChoiceParser new.
+	parser setParsers: (Array
+		with: (limit and ==> [ :each | OrderedCollection new ])
+		with: (self , parser map: [ :each :rest | rest addFirst: each; yourself ])).
+	^ parser ==> [ :rest | rest asArray ]!!
+
+
+!!PPLazyRepeatingParser methodsFor: ''pp-context'' stamp: ''JanKurs 8/19/2014 17:00''!!
+parseOn: aPPContext
+	| start element elements |
+	start := aPPContext remember.
+	elements := OrderedCollection new.
+	[ elements size < min ] whileTrue: [
+		(element := parser parseOn: aPPContext) isPetitFailure ifTrue: [
+			aPPContext restore: start.
+			^ element ].
+		elements addLast: element ].
+	[ self matchesLimitOn: aPPContext ] whileFalse: [
+		elements size < max ifFalse: [
+			aPPContext restore: start.
+			^ PPFailure message: ''overflow'' context: aPPContext at: start ].
+		element := parser parseOn: aPPContext.
+		element isPetitFailure ifTrue: [
+			aPPContext restore: start.
+			^ element ].
+		elements addLast: element ].
+	^ elements asArray!! !!
+
+
+PPListParser subclass: #PPSequenceParser
+	instanceVariableNames: ''''
+	classVariableNames: ''''
+	poolDictionaries: ''''
+	category: ''PetitParser-Parsers''!!
+!!PPSequenceParser commentStamp: ''lr 4/18/2008 15:34'' prior: 0!!
+A parser that parses a sequence of parsers.!!
+
+
+!!PPSequenceParser methodsFor: ''operators-mapping'' stamp: ''lr 5/6/2011 20:27''!!
+map: aBlock
+	^ aBlock numArgs = self children size
+		ifTrue: [ self ==> [ :nodes | aBlock valueWithArguments: nodes ] ]
+		ifFalse: [ self error: aBlock numArgs asString , '' arguments expected.'' ]!! !!
+
+!!PPSequenceParser methodsFor: ''operators-mapping'' stamp: ''lr 1/8/2010 12:01''!!
+permutation: anArrayOfIntegers
+	"Answer a permutation of the receivers sequence."
+	
+	anArrayOfIntegers do: [ :index |
+		(index isInteger and: [ index between: 1 and: parsers size ])
+			ifFalse: [ self error: ''Invalid permutation index: '' , index printString ] ].
+	^ self ==> [ :nodes | anArrayOfIntegers collect: [ :index | nodes at: index ] ]!! !!
+
+
+!!PPSequenceParser methodsFor: ''*petitgui-morphic'' stamp: ''lr 11/17/2009 21:54''!!
+morphicShapeSeen: aSet depth: anInteger
+	^ self morphicShapeSeen: aSet depth: anInteger do: [ :cc |
+		self children
+			inject: self newRowMorph
+			into: [ :result :each | 
+				result 
+					addMorphBack: (cc value: each);
+					yourself ] ]!! !!
+
+
+!!PPSequenceParser methodsFor: ''*petitgui-accessing'' stamp: ''lr 11/9/2009 14:24''!!
+exampleOn: aStream
+	parsers do: [ :each | each exampleOn: aStream ]!! !!
+
+
+!!PPSequenceParser methodsFor: ''pp-context'' stamp: ''JanKurs 11/11/2013 09:43''!!
+parseOn: aPPContext
+	"This is optimized code that avoids unnecessary block activations, do not change."
+	
+	| start elements element |
+	start := aPPContext remember.
+	elements := Array new: parsers size.
+	1 to: parsers size do: [ :index |
+		element := (parsers at: index) 
+			parseOn: aPPContext.