Fixed code generation for deterministic choice w.r.t inlining
For PPCDeterministicChoiceNode generate code in form
if ()
else if ()
else if ()
else error
instead of sequence of ifs. The former is safe w.r.t inlining.
--- a/compiler/PPCTokenizingCodeGenerator.st Thu May 21 14:43:38 2015 +0100
+++ b/compiler/PPCTokenizingCodeGenerator.st Thu May 21 15:35:26 2015 +0100
@@ -9,6 +9,7 @@
category:'PetitCompiler-Visitors'
!
+
!PPCTokenizingCodeGenerator methodsFor:'accessing'!
guards
@@ -148,10 +149,13 @@
compiler codeStoreValueOf: [ self visit: child ] intoVariable: self retvalVar.
compiler codeReturn: self retvalVar.
compiler dedent.
- compiler add: '].'
+ compiler add: '] ifFalse:['
].
+ compiler codeError: 'no choice found'.
+ node children size timesRepeat: [ compiler add: ']' ].
+ compiler add: '.'.
- compiler codeError: 'no choice found'.
+ "Modified: / 21-05-2015 / 15:31:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
visitTokenChoiceNode: node
@@ -206,3 +210,10 @@
self error: 'shoudl not happend!!'
! !
+!PPCTokenizingCodeGenerator class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+