The Trunk: ShoutCore-ul.49.mcz

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

The Trunk: ShoutCore-ul.49.mcz

commits-2
Marcel Taeumel uploaded a new version of ShoutCore to project The Trunk:
http://source.squeak.org/trunk/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 Trunk: ShoutCore-ul.49.mcz

Chris Muller-3
Thanks guys!

On Tue, May 5, 2015 at 8:19 AM,  <[hidden email]> wrote:

> Marcel Taeumel uploaded a new version of ShoutCore to project The Trunk:
> http://source.squeak.org/trunk/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
>   !
>
>