AbstractSyntaxHighlighter.st
branchjv
changeset 4281 7edd11db2e23
parent 4275 e06f4b087e47
child 4723 524785227024
equal deleted inserted replaced
4275:e06f4b087e47 4281:7edd11db2e23
    14 
    14 
    15 "{ NameSpace: Smalltalk }"
    15 "{ NameSpace: Smalltalk }"
    16 
    16 
    17 Parser subclass:#AbstractSyntaxHighlighter
    17 Parser subclass:#AbstractSyntaxHighlighter
    18 	instanceVariableNames:'method sourceText preferences fullSelectorCheck commentColor
    18 	instanceVariableNames:'method sourceText preferences fullSelectorCheck commentColor
    19 		commentEmphasis commentFont constantColor constantEmphasis'
    19 		commentEmphasis constantColor constantEmphasis'
    20 	classVariableNames:''
    20 	classVariableNames:''
    21 	poolDictionaries:''
    21 	poolDictionaries:''
    22 	category:'System-Compiler'
    22 	category:'System-Compiler'
    23 !
    23 !
    24 
    24 
   537 
   537 
   538 !AbstractSyntaxHighlighter methodsFor:'accessing'!
   538 !AbstractSyntaxHighlighter methodsFor:'accessing'!
   539 
   539 
   540 fetchHeavilyUsedPreferenceValues
   540 fetchHeavilyUsedPreferenceValues
   541     preferences isNil ifTrue:[
   541     preferences isNil ifTrue:[
   542         commentColor :=  commentEmphasis := commentFont := nil.
   542         commentColor :=  commentEmphasis := nil.
   543         constantColor := constantEmphasis := nil.
   543         constantColor := constantEmphasis := nil.
   544         ^ self.
   544         ^ self.
   545     ].
   545     ].
   546     
   546     
   547     commentColor := preferences commentColor.
   547     commentColor := preferences commentColor.
   548     commentEmphasis := preferences commentEmphasis.
   548     commentEmphasis := preferences commentEmphasis.
   549     commentFont := preferences commentFont.
   549 
   550 
   550 
   551     constantColor := preferences constantColor.
   551     constantColor := preferences constantColor.
   552     constantEmphasis := preferences constantEmphasis.
   552     constantEmphasis := preferences constantEmphasis.
   553 
   553 
   554     "Created: / 21-10-2017 / 14:13:33 / cg"
   554     "Created: / 21-10-2017 / 14:13:33 / cg"
       
   555     "Modified: / 31-05-2018 / 12:21:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   555 !
   556 !
   556 
   557 
   557 method:aMethod
   558 method:aMethod
   558     "the original method, if known (for subclasses which can make use of it)"
   559     "the original method, if known (for subclasses which can make use of it)"
   559 
   560 
   560     method := aMethod.
   561     method := aMethod.
   561 
   562 
   562     "Created: / 28-04-2010 / 13:15:33 / cg"
   563     "Created: / 28-04-2010 / 13:15:33 / cg"
   563 !
   564 !
   564 
   565 
   565 preferences:aUserPreferencesInstance
   566 preferences: aUserPreferences
   566     preferences := aUserPreferencesInstance.
   567     preferences := aUserPreferences.
   567 
   568 
   568     fullSelectorCheck := preferences fullSelectorCheck.
   569     fullSelectorCheck := UserPreferences current fullSelectorCheck.
   569     self fetchHeavilyUsedPreferenceValues.
   570     self fetchHeavilyUsedPreferenceValues.
   570 
   571     
   571     "Modified: / 21-10-2017 / 14:20:06 / cg"
   572     "Modified: / 21-10-2017 / 14:20:06 / cg"
       
   573     "Modified (format): / 05-12-2017 / 21:04:36 / jv"
       
   574     "Modified (format): / 05-12-2017 / 21:05:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   575 
   572 !
   576 !
   573 
   577 
   574 sourceText
   578 sourceText
   575     "retrieve the updated source text after the highlighting process"
   579     "retrieve the updated source text after the highlighting process"
   576 
   580 
   633     <modifier: #super> "must be called if redefined"
   637     <modifier: #super> "must be called if redefined"
   634 
   638 
   635     super initialize.
   639     super initialize.
   636 
   640 
   637     foldConstants := false.
   641     foldConstants := false.
   638     self preferences:(UserPreferences current).
   642     "/ The `...codeViewThene ? UserPreferences current` trick below is 
       
   643     "/ there to make this code working with both old and editor-thene-aware 
       
   644     "/ code. Will wanish as soon as editor thene support will be
       
   645     "/ integrated.
       
   646     self preferences: (UserPreferences current codeViewTheme ? UserPreferences current).
   639 
   647 
   640     "Created: / 31-03-1998 / 15:12:55 / cg"
   648     "Created: / 31-03-1998 / 15:12:55 / cg"
   641     "Modified: / 21-10-2017 / 14:20:11 / cg"
   649     "Modified: / 21-10-2017 / 14:20:11 / cg"
       
   650     "Modified: / 05-12-2017 / 21:09:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   642 ! !
   651 ! !
   643 
   652 
   644 !AbstractSyntaxHighlighter methodsFor:'misc'!
   653 !AbstractSyntaxHighlighter methodsFor:'misc'!
   645 
   654 
   646 collectionEnumerationSelectors
   655 collectionEnumerationSelectors
   688 
   697 
   689     self 
   698     self 
   690         markFrom:pos1 to:pos2 
   699         markFrom:pos1 to:pos2 
   691         withEmphasis:commentEmphasis 
   700         withEmphasis:commentEmphasis 
   692         color:commentColor
   701         color:commentColor
   693         font:commentFont
       
   694 
   702 
   695     "
   703     "
   696      UserPreferences current commentEmphasis
   704      UserPreferences current commentEmphasis
   697      UserPreferences current commentColor
   705      UserPreferences current commentColor
   698     "
   706     "
   699 
   707 
   700     "Modified (comment): / 21-10-2017 / 14:24:51 / cg"
   708     "Modified (comment): / 21-10-2017 / 14:24:51 / cg"
       
   709     "Modified: / 31-05-2018 / 12:21:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   701 !
   710 !
   702 
   711 
   703 markConstantFrom:pos1 to:pos2
   712 markConstantFrom:pos1 to:pos2
   704     self 
   713     self 
   705         markFrom:pos1 to:pos2 
   714         markFrom:pos1 to:pos2