# HG changeset patch # User Jan Vrany # Date 1432314510 -3600 # Node ID 7544e517db96830ee222469956fb2123434786c0 # Parent f59795ddcd9027d60a973e28df7a532bf0a92710 Added two more tests for inlining diff -r f59795ddcd90 -r 7544e517db96 compiler/tests/PPCCodeGeneratorTest.st --- 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 " +! + +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 " +! + testStarAnyNode arguments cacheFirstFollow: false. node := PPCStarAnyNode new @@ -947,3 +990,10 @@ self assert: parser parse: '' to: nil. ! ! +!PPCCodeGeneratorTest class methodsFor:'documentation'! + +version_HG + + ^ '$Changeset: $' +! ! +