SyntaxHighlighter2.st
changeset 17858 b2633d40e03f
parent 17371 ffbfab2b0c09
child 18046 fd21c26b4fc9
--- a/SyntaxHighlighter2.st	Wed Dec 20 20:36:23 2017 +0100
+++ b/SyntaxHighlighter2.st	Thu Dec 21 09:03:29 2017 +0100
@@ -84,46 +84,7 @@
 "
 ! !
 
-!SyntaxHighlighter2 class methodsFor:'highlighting'!
-
-format:aString parsingWith:aBlock in:aClass elementsInto:elements
-    "common code for formatStatementList, formatExpression, ...
-     format (recolor) whatever is parsed in aBlock (within the context of a given class).
-     Return the text containing font changes and color information.
-     As a side effect, put syntax elements into the passed in elements container
-     (for element-highlighting in codeView2)"
-
-    "/ cg: I smell a wumpus: I don't think, all of this must be redefined - most is already there in the superclass.
-
-    |parser tree text|
-
-    aString isNil ifTrue:[^ nil].
-
-    parser := self for:(ReadStream on:aString string) in:aClass.
-    parser elements: elements.
-    parser ignoreErrors:true.
-    parser ignoreWarnings:true.
-    parser sourceText:(text := aString string asText).
-    "/ use an array here - this can be changed much faster using #at:put:
-    text emphasisCollection:(Array new:aString size).
-
-    parser nextToken.
-    tree := aBlock value:parser.
-    "/ now, convert the emphasis-array to a runArray
-    text emphasisCollection:(text emphasis asRunArray).
-
-    tree == #Error ifTrue:[
-        ^ self colorize:text forErrorAtPosition:parser sourceStream position withOriginal:aString
-    ].
-    ^ text
-
-    "
-     self
-        formatStatementList:'(1 + 2) max:5. 1 + 2' 
-        in:UndefinedObject
-        elementsInto:(OrderedCollection new).
-    "
-!
+!SyntaxHighlighter2 class methodsFor:'api highlighting'!
 
 formatClassDefinition:aString in:aClass elementsInto: elements
     "format (recolor) a class definition expression in a given class.
@@ -254,6 +215,47 @@
     "Modified: / 22-08-2006 / 13:32:04 / cg"
     "Created: / 05-07-2011 / 10:39:21 / cg"
     "Modified: / 28-05-2013 / 22:45:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SyntaxHighlighter2 class methodsFor:'highlighting'!
+
+format:aString parsingWith:aBlock in:aClass elementsInto:elements
+    "common code for formatStatementList, formatExpression, ...
+     format (recolor) whatever is parsed in aBlock (within the context of a given class).
+     Return the text containing font changes and color information.
+     As a side effect, put syntax elements into the passed in elements container
+     (for element-highlighting in codeView2)"
+
+    "/ cg: I smell a wumpus: I don't think, all of this must be redefined - most is already there in the superclass.
+
+    |parser tree text|
+
+    aString isNil ifTrue:[^ nil].
+
+    parser := self for:(ReadStream on:aString string) in:aClass.
+    parser elements: elements.
+    parser ignoreErrors:true.
+    parser ignoreWarnings:true.
+    parser sourceText:(text := aString string asText).
+    "/ use an array here - this can be changed much faster using #at:put:
+    text emphasisCollection:(Array new:aString size).
+
+    parser nextToken.
+    tree := aBlock value:parser.
+    "/ now, convert the emphasis-array to a runArray
+    text emphasisCollection:(text emphasis asRunArray).
+
+    tree == #Error ifTrue:[
+        ^ self colorize:text forErrorAtPosition:parser sourceStream position withOriginal:aString
+    ].
+    ^ text
+
+    "
+     self
+        formatStatementList:'(1 + 2) max:5. 1 + 2' 
+        in:UndefinedObject
+        elementsInto:(OrderedCollection new).
+    "
 !
 
 formatStatementList:aString in:aClass elementsInto: elements