Parser.st
branchexpecco_2_11_0
changeset 4129 c690dec12b7e
parent 4079 ce26f968865a
equal deleted inserted replaced
4079:ce26f968865a 4129:c690dec12b7e
     1 "{ Encoding: utf8 }"
       
     2 
       
     3 "
     1 "
     4  COPYRIGHT (c) 1989 by Claus Gittinger
     2  COPYRIGHT (c) 1989 by Claus Gittinger
     5               All Rights Reserved
     3               All Rights Reserved
     6 
     4 
     7  This software is furnished under a license and may be used
     5  This software is furnished under a license and may be used
     9  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
    10  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
    11  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    12  hereby transferred.
    10  hereby transferred.
    13 "
    11 "
       
    12 'From Smalltalk/X, Version:7.1.0.0 on 21-02-2017 at 16:52:44'                   !
       
    13 
    14 "{ Package: 'stx:libcomp' }"
    14 "{ Package: 'stx:libcomp' }"
    15 
    15 
    16 "{ NameSpace: Smalltalk }"
    16 "{ NameSpace: Smalltalk }"
    17 
    17 
    18 Scanner subclass:#Parser
    18 Scanner subclass:#Parser
  4286                 err notNil ifTrue:[
  4286                 err notNil ifTrue:[
  4287                     err := err, ' in this class or superclass chain'.
  4287                     err := err, ' in this class or superclass chain'.
  4288                 ].
  4288                 ].
  4289             ]
  4289             ]
  4290         ] ifFalse:[receiver isSelf ifTrue:[
  4290         ] ifFalse:[receiver isSelf ifTrue:[
  4291             err notNil ifTrue:[
  4291             classToCompileFor notNil ifTrue:[
  4292                 |subErr nOther|
  4292                 err notNil ifTrue:[
  4293 
  4293                     |subErr nOther|
  4294                 "/ understood by all subclasses ?
  4294 
  4295                 nOther := 0.
  4295                     "/ understood by all subclasses ?
  4296                 classToCompileFor allSubclassesDo:[:eachSubclass |
  4296                     nOther := 0.
  4297                     subErr isNil ifTrue:[
  4297                     classToCompileFor allSubclassesDo:[:eachSubclass |
  4298                         selClass := eachSubclass.
  4298                         subErr isNil ifTrue:[
  4299                         subErr := self checkSelector:selectorSymbol for:receiver inClass:selClass.
  4299                             selClass := eachSubclass.
       
  4300                             subErr := self checkSelector:selectorSymbol for:receiver inClass:selClass.
       
  4301                         ] ifFalse:[
       
  4302                             (self checkSelector:selectorSymbol for:receiver inClass:selClass) notNil ifTrue:[ nOther := nOther + 1 ].
       
  4303                         ]
       
  4304                     ].
       
  4305                     subErr notNil ifTrue:[
       
  4306                         nOther > 0 ifTrue:[
       
  4307                             err := subErr, (' in %1 other subclass(es), this class or superclass chain' bindWith:nOther)
       
  4308                         ] ifFalse:[
       
  4309                             err := subErr, ', in this class or superclass chain'
       
  4310                         ].
  4300                     ] ifFalse:[
  4311                     ] ifFalse:[
  4301                         (self checkSelector:selectorSymbol for:receiver inClass:selClass) notNil ifTrue:[ nOther := nOther + 1 ].
  4312                         err := err, ', in this class or superclass chain'.
  4302                     ]
       
  4303                 ].
       
  4304                 subErr notNil ifTrue:[
       
  4305                     nOther > 0 ifTrue:[
       
  4306                         err := subErr, (' in %1 other subclass(es), this class or superclass chain' bindWith:nOther)
       
  4307                     ] ifFalse:[
       
  4308                         err := subErr, ', in this class or superclass chain'
       
  4309                     ].
  4313                     ].
  4310                 ] ifFalse:[
       
  4311                     err := err, ', in this class or superclass chain'.
       
  4312                 ].
  4314                 ].
  4313             ].
  4315             ].
  4314         ] ifFalse:[(receiver isUnaryMessage
  4316         ] ifFalse:[(receiver isUnaryMessage
  4315                     and:[receiver selector == #class
  4317                     and:[receiver selector == #class
  4316                     and:[receiver receiver isSelf]]) ifTrue:[
  4318                     and:[receiver receiver isSelf]]) ifTrue:[
  5416     super initializeFlagsFrom:aParser.
  5418     super initializeFlagsFrom:aParser.
  5417 
  5419 
  5418     moreSharedPools := aParser moreSharedPools.
  5420     moreSharedPools := aParser moreSharedPools.
  5419     doItTemporaries := aParser doItTemporaries.
  5421     doItTemporaries := aParser doItTemporaries.
  5420     selector := aParser selector.
  5422     selector := aParser selector.
       
  5423 ! !
       
  5424 
       
  5425 !Parser methodsFor:'inspecting'!
       
  5426 
       
  5427 inspector2TabSTXParseTreeInspector
       
  5428     <inspector2Tab>
       
  5429 
       
  5430     ^ (self newInspector2Tab)
       
  5431 	label:'Parse Tree (ST/X)';
       
  5432 	priority:36;
       
  5433 	application:
       
  5434 		[
       
  5435 		    | src parser |
       
  5436 
       
  5437 		    source isExternalStream ifFalse:[
       
  5438 			src := source collection
       
  5439 		    ].
       
  5440 		    SmallSense::ParseTreeInspector new node:tree source:src.
       
  5441 		];
       
  5442 	yourself
       
  5443 
       
  5444     "Created: / 15-10-2014 / 11:23:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  5421 ! !
  5445 ! !
  5422 
  5446 
  5423 !Parser methodsFor:'obsolete'!
  5447 !Parser methodsFor:'obsolete'!
  5424 
  5448 
  5425 correctByDeleting
  5449 correctByDeleting