Hi,
the attached patch is fixing parsing of Squeak/Pharo fileouts. There appears
to be another extension (introduced in 2006) that is using ]style[Text! after
a class comment... I will probably try to fix that as well.

holger
>From 33c10740b6bb1a05b253c395a2b8dcabe8c2cc59 Mon Sep 17 00:00:00 2001
From: Holger Hans Peter Freyther <[email protected]>
Date: Sun, 6 Feb 2011 09:49:41 +0100
Subject: [PATCH] stinst: Fix gst-convert regression for squeak sources

The added return tag has broken the conversion from
squeak source. This changes the evaluate to look beyond
the return tag as well.

2011-02-06  Holger Hans Peter Freyther  <[email protected]>

	* tests/stcompiler.ok: Regenerate.
	* tests/stcompiler.st: Add test case.

2011-02-06  Holger Hans Peter Freyther  <[email protected]>

	* STLoader.st: Look through the return statement.
---
 ChangeLog                          |    5 +++++
 packages/stinst/parser/ChangeLog   |    4 ++++
 packages/stinst/parser/STLoader.st |   11 ++++++++---
 tests/stcompiler.ok                |    3 +++
 tests/stcompiler.st                |   13 +++++++++++++
 5 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 387934d..7d5b0ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-02-06  Holger Hans Peter Freyther  <[email protected]>
+
+	* tests/stcompiler.ok: Regenerate.
+	* tests/stcompiler.st: Add test case.
+
 2011-02-05  Holger Hans Peter Freyther  <[email protected]>
 
 	* libgst/cint.c: Propagate type conversion failures.
diff --git a/packages/stinst/parser/ChangeLog b/packages/stinst/parser/ChangeLog
index b28c242..3d3a0d8 100644
--- a/packages/stinst/parser/ChangeLog
+++ b/packages/stinst/parser/ChangeLog
@@ -1,3 +1,7 @@
+2011-02-06  Holger Hans Peter Freyther  <[email protected]>
+
+	* STLoader.st: Look through the return statement.
+
 2010-12-13  Paolo Bonzini  <[email protected]>
 
 	* STFileParser.st: Add return tag to doits, thus fixing
diff --git a/packages/stinst/parser/STLoader.st b/packages/stinst/parser/STLoader.st
index cd3014b..3dd8358 100644
--- a/packages/stinst/parser/STLoader.st
+++ b/packages/stinst/parser/STLoader.st
@@ -99,9 +99,14 @@ evaluate: node
 	inject: false
 	into: [ :old :each |
 	    "We *do not* want short-circuit evaluation here!!"
-            each isMessage
-	        ifTrue: [ old | (self evaluateStatement: each) ]
-	        ifFalse: [ self unknown: each ]
+	    | node |
+	    node := each.
+	    each isReturn
+		ifTrue: [ node := each value ].
+
+	    node isMessage
+		ifTrue: [ old | (self evaluateStatement: node) ]
+		ifFalse: [ self unknown: node ].
         ]
 !
 
diff --git a/tests/stcompiler.ok b/tests/stcompiler.ok
index ea8d77c..a07cebc 100644
--- a/tests/stcompiler.ok
+++ b/tests/stcompiler.ok
@@ -41,3 +41,6 @@ finally, many parameters,
 cascading 
 and block temporaries too! 
 returned value is TextCollector new "<0>"
+
+Execution begins...
+returned value is OrderedSet new: 32 "<0>"
diff --git a/tests/stcompiler.st b/tests/stcompiler.st
index be36eb8..7144867 100644
--- a/tests/stcompiler.st
+++ b/tests/stcompiler.st
@@ -77,3 +77,16 @@ Arrays... and multi-line strings'') printNl.
        value: ''and block temporaries too! ''.
 !' with: STInST.STFileInParser.
 ]
+
+Eval [
+    | squeak |
+    "Test the import of squeak code"
+
+    squeak := '!String methodsFor: ''*petitparser-core-converting'' stamp: ''lr 11/7/2009 13:32''!
+asParser
+    ^ PPLiteralSequenceParser on: self! !'.
+
+    STInST.STClassLoader new parseSmalltalkStream: squeak readStream
+		    with: STInST.SqueakFileInParser.
+]
+
-- 
1.7.3.5

_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to