--- a/Parser.st Fri Sep 30 12:28:22 2011 +0200
+++ b/Parser.st Fri Sep 30 12:28:35 2011 +0200
@@ -2182,22 +2182,49 @@
!Parser methodsFor:'code generation hooks'!
+assignmentRewriteHookFor:anAssignmentNode
+ "invoked whenever an assignment node has been generated;
+ gives subclasses a chance to rewrite (instrument) it"
+
+ ^ anAssignmentNode
+
+ "Created: / 30-09-2011 / 12:12:13 / cg"
+!
+
blockNodeRewriteHookFor:aBlockNode
+ "invoked whenever a block node has been generated;
+ gives subclasses a chance to rewrite (instrument) it"
+
^ aBlockNode
"Created: / 28-04-2010 / 14:18:30 / cg"
!
messageNodeRewriteHookFor:aMessageNode
+ "invoked whenever a message send node has been generated;
+ gives subclasses a chance to rewrite (instrument) it"
+
^ aMessageNode
"Created: / 27-04-2010 / 11:35:31 / cg"
!
statementListRewriteHookFor:aStatementNode
+ "invoked whenever a statement list node has been generated;
+ gives subclasses a chance to rewrite (instrument) it"
+
^ aStatementNode
"Created: / 28-04-2010 / 14:18:30 / cg"
+!
+
+variableReadRewriteHookFor:aVariableNode
+ "invoked whenever a variable node has been generated;
+ gives subclasses a chance to rewrite (instrument) it"
+
+ ^ aVariableNode
+
+ "Created: / 30-09-2011 / 12:17:48 / cg"
! !
!Parser methodsFor:'coding style checks'!
@@ -6552,7 +6579,11 @@
^ self primary_here.
]
].
- ^ self primary_identifier
+ node := self primary_identifier.
+ node isVariable ifTrue:[
+ ^ self variableReadRewriteHookFor:node
+ ].
+ ^ node.
].
((tokenType == #Integer)
@@ -6759,8 +6790,8 @@
^ #Error
"Created: / 13-09-1995 / 12:50:50 / claus"
- "Modified: / 05-07-2011 / 23:22:29 / cg"
"Modified: / 01-08-2011 / 12:04:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-09-2011 / 12:27:15 / cg"
!
primary_dolphinComputedLiteral
@@ -6768,13 +6799,13 @@
In dolphin, these are written as: ##( expression )
and create a literal constant for the expressions value.
Right now, only a subset is supported - Strings, ByteArrays and Characters.
- WARNING: this is only supported to allow filing in dolphin code.
+ WARNING: this is only supported to allow file-in of dolphin code.
Since stc cannot handle this (at the moment), you should rewrite the code
if you ever plan to stc-compile it into a shared library.
The question is still: how should stc ever be able to do this, as it cannot execute
smalltalk code; it could generate code to execute it at initialization time of the
- generated code, but then, it is no longer a compile-time constant (for example, generating
- a compilation-Date constant is then not possible...)"
+ generated code, but then, it is no longer a compile-time constant
+ (for example, generating a compilation-Date constant is then not possible...)"
|pos pos2 expr val|
@@ -6823,7 +6854,7 @@
"
ParserFlags allowDolphinExtensions:true.
- Parser evaluate:' ##( 5 * 7) '.
+ Parser evaluate:' ##( 5 * 7) '.x
ParserFlags allowDolphinExtensions:false.
"
@@ -6850,6 +6881,7 @@
"/ ^ expr
"Modified: / 27-07-2011 / 15:50:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (comment): / 30-09-2011 / 12:24:41 / cg"
!
primary_expression
@@ -7227,6 +7259,7 @@
assignmentAllowed ifTrue:[
node := AssignmentNode variable:var expression:expr.
(lineNumberInfo == #full) ifTrue:[node lineNumber:lnr].
+ node := self assignmentRewriteHookFor:node.
] ifFalse:[
self parseError:('assignment to "' , var name, '" suppressed' ) position:pos1 to:pos2-1.
node := expr.
@@ -7234,7 +7267,7 @@
^ node
"Modified: / 20-08-2011 / 23:32:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 12-09-2011 / 17:23:12 / cg"
+ "Modified: / 30-09-2011 / 12:18:40 / cg"
!
primary_lazyValue
@@ -9039,6 +9072,9 @@
!
makeReferenceFor:aNode
+ "/ variable references (&var)
+ "/ EXPERIMENTAL - may be in next release
+
|rec sel indexNode contextNode arg1 arg2|
contextNode := VariableNode type:#ThisContext context:contextToEvaluateIn.
@@ -9063,6 +9099,8 @@
rec := VariableNode globalNamed:'Reference'.
^ MessageNode receiver:rec selector:sel arg1:arg1 arg2:arg2.
+
+ "Modified (comment): / 30-09-2011 / 12:20:08 / cg"
!
noAssignmentAllowed:eMsg at:pos
@@ -10538,11 +10576,11 @@
!Parser class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.691 2011-09-12 15:27:58 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.692 2011-09-30 10:28:35 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.691 2011-09-12 15:27:58 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.692 2011-09-30 10:28:35 cg Exp $'
!
version_SVN