--- a/SmallSense__SmalltalkParser.st Wed Jan 29 10:41:11 2014 +0000
+++ b/SmallSense__SmalltalkParser.st Wed Jan 29 10:42:31 2014 +0000
@@ -3,13 +3,19 @@
"{ NameSpace: SmallSense }"
SyntaxHighlighter subclass:#SmalltalkParser
- instanceVariableNames:'errorRecovery error'
+ instanceVariableNames:'errorRecovery error commentPositions commentIndex'
classVariableNames:''
poolDictionaries:''
category:'SmallSense-Smalltalk'
!
+!SmalltalkParser methodsFor:'accessing'!
+
+commentPositions
+ ^ commentPositions
+! !
+
!SmalltalkParser methodsFor:'error handling'!
parseError:message position:startPos to:endPos
@@ -35,9 +41,13 @@
initialize
super initialize.
- errorRecovery := true
+ errorRecovery := true.
+ commentPositions := Array new: 16.
+ commentIndex := -1.
+ saveComments := true.
"Created: / 19-09-2013 / 11:25:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 29-01-2014 / 10:38:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!SmalltalkParser methodsFor:'parsing'!
@@ -498,10 +508,36 @@
!SmalltalkParser methodsFor:'private'!
+beginComment
+ commentIndex := commentIndex + 2.
+ (commentPositions size) < (commentIndex + 1) ifTrue:[
+ | newPositions |
+
+ newPositions := Array new: commentPositions size + 16.
+ newPositions replaceFrom: 1 with: commentPositions.
+ commentPositions := newPositions.
+ ].
+ commentPositions at: commentIndex put: source position.
+
+ "Created: / 29-01-2014 / 10:13:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+endComment: comment
+ commentPositions at: commentIndex + 1 put: comment size.
+
+ "Created: / 29-01-2014 / 10:14:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+endComment: comment type: type
+ ^ self endComment: comment
+
+ "Created: / 29-01-2014 / 10:14:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
findNameSpaceWith:varName
| ns |
- "The super #findNameSpaceWith: checks whether the the gloval named 'varName' exists,
+ "The super #findNameSpaceWith: checks whether the the global named 'varName' exists,
if not, returns the current namespace which is then prepended to 'varName'.
Here we have to deal with uncomplete global names, so trick the caller by returning
@@ -517,6 +553,7 @@
^ super findNameSpaceWith:varName
"Created: / 28-07-2013 / 13:49:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (format): / 29-01-2014 / 10:04:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!SmalltalkParser methodsFor:'syntax coloring'!