Browse Source

Proper escaping of ! inside chunks plus not doing javascript escape of class comments.

Göran Krampe 13 years ago
parent
commit
44a8091db2
4 changed files with 24 additions and 13 deletions
  1. 2 2
      st/IDE.st
  2. 5 1
      st/JQuery.st
  3. 3 3
      st/Kernel.st
  4. 14 7
      st/Parser.st

+ 2 - 2
st/IDE.st

@@ -694,12 +694,12 @@ commitCategory
 	(Ajax url: self class commitPathJs, '/', selectedCategory, '.js')
 	    at: 'type' put: 'PUT';
 	    at: 'data' put: (Exporter new exportCategory: selectedCategory);
-	    at: 'error' put: [self alert: 'Commit failed!'];
+	    at: 'error' put: [self alert: 'Commit failed!!'];
 	    send.
 	(Ajax url: self class commitPathSt, '/', selectedCategory, '.st')
 	    at: 'type' put: 'PUT';
 	    at: 'data' put: (ChunkExporter new exportCategory: selectedCategory);
-	    at: 'error' put: [self alert: 'Commit failed!'];
+	    at: 'error' put: [self alert: 'Commit failed!!'];
 	    send]
 
 !

+ 5 - 1
st/JQuery.st

@@ -269,7 +269,11 @@ Object subclass: #Ajax
 	instanceVariableNames: 'settings'
 	category: 'JQuery'!
 !Ajax commentStamp!
-instance%20variable%20names%3A%0A-%20settings%20%20A%20set%20of%20key/value%20pairs%20that%20configure%20the%20Ajax%20request.%20All%20settings%20are%20optional.%0A%0AFull%20list%20of%20settings%20options%20at%20http%3A//api.jquery.com/jQuery.ajax/%0A!
+instance variable names:
+- settings  A set of key/value pairs that configure the Ajax request. All settings are optional.
+
+Full list of settings options at http://api.jquery.com/jQuery.ajax/
+!
 
 !Ajax methodsFor: 'accessing'!
 

+ 3 - 3
st/Kernel.st

@@ -782,7 +782,7 @@ whileTrue: aBlock
 !
 
 whileFalse: aBlock
-	{'while(!self()) {aBlock()}'}
+	{'while(!!self()) {aBlock()}'}
 ! !
 
 !BlockClosure methodsFor: 'error handling'!
@@ -908,7 +908,7 @@ Object subclass: #Date
 	instanceVariableNames: ''
 	category: 'Kernel'!
 !Date commentStamp!
-The%20Date%20class%20is%20used%20to%20work%20with%20dates%20and%20times.!
+The Date class is used to work with dates and times.!
 
 !Date methodsFor: '*IDE'!
 
@@ -1720,7 +1720,7 @@ replaceRegexp: aRegexp with: aString
 !
 
 match: aRegexp
-	{'return self.search(aRegexp) != -1'}
+	{'return self.search(aRegexp) !!= -1'}
 
 ! !
 

+ 14 - 7
st/Parser.st

@@ -763,14 +763,14 @@ isEmptyChunk
 ! !
 
 Object subclass: #ChunkParser
-	instanceVariableNames: 'parser, separator, eof, ws, chunk, emptyChunk, instructionChunk'
+	instanceVariableNames: 'parser separator eof ws chunk emptyChunk instructionChunk'
 	category: 'Parser'!
 
 !ChunkParser methodsFor: ''!
 
 instructionChunk
 	^instructionChunk ifNil: [
-	    instructionChunk := self ws, '!' asParser, self chunk
+	    instructionChunk := self ws, '!!' asParser, self chunk
 	    ==> [:node | InstructionChunk new contents: node last contents]]
 
 ! !
@@ -799,12 +799,12 @@ ws
 !
 
 chunk
-	^chunk ifNil: [chunk := self ws, ('!!' asParser / ('!' asParser not, PPAnyParser new)) plus flatten, '!' asParser ==> [:node | Chunk new contents: (node second replace: '!!' with: '!')]]
+	^chunk ifNil: [chunk := self ws, ('!!!!' asParser / ('!!' asParser not, PPAnyParser new)) plus flatten, '!!' asParser ==> [:node | Chunk new contents: (node second replace: '!!!!' with: '!!')]]
 
 !
 
 emptyChunk
-	^emptyChunk ifNil: [emptyChunk := self separator plus, '!' asParser, self ws ==> [:node | EmptyChunk new]]
+	^emptyChunk ifNil: [emptyChunk := self separator plus, '!!' asParser, self ws ==> [:node | EmptyChunk new]]
 
 ! !
 
@@ -987,11 +987,11 @@ exportMethodsOf: aClass on: aStream
  		add: m]. 
     aClass protocols do: [:category |       
 	aStream
-		nextPutAll: '!', (self classNameFor: aClass);
-		nextPutAll: ' methodsFor: ''', category, '''!'.
+		nextPutAll: '!!', (self classNameFor: aClass);
+		nextPutAll: ' methodsFor: ''', category, '''!!'.
     	(methodsByCategory at: category) do: [:each |
 		self exportMethod: each of: aClass on: aStream].
-	aStream nextPutAll: ' !'; lf; lf]
+	aStream nextPutAll: ' !!'; lf; lf]
 !
 
 exportMetaDefinitionOf: aClass on: aStream
@@ -1014,5 +1014,12 @@ classNameFor: aClass
 		aClass isNil
 		    ifTrue: ['nil']
 		    ifFalse: [aClass name]]
+!
+
+chunkEscape: aString
+	"Replace all occurrences of !! with !!!!"
+
+	^aString replace: '!!' with: '!!!!'
+
 ! !