compiler/tests/PPCCodeGeneratorTest.st
changeset 471 7544e517db96
parent 464 f6d77fee9811
child 481 34ee0d3c72e7
--- a/compiler/tests/PPCCodeGeneratorTest.st	Fri May 22 17:06:30 2015 +0100
+++ b/compiler/tests/PPCCodeGeneratorTest.st	Fri May 22 18:08:30 2015 +0100
@@ -10,6 +10,7 @@
 	category:'PetitCompiler-Tests-Visitors'
 !
 
+
 !PPCCodeGeneratorTest methodsFor:'as yet unclassified'!
 
 context	
@@ -755,6 +756,48 @@
     self assert: parser fail: 'ab'.
 !
 
+testSequenceOptInlined1
+    | a b bOpt |
+
+    a := $a asParser asCompilerNode.
+    b := $b asParser asCompilerNode.
+    bOpt := PPCOptionalNode new
+                child:  b ;
+                markForInline;
+                yourself.
+    node := PPCSequenceNode new
+        children: { a . bOpt };
+        yourself.
+    self compileTree: node.
+    
+    self assert: parser parse: 'ab' to: #($a $b ) end: 2.
+    self assert: parser parse: 'a' to: #( $a nil ) end: 1.
+
+    "Created: / 22-05-2015 / 11:47:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+testSequenceOptInlined2
+    | a b bOpt |
+
+    a := $a asParser asCompilerNode.
+    a markForInline.
+    b := $b asParser asCompilerNode.
+    b markForInline.
+    bOpt := PPCOptionalNode new
+                child:  b ;
+                markForInline;
+                yourself.
+    node := PPCSequenceNode new
+        children: { a . bOpt };
+        yourself.
+    self compileTree: node.
+    
+    self assert: parser parse: 'ab' to: #($a $b ) end: 2.
+    self assert: parser parse: 'a' to: #( $a nil ) end: 1.
+
+    "Created: / 22-05-2015 / 11:47:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 testStarAnyNode
     arguments cacheFirstFollow: false.
     node := PPCStarAnyNode new 
@@ -947,3 +990,10 @@
     self assert: parser parse: '' to: nil.
 ! !
 
+!PPCCodeGeneratorTest class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+