The Inbox: ShoutCore-ul.49.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: ShoutCore-ul.49.mcz

commits-2
A new version of ShoutCore was added to project The Inbox:
http://source.squeak.org/inbox/ShoutCore-ul.49.mcz

==================== Summary ====================

Name: ShoutCore-ul.49
Author: ul
Time: 5 May 2015, 1:06:58.433 am
UUID: 965b17b5-211b-4841-903f-be90e72d003d
Ancestors: ShoutCore-ul.48

Fix styling in Inspectors and ObjectExplorers.

=============== Diff against ShoutCore-ul.48 ===============

Item was added:
+ ----- Method: Inspector>>aboutToStyle: (in category '*ShoutCore') -----
+ aboutToStyle: aStyler
+
+ aStyler
+ classOrMetaClass: object class;
+ parseAMethod: false.
+ ^true!

Item was added:
+ ----- Method: ObjectExplorer>>aboutToStyle: (in category '*ShoutCore') -----
+ aboutToStyle: aStyler
+
+ aStyler
+ classOrMetaClass: self object class;
+ parseAMethod: false.
+ ^true
+ !

Item was changed:
  Object subclass: #SHParserST80
+ instanceVariableNames: 'classOrMetaClass source workspace arguments sourcePosition currentToken currentTokenFirst temporaries instanceVariables errorBlock currentTokenSourcePosition blockDepth bracketDepth ranges environment allowUnderscoreAssignments allowUnderscoreSelectors parseAMethod'
- instanceVariableNames: 'classOrMetaClass source workspace arguments sourcePosition currentToken currentTokenFirst temporaries instanceVariables errorBlock currentTokenSourcePosition blockDepth bracketDepth ranges environment allowUnderscoreAssignments allowUnderscoreSelectors'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'ShoutCore-Parsing'!
 
  !SHParserST80 commentStamp: 'tween 8/16/2004 15:44' prior: 0!
  I am a Smalltalk method / expression parser.
 
  Rather than creating an Abstract Syntax Tree, I create a sequence of SHRanges (in my 'ranges' instance variable), which represent the tokens within the String I am parsing.
 
  I am used by a SHTextStylerST80 to parse method source strings.
  I am able to parse incomplete / incorrect methods, and so can be used to parse methods that are being edited.
 
  My 'source' instance variable should be set to the string to be parsed.
 
  My 'classOrMetaClass' instance var must be set to the class or metaClass for the method source so that I can correctly resolve identifiers within the source. If this is nil , I parse the source as an expression (i.e. a doIt expression).
 
  My 'workspace' instance variable can be set to a Workspace, so that I can resolve workspace variables.
 
  My 'environment' instance variable is the global namespace (this is initialized to Smalltalk, but can be set to a different environment).
 
  Example 1.
  ranges := SHParserST80 new
  classOrMetaClass: Object;
  source: 'testMethod ^self';
  parse;
  ranges
 
  !

Item was changed:
  ----- Method: SHParserST80>>parse (in category 'parse') -----
  parse
  "Parse the receiver's text as a Smalltalk method"
 
+ self parse: (parseAMethod ifNil: [ classOrMetaClass notNil ]).
- self parse: classOrMetaClass notNil.
  errorBlock := nil!

Item was added:
+ ----- Method: SHParserST80>>parseAMethod: (in category 'accessing') -----
+ parseAMethod: aBoolean
+
+ parseAMethod := aBoolean!

Item was changed:
  SHTextStyler subclass: #SHTextStylerST80
