Hi,

as written in other threads. PetitParser is using binarySelectors that allow
more than two chars (allowed by Ansi Smalltalk) and we can not parse that, the
other is that Magritte/PetitParser use #classSide and STClassLoader didn't
know how to resolve that.

For the binary selector I have added a patch that allows to parse it when it
is coming from Squeak/Pharo and then we can rewrite it to => or such.

For the #classSide I have used Paolo's patch and propose it for inclusion. I
have not seen that the the STClassLoader allows to have dialect specific code
so I think it is best to include it. For the origin of #classSide, I have
clicked on versions in the Pharo browser and it appears to have a date from
2004, I don't know who added it though.

so please comment on the ChangeLog and code.



>From aa04915651ca1fc5eee0ad3665efd7911cd9d583 Mon Sep 17 00:00:00 2001
From: Holger Hans Peter Freyther <[email protected]>
Date: Thu, 26 Aug 2010 19:22:09 +0800
Subject: [PATCH 2/3] SqueakParser.st: Handle binary selectors with more than two chars.

* SqueakParser.st: Handle binary selector with more than two
  charachters. This is required for ANSI Smalltalk and will allow
  to import PetitParser.
---
 packages/stinst/parser/ChangeLog       |    6 ++++++
 packages/stinst/parser/SqueakParser.st |    4 ++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/packages/stinst/parser/ChangeLog b/packages/stinst/parser/ChangeLog
index 246a80b..0653b3d 100644
--- a/packages/stinst/parser/ChangeLog
+++ b/packages/stinst/parser/ChangeLog
@@ -1,3 +1,9 @@
+2010-08-26  Holger Hans Peter Freyther  <[email protected]>
+
+	* SqueakParser.st: Handle binary selector with more than two
+	charachters. This is required for ANSI Smalltalk and will allow
+	to import PetitParser.
+
 2010-06-22  Gwenael Casaccio  <[email protected]>
 
 	* RBParser.st: Accept non-decimal floats.
diff --git a/packages/stinst/parser/SqueakParser.st b/packages/stinst/parser/SqueakParser.st
index a5f79b3..8c2cb7a 100644
--- a/packages/stinst/parser/SqueakParser.st
+++ b/packages/stinst/parser/SqueakParser.st
@@ -133,6 +133,10 @@ STFileScanner subclass: SqueakFileInScanner [
 		    ifFalse:
 	                [buffer nextPut: currentCharacter.
 	                self step]].
+	[characterType == #binary]
+		whileTrue: [
+		buffer nextPut: currentCharacter.
+		self step].
 
         val := buffer contents.
         val := val asSymbol.
-- 
1.7.2.2

>From a0218d7afb08ad9c5f9f4a433f3fc2f9e321278c Mon Sep 17 00:00:00 2001
From: Holger Hans Peter Freyther <[email protected]>
Date: Thu, 26 Aug 2010 20:17:23 +0800
Subject: [PATCH 3/3] STClassLoader.st: Handle #classSide to be able to parse PetitParser/Magritte

* STLoader.st: Resolve PPFailure classSide properly. #classSide was
added in to Squeak in 2004 and is used in packages like PetitParser
and Magritte.
---
 packages/stinst/parser/ChangeLog   |    6 ++++++
 packages/stinst/parser/STLoader.st |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/packages/stinst/parser/ChangeLog b/packages/stinst/parser/ChangeLog
index 0653b3d..8ffbb43 100644
--- a/packages/stinst/parser/ChangeLog
+++ b/packages/stinst/parser/ChangeLog
@@ -1,3 +1,9 @@
+2010-08-26  Paolo Bonzini  <[email protected]>
+
+	* STLoader.st: Resolve PPFailure classSide properly. #classSide was
+	added in to Squeak in 2004 and is used in packages like PetitParser
+	and Magritte.
+
 2010-08-26  Holger Hans Peter Freyther  <[email protected]>
 
 	* SqueakParser.st: Handle binary selector with more than two
diff --git a/packages/stinst/parser/STLoader.st b/packages/stinst/parser/STLoader.st
index 4488a12..cd3014b 100644
--- a/packages/stinst/parser/STLoader.st
+++ b/packages/stinst/parser/STLoader.st
@@ -341,7 +341,7 @@ doMethodsFor: receiver selector: selector arguments: argumentNodes
 
 resolveClass: node
     | object |
-    (node isMessage and: [ node selector = #class ])
+    (node isMessage and: [ node selector = #class or: [ node selector = #classSide ]])
 	ifTrue: [ ^(self resolveClass: node receiver) asMetaclass ].
     node isLiteral ifTrue: [
         "Dictionary cannot have nil as a key, use the entire RBLiteralNode."
-- 
1.7.2.2

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

Reply via email to