--- a/AbstractSyntaxHighlighter.st Fri Jun 06 16:03:56 2014 +0200
+++ b/AbstractSyntaxHighlighter.st Tue Jun 10 12:21:56 2014 +0200
@@ -79,23 +79,23 @@
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
+ "/ 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
+ "/ alternative2: take original emphasis for rest
- endPos := parser sourceStream position + 1.
- endPos >= text size ifTrue:[
- ^ text
- ].
- ^ (text copyTo:endPos) , (aString copyFrom:(endPos+1))
+ endPos := parser sourceStream position + 1.
+ endPos >= text size ifTrue:[
+ ^ text
+ ].
+ ^ (text copyTo:endPos) , (aString copyFrom:(endPos+1))
- "/ alternative3: no emphasis for rest.
+ "/ alternative3: no emphasis for rest.
"/ ^ text "/ aString
].
@@ -103,8 +103,8 @@
"
self
- formatExpression:'(1 + 2) max:5'
- in:UndefinedObject
+ formatExpression:'(1 + 2) max:5'
+ in:UndefinedObject
"
"Modified: / 7.4.1998 / 09:57:19 / cg"
@@ -121,12 +121,12 @@
"
self
- formatMethod:'foo
+ formatMethod:'foo
^ self bar:''hello''.
' , (Character doubleQuote asString) , 'some comment' , (Character doubleQuote asString) , '
'
- in:UndefinedObject
+ in:UndefinedObject
"
"Modified: / 28-04-2010 / 13:03:04 / cg"
@@ -151,12 +151,12 @@
"
self
- formatMethod:'foo
+ formatMethod:'foo
^ self bar:''hello''.
' , (Character doubleQuote asString) , 'some comment' , (Character doubleQuote asString) , '
'
- in:UndefinedObject
+ in:UndefinedObject
"
"Created: / 28-04-2010 / 13:44:24 / cg"
@@ -171,63 +171,63 @@
aString isNil ifTrue:[^ nil].
Error handle:[:ex |
- Transcript showCR:ex description.
- self breakPoint:#cg.
+ Transcript showCR:ex description.
+ self breakPoint:#cg.
- ex creator isHandled ifTrue:[
- ex reject.
- ].
- (ParseError handles:ex) ifFalse:[
- "Parse error may happen when re-formatting incomplete code while editing"
- ('SyntaxHighlighter [info]: error during highlight: ' , ex description) infoPrintCR.
- "/ ex suspendedContext fullPrintAll.
- ].
- ^ aString
+ ex creator isHandled ifTrue:[
+ ex reject.
+ ].
+ (ParseError handles:ex) ifFalse:[
+ "Parse error may happen when re-formatting incomplete code while editing"
+ ('SyntaxHighlighter [info]: error during highlight: ' , ex description) infoPrintCR.
+ "/ ex suspendedContext fullPrintAll.
+ ].
+ ^ aString
] do:[
- highlighter := self for:(ReadStream on:aString string) in:aClass.
- highlighter method:methodOrNil.
- preferencesOrNil notNil ifTrue:[highlighter preferences:preferencesOrNil].
- "/ highlighter ignoreErrors:true.
- highlighter ignoreWarnings:true.
- highlighter sourceText:(text := aString string asText).
+ highlighter := self for:(ReadStream on:aString string) in:aClass.
+ highlighter method:methodOrNil.
+ preferencesOrNil notNil ifTrue:[highlighter preferences:preferencesOrNil].
+ "/ highlighter ignoreErrors:true.
+ highlighter ignoreWarnings:true.
+ highlighter sourceText:(text := aString string asText).
- "/ use an array here - this can be changed much faster using #at:put:
- text emphasisCollection:(Array new:aString size).
+ "/ use an array here - this can be changed much faster using #at:put:
+ text emphasisCollection:(Array new:aString size).
- tree := highlighter parseMethod.
- "/ now, convert the emphasis-array to a runArray
- text emphasisCollection:(text emphasis asRunArray).
+ tree := highlighter parseMethod.
+ "/ now, convert the emphasis-array to a runArray
+ text emphasisCollection:(text emphasis asRunArray).
- tree == #Error ifTrue:[
- eColor := UserPreferences current errorColor.
- eColor notNil ifTrue:[
- "/ mhmh - which is better ...
- "/ alternative1: color rest after error in red
- text
- emphasizeFrom:(highlighter sourceStream position + 1)
- to:text size
- with:(#color->eColor).
- ] ifFalse:[
- "/ alternative2: take original emphasis for rest
+ tree == #Error ifTrue:[
+ eColor := UserPreferences current errorColor.
+ eColor notNil ifTrue:[
+ "/ mhmh - which is better ...
+ "/ alternative1: color rest after error in red
+ text
+ emphasizeFrom:(highlighter sourceStream position + 1)
+ to:text size
+ with:(#color->eColor).
+ ] ifFalse:[
+ "/ alternative2: take original emphasis for rest
- endPos := highlighter sourceStream position + 1.
- endPos >= text size ifTrue:[
- ^ text
- ].
- ^ (text copyTo:endPos) , (aString copyFrom:(endPos+1))
- ].
- "/ alternative3: no emphasis for rest.
- ].
- ^ text
+ endPos := highlighter sourceStream position + 1.
+ endPos >= text size ifTrue:[
+ ^ text
+ ].
+ ^ (text copyTo:endPos) , (aString copyFrom:(endPos+1))
+ ].
+ "/ alternative3: no emphasis for rest.
+ ].
+ ^ text
]
"
self
- formatMethod:'foo
+ formatMethod:'foo
^ self bar:''hello''.
' , (Character doubleQuote asString) , 'some comment' , (Character doubleQuote asString) , '
'
- in:UndefinedObject
+ in:UndefinedObject
"
"Created: / 28-04-2010 / 13:01:42 / cg"
@@ -250,12 +250,12 @@
"
self
- formatMethod:'foo
+ formatMethod:'foo
^ self bar:''hello''.
' , (Character doubleQuote asString) , 'some comment' , (Character doubleQuote asString) , '
'
- in:UndefinedObject
+ in:UndefinedObject
"
"Created: / 28-04-2010 / 12:58:13 / cg"
@@ -274,16 +274,16 @@
collectionEnumerationSelectors
"these are considered wellknown, builtin selectors of very common
- collection enumeration methods.
+ collection enumeration methods.
These are optionally shown with another color (dark green)"
^ #(
- collect:
- select:
- inject:into:
- count:
- collect:thenSelect:
- select:thenCollect:
+ collect:
+ select:
+ inject:into:
+ count:
+ collect:thenSelect:
+ select:thenCollect:
)
"Created: / 14-02-2012 / 15:56:59 / cg"
@@ -295,45 +295,45 @@
languages. These are optionally shown with another color (blue)"
^ #(
- ifTrue: ifFalse:
- ifTrue:ifFalse: ifFalse:ifTrue:
- ifNil: ifNotNil:
- ifNil:ifNotNil: ifNotNil:ifNil:
- and: or:
+ ifTrue: ifFalse:
+ ifTrue:ifFalse: ifFalse:ifTrue:
+ ifNil: ifNotNil:
+ ifNil:ifNotNil: ifNotNil:ifNil:
+ and: or:
- whileTrue:
- whileFalse:
+ whileTrue:
+ whileFalse:
- to:do:
- downTo:do:
- to:by:do:
+ to:do:
+ downTo:do:
+ to:by:do:
- loop
- whileTrue
- whileFalse
- doWhile:
- doUntil:
+ loop
+ whileTrue
+ whileFalse
+ doWhile:
+ doUntil:
- do:
- doWithIndex:
- pairWiseDo:
- keysAndValuesDo:
+ do:
+ doWithIndex:
+ pairWiseDo:
+ keysAndValuesDo:
- withPriority:do:
- handle:do:
- on:do:
- catch:
- ignoreIn:
+ withPriority:do:
+ handle:do:
+ on:do:
+ catch:
+ ignoreIn:
- "/ newProcess
- fork:
- ensure:
- ifCurtailed:
- valueOnUnwindDo:
- valueNowOrOnUnwindDo:
+ "/ newProcess
+ fork:
+ ensure:
+ ifCurtailed:
+ valueOnUnwindDo:
+ valueNowOrOnUnwindDo:
- caseOf:
- caseOf:otherwise:
+ caseOf:
+ caseOf:otherwise:
)
"Created: / 08-09-2006 / 15:56:47 / cg"
@@ -342,28 +342,28 @@
debugSelectors
"these are considered harmful if left in a deployed application:
selectors for debugging which open a debugger (unless haltSignal is
- cought or disabled, which end-user apps should do).
+ caught or disabled, which end-user apps should do).
These are optionally shown with another color (redish)"
^ #(
- halt halt:
+ halt halt:
)
"Modified (comment): / 27-07-2013 / 11:45:07 / cg"
!
errorRaisingSelectors
- "these are error raisers.
+ "these are error raisers.
These are optionally shown with another color (red)"
^ #(
- error error:
- raise raiseRequest:
- raiseErrorString: raiseRequestErrorString:
- raiseWith: raiseRequestWith:
- raiseWith:errorString: raiseRequestWith:errorString:
- subclassResponsibility
- obsoleteMethodWarning obsoleteMethodWarning:
+ error error:
+ raise raiseRequest:
+ raiseErrorString: raiseRequestErrorString:
+ raiseWith: raiseRequestWith:
+ raiseWith:errorString: raiseRequestWith:errorString:
+ subclassResponsibility
+ obsoleteMethodWarning obsoleteMethodWarning:
)
!
@@ -375,9 +375,9 @@
(self controlFlowSelectors includesIdentical:aSelector) ifTrue:[^ true].
true "((aSelector startsWith:'with') or:[ aSelector startsWith:'all'])" ifTrue:[
- ((aSelector endsWith:'do:') or:[ aSelector endsWith:'Do:']) ifTrue:[
- ^ true
- ]
+ ((aSelector endsWith:'do:') or:[ aSelector endsWith:'Do:']) ifTrue:[
+ ^ true
+ ]
].
^ false.
! !
@@ -398,23 +398,23 @@
|e p2 clr|
(clrIn isNil or:[clrIn = Color black]) ifTrue:[
- e := fontEmp
+ e := fontEmp
] ifFalse:[
- clr := clrIn onDevice:Screen current.
- fontEmp isNil ifTrue:[
- e := (#color->clr)
- ] ifFalse:[
- e := Text addEmphasis:fontEmp to:(#color->clr).
- ]
+ clr := clrIn onDevice:Screen current.
+ fontEmp isNil ifTrue:[
+ e := (#color->clr)
+ ] ifFalse:[
+ e := Text addEmphasis:fontEmp to:(#color->clr).
+ ]
].
fontIn notNil ifTrue:[
- e := Text addEmphasis:e to:(#font->fontIn)
+ e := Text addEmphasis:e to:(#font->fontIn)
].
(p2 := pos2) isNil ifTrue:[
- p2 := sourceText size
+ p2 := sourceText size
] ifFalse:[
- p2 := p2 min:sourceText size
+ p2 := p2 min:sourceText size
].
sourceText emphasizeFrom:pos1 to:p2 with:e
@@ -426,22 +426,22 @@
fgClr := fgClr1 ? fgClr2.
(fgClr isNil or:[fgClr = Color black]) ifTrue:[
- e := fontEmp
+ e := fontEmp
] ifFalse:[
- clr := fgClr onDevice:Screen current.
- fontEmp isNil ifTrue:[
- e := (#color->clr)
- ] ifFalse:[
- e := Text addEmphasis:fontEmp to:(#color->clr).
- ]
+ clr := fgClr onDevice:Screen current.
+ fontEmp isNil ifTrue:[
+ e := (#color->clr)
+ ] ifFalse:[
+ e := Text addEmphasis:fontEmp to:(#color->clr).
+ ]
].
bgClr notNil ifTrue:[
- e := Text addEmphasis:(#backgroundColor->bgClr) to:e.
+ e := Text addEmphasis:(#backgroundColor->bgClr) to:e.
].
(p2 := pos2) isNil ifTrue:[
- p2 := sourceText size
+ p2 := sourceText size
] ifFalse:[
- p2 := p2 min:sourceText size
+ p2 := p2 min:sourceText size
].
sourceText emphasizeFrom:pos1 to:p2 with:e
@@ -481,34 +481,34 @@
"/ Transcript showCR:aMessage.
super parseError:aMessage position:position to:endPos.
- self
- markFrom:position to:endPos
- withEmphasis:nil color:UserPreferences current errorColor
+ self
+ markFrom:position to:endPos
+ withEmphasis:nil color:UserPreferences current errorColor
!
showErrorMessage:aMessage position:pos
"/ Transcript showCR:aMessage.
super showErrorMessage:aMessage position:pos.
- self
- markFrom:pos to:nil
- withEmphasis:nil color:UserPreferences current errorColor
+ self
+ markFrom:pos to:nil
+ withEmphasis:nil color:UserPreferences current errorColor
!
syntaxError:aMessage position:position to:endPos
"/ Transcript showCR:aMessage.
super syntaxError:aMessage position:position to:endPos.
- self
- markFrom:position to:endPos
- withEmphasis:nil color:UserPreferences current errorColor
+ self
+ markFrom:position to:endPos
+ withEmphasis:nil color:UserPreferences current errorColor
!
warning:msg position:pos1 to:pos2
"/ self markUnknownIdentifierFrom:pos1 to:pos2
"/ self
-"/ markFrom:pos1 to:pos2
+"/ markFrom:pos1 to:pos2
"/ withEmphasis:nil color:UserPreferences current errorColor
"Modified: / 25.9.1999 / 18:42:30 / cg"
@@ -570,15 +570,15 @@
!AbstractSyntaxHighlighter methodsFor:'syntax detection'!
markFrom:pos1 to:pos2 withAddedEmphasis:addedEmphasis
- self class
- mark:sourceText from:pos1 to:pos2 withAddedEmphasis:addedEmphasis
+ self class
+ mark:sourceText from:pos1 to:pos2 withAddedEmphasis:addedEmphasis
"Created: / 15-01-2008 / 11:48:18 / cg"
!
markFrom:pos1 to:pos2 withEmphasis:fontEmp color:clrIn
self class
- mark:sourceText from:pos1 to:pos2 withEmphasis:fontEmp color:clrIn
+ mark:sourceText from:pos1 to:pos2 withEmphasis:fontEmp color:clrIn
"Created: / 31-03-1998 / 13:26:53 / cg"
"Modified: / 01-06-2012 / 21:43:04 / cg"
@@ -586,7 +586,7 @@
markFrom:pos1 to:pos2 withEmphasis:fontEmp color:clrIn font:fontInOrNil
self class
- mark:sourceText from:pos1 to:pos2 withEmphasis:fontEmp color:clrIn font:fontInOrNil
+ mark:sourceText from:pos1 to:pos2 withEmphasis:fontEmp color:clrIn font:fontInOrNil
"Created: / 31-03-1998 / 13:26:53 / cg"
"Modified: / 01-06-2012 / 21:43:04 / cg"
@@ -594,7 +594,7 @@
markFrom:pos1 to:pos2 withEmphasis:fontEmp color:fgClr1 ifNil:fgClr2 backgroundColor:bgClr
self class
- mark:sourceText from:pos1 to:pos2 withEmphasis:fontEmp color:fgClr1 ifNil:fgClr2 backgroundColor:bgClr
+ mark:sourceText from:pos1 to:pos2 withEmphasis:fontEmp color:fgClr1 ifNil:fgClr2 backgroundColor:bgClr
"Created: / 13-02-2012 / 11:48:09 / cg"
!
@@ -612,14 +612,13 @@
!AbstractSyntaxHighlighter class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/AbstractSyntaxHighlighter.st,v 1.31 2014-02-01 23:13:31 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/AbstractSyntaxHighlighter.st,v 1.32 2014-06-10 10:21:56 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libcomp/AbstractSyntaxHighlighter.st,v 1.31 2014-02-01 23:13:31 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/AbstractSyntaxHighlighter.st,v 1.32 2014-06-10 10:21:56 cg Exp $'
!
version_SVN
^ '$ Id $'
! !
-