+ instanceVariableNames: 'classOrMetaClass workspace font parser formatAssignments environment sourceMap processedSourceMap pixelHeight attributesByPixelHeight parseAMethod'
- instanceVariableNames: 'classOrMetaClass workspace font parser formatAssignments environment sourceMap processedSourceMap pixelHeight attributesByPixelHeight'
  classVariableNames: 'SubduedSyntaxHighlights SyntaxHighlightingAsYouType SyntaxHighlightingAsYouTypeAnsiAssignment SyntaxHighlightingAsYouTypeLeftArrowAssignment'
  poolDictionaries: ''
  category: 'ShoutCore-Styling'!
  SHTextStylerST80 class
  instanceVariableNames: 'styleTable textAttributesByPixelHeight'!
 
  !SHTextStylerST80 commentStamp: 'tween 8/27/2004 10:55' prior: 0!
  I style Smalltalk methods and expressions.
 
  My 'styleTable' class instance var holds an array ofArrays which control how each token is styled/coloured. See my defaultStyleTable class method for its structure.
  My styleTable can be changed by either modifying the defaultStyleTable class method and then executing SHTextStylerST80 initialize ; or by giving me a new styleTable through my #styleTable: class method.
 
  My 'textAttributesByPixelSize' class instance var contains a dictionary of dictionaries.
  The key is a pixelSize and the value a Dictionary from token type Symbol to TextAttribute array.
  It is created/maintained automatically.
 
  I also install these 3 preferences when my class initialize method is executed....
  #syntaxHighlightingAsYouType  - controls whether methods are styled in browsers
  #syntaxHighlightingAsYouTypeAnsiAssignment - controls whether assignments are formatted to be :=
  #syntaxHighlightingAsYouTypeLeftArrowAssignment - controls whether assignments are formatted to be _
 
  I reimplement #unstyledTextFrom: so that TextActions are preserved in the unstyled text
 
 
 
 
 
 
  !
  SHTextStylerST80 class
  instanceVariableNames: 'styleTable textAttributesByPixelHeight'!

Item was added:
+ ----- Method: SHTextStylerST80>>parseAMethod: (in category 'accessing') -----
+ parseAMethod: aBoolean
+
+ parseAMethod := aBoolean!

Item was changed:
  ----- Method: SHTextStylerST80>>rangesIn:setWorkspace: (in category 'private') -----
  rangesIn: aText setWorkspace: aBoolean
  "Answer a collection of SHRanges by parsing aText.
  When formatting it is not necessary to set the workspace, and this can make the parse take less time, so aBoolean specifies whether the parser should be given the workspace"
 
  | shoutParserClass |
  "Switch parsers if we have to"
  shoutParserClass := (classOrMetaClass ifNil:[Object]) shoutParserClass.
+ parser class == shoutParserClass ifFalse:[parser := shoutParserClass new].
+ parser parseAMethod: parseAMethod.
- parser class = shoutParserClass ifFalse:[parser := shoutParserClass new].
-
  ^parser
  rangesIn: aText asString
  classOrMetaClass: classOrMetaClass
  workspace: (aBoolean ifTrue:[workspace])  
  environment: environment
  !


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: ShoutCore-ul.49.mcz

marcel.taeumel (old)
Well, ShoutCore does not know anything about tools. :) So, we should not put it into the extension here.

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: ShoutCore-ul.49.mcz

marcel.taeumel
In reply to this post by commits-2
This shouldn't be an extension to ShoutCore but a regular implementation of #aboutToStyle: in Inspector and ObjectExplorer.

Shout will check for that. All other tools do it that way.

The Tools package should be no dependency for loading ShoutCore.

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: ShoutCore-ul.49.mcz

Levente Uzonyi-2
Well, the same can be done to the Monticello package too.

Levente

On Tue, 5 May 2015, marcel.taeumel wrote:

> This shouldn't be an extension to ShoutCore but a regular implementation of
> #aboutToStyle: in Inspector and ObjectExplorer.
>
> Shout will check for that. All other tools do it that way.
>
> The Tools package should be no dependency for loading ShoutCore.
>
> Best,
> Marcel
>
>
>
> --
> View this message in context: http://forum.world.st/The-Inbox-ShoutCore-ul-49-mcz-tp4824458p4824538.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: ShoutCore-ul.49.mcz

marcel.taeumel
Absolutely. We might miss an abstraction between ShoutCore and Tools right now but that's how it is right now.

Best,
Marcel