compiler/PPCTokenizingConfiguration.st
changeset 464 f6d77fee9811
child 477 b18b6cc7aabc
child 515 b5316ef15274
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/PPCTokenizingConfiguration.st	Thu May 21 14:12:22 2015 +0100
@@ -0,0 +1,61 @@
+"{ Package: 'stx:goodies/petitparser/compiler' }"
+
+"{ NameSpace: Smalltalk }"
+
+PPCConfiguration subclass:#PPCTokenizingConfiguration
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitCompiler-Core'
+!
+
+!PPCTokenizingConfiguration methodsFor:'compiling'!
+
+invokePhases
+    self toPPCIr.
+    self createTokens.
+    self cacheFirstFollow.
+    self createLL1Choices.
+    self tokenize.
+    self merge.
+    self specialize.
+    self createRecognizingComponents.
+    self specialize.
+    self inline.
+    self merge.
+    self check.	
+    self cacheFirstFollow.
+    self generate.
+! !
+
+!PPCTokenizingConfiguration methodsFor:'hooks'!
+
+codeCompilerOn: args
+    ^ PPCTokenizingCompiler on: args
+!
+
+codeGeneratorVisitorOn: compiler
+    ^ PPCTokenizingCodeGenerator on: compiler
+! !
+
+!PPCTokenizingConfiguration methodsFor:'phases'!
+
+createLL1Choices
+    ir :=  PPCLL1Visitor new
+        arguments: arguments;
+        visit: ir.
+    self remember: #LL1
+!
+
+tokenize
+    "
+        This will try transform the parser into the tokenizing parser
+    "
+    arguments tokenize ifFalse: [ ^ self ] .
+    
+    ir :=  PPCTokenizingVisitor new
+        arguments: arguments;
+        visit: ir.
+    self remember: #tokenize
+! !
+