--- a/SyntaxHighlighter.st Thu Apr 19 17:45:05 2018 +0200
+++ b/SyntaxHighlighter.st Thu Apr 19 17:45:39 2018 +0200
@@ -48,97 +48,6 @@
! !
-!SyntaxHighlighter class methodsFor:'api highlighting'!
-
-formatClassDefinition:aString in:aClass
- "format (recolor) a class definition expression in a given class.
- Return the text containing font changes and color information."
-
- ^ self formatExpression:aString in:aClass
-!
-
-formatMethod:aString in:aClass
- "format (recolor) a method in a given class.
- Return the text containing font changes and color information."
-
- ^ self formatMethod:aString in:aClass using:nil
-
- "
- self
- formatMethod:'foo
- ^ self bar:''hello''.
-
- ' , (Character doubleQuote asString) , 'some comment' , (Character doubleQuote asString) , '
-'
- in:UndefinedObject
- "
-
- "Modified: / 23.10.1998 / 22:48:45 / cg"
-!
-
-formatMethod:aString in:aClass using:preferencesOrNil
- "format (recolor) a method in a given class.
- Return the text containing font changes and color information."
-
- "/ cg: I smell a wumpus: I don't think, all of this must be redefined - most is already there in the superclass.
-
- |highlighter tree newText|
-
- aString isNil ifTrue:[^ nil].
-
- Error handle:[:ex |
- "/ Transcript showCR:ex description.
- (ParseError handles:ex) ifFalse:[
- ex creator isHandled ifTrue:[
- "/ Transcript showCR:'handled'.
- ex reject.
- ].
- "Parse error may happen when re-formatting incomplete code while editing"
- "/ ('SyntaxHighlighter [info]: error during highlight: ' , ex description) infoPrintCR.
- "/ ex suspendedContext fullPrintAll.
- ].
- highlighter notNil ifTrue:[
- ^ self colorize:(newText ? aString) forErrorAtPosition:highlighter sourceStream position withOriginal:aString
- ].
- ^ aString
- ] do:[
- |sourceString|
-
- sourceString := aString string.
- newText := sourceString asUnicode16String asText.
- "/ use an array here (instead of the RunArray) - this can be changed much faster using #at:put:
- newText emphasisCollection:(Array new:sourceString size).
-
- highlighter := self for:(ReadStream on:sourceString) in:aClass.
- preferencesOrNil notNil ifTrue:[highlighter preferences:preferencesOrNil].
- "/ highlighter ignoreErrors:true.
- highlighter ignoreWarnings:true.
- highlighter sourceText:newText.
-
- tree := highlighter parseMethod.
- newText := highlighter sourceText. "/ might have changed identity
- "/ now, convert the emphasis-array to a runArray
- newText emphasisCollection:(newText emphasis asRunArray).
-
- tree == #Error ifTrue:[
- ^ self colorize:newText forErrorAtPosition:highlighter sourceStream position withOriginal:aString.
- ].
- ^ newText
- ]
-
- "
- self
- formatMethod:'foo
- ^ self bar:''hello''.
-
- ' , (Character doubleQuote asString) , 'some comment' , (Character doubleQuote asString) , '
-'
- in:UndefinedObject
- "
-
- "Modified: / 04-02-2012 / 11:53:16 / cg"
-! !
-
!SyntaxHighlighter class methodsFor:'constants'!
codeAspectClassDefinition