class: SyntaxHighlighter
removed: #formatExpression:in:
changed: #formatMethod:in:using:
use #position/#position: instead of #positionXBased
--- a/SyntaxHighlighter.st Sat Aug 10 11:39:11 2013 +0200
+++ b/SyntaxHighlighter.st Sat Aug 10 13:10:01 2013 +0200
@@ -75,59 +75,6 @@
^ self formatExpression:aString in:aClass
!
-formatExpression:aString in:aClass
- "format (recolor) an expression in a given class.
- Return the text containing font changes and color information."
-
- |parser tree text endPos|
-
- aString isNil ifTrue:[^ nil].
-
- parser := self for:(ReadStream on:aString string) in:aClass.
- 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 := parser expression.
- "/ now, convert the emphasis-array to a runArray
- text emphasisCollection:(text emphasis asRunArray).
-
- tree == #Error ifTrue:[
- "/ mhmh - which is better ...
- "/ alternative1: color rest after error in red
-"/ text
-"/ emphasizeFrom:(parser sourceStream position)
-"/ to:text size
-"/ with:(#color->Color red).
-
-
- "/ alternative2: take original emphasis for rest
-
- endPos := parser sourceStream position1Based.
- endPos >= text size ifTrue:[
- ^ text
- ].
- ^ (text copyTo:endPos) , (aString copyFrom:(endPos+1))
-
- "/ alternative3: no emphasis for rest.
-
-"/ ^ text "/ aString
- ].
- ^ text
-
- "
- self
- formatExpression:'(1 + 2) max:5'
- in:UndefinedObject
- "
-
- "Modified: / 7.4.1998 / 09:57:19 / cg"
- "Created: / 9.4.1998 / 16:57:16 / cg"
-!
-
formatMethod:aString in:aClass
"format (recolor) a method in a given class.
Return the text containing font changes and color information."
@@ -184,13 +131,13 @@
"/ mhmh - which is better ...
"/ alternative1: color rest after error in red
text
- emphasizeFrom:(highlighter sourceStream position1Based)
+ emphasizeFrom:(highlighter sourceStream position + 1)
to:text size
with:(#color->eColor).
] ifFalse:[
"/ alternative2: take original emphasis for rest
- endPos := highlighter sourceStream position1Based.
+ endPos := highlighter sourceStream position + 1.
endPos >= text size ifTrue:[
^ text
].
@@ -764,10 +711,10 @@
!SyntaxHighlighter class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/SyntaxHighlighter.st,v 1.73 2013-07-25 01:24:02 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/SyntaxHighlighter.st,v 1.74 2013-08-10 11:10:01 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libcomp/SyntaxHighlighter.st,v 1.73 2013-07-25 01:24:02 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/SyntaxHighlighter.st,v 1.74 2013-08-10 11:10:01 stefan Exp $'
! !