SelectorNode.st
author Jan Vrany <jan.vrany@labware.com>
Thu, 27 Oct 2022 14:53:59 +0100
branchjv
changeset 4735 3b11fb3ede98
parent 4723 524785227024
permissions -rw-r--r--
Allow single underscore as method / block argument and temporaries This commit is a follow up for 38b221e.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3841
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
     1
"
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
     2
 COPYRIGHT (c) 2006 by eXept Software AG
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
     3
              All Rights Reserved
4325
2922fc281577 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 3495
diff changeset
     4
3841
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
     5
 This software is furnished under a license and may be used
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
     6
 only in accordance with the terms of that license and with the
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
     9
 other person.  No title to or ownership of the software is
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
    10
 hereby transferred.
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
    11
"
2818
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
"{ Package: 'stx:libcomp' }"
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
4325
2922fc281577 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 3495
diff changeset
    14
"{ NameSpace: Smalltalk }"
2922fc281577 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 3495
diff changeset
    15
2818
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
ParseNode subclass:#SelectorNode
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
	instanceVariableNames:'value'
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
	classVariableNames:''
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
	poolDictionaries:''
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
	category:'Interface-CodeView-Syntax'
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
!
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
!SelectorNode class methodsFor:'documentation'!
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
3841
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
    25
copyright
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
    26
"
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
    27
 COPYRIGHT (c) 2006 by eXept Software AG
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
    28
              All Rights Reserved
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
    29
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
    30
 This software is furnished under a license and may be used
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
    31
 only in accordance with the terms of that license and with the
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
    33
 be provided or otherwise made available to, or used by, any
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
    34
 other person.  No title to or ownership of the software is
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
    35
 hereby transferred.
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
    36
"
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
    37
!
a22f33410bdf Reduced dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3495
diff changeset
    38
2818
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
documentation
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
"
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
    A (helper) node that represents a selector (or its part).
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
    SelectorNodes are not directly created nor used by the
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    43
    parser/compiler itself.
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    44
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    45
    Some custom subclasses (syntax highlighters for instance)
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    46
    makes use of it.
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
    [author:]
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
        Jan Vrany <jan.vrany@fit.cvut.cz>
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
    [instance variables:]
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
    [class variables:]
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
    [see also:]
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
        SyntaxHighlighter2
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
"
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
! !
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
!SelectorNode class methodsFor:'instance creation'!
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
value: selector from: start to: end
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
    ^self new
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
        value: selector;
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
        startPosition:start endPosition: end
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    68
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
    "Created: / 16-02-2012 / 20:56:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
! !
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    72
!SelectorNode methodsFor:'accessing'!
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
3495
21527d42607b class: SelectorNode
Claus Gittinger <cg@exept.de>
parents: 3388
diff changeset
    74
name
21527d42607b class: SelectorNode
Claus Gittinger <cg@exept.de>
parents: 3388
diff changeset
    75
    "req'd because ParseTreeIndex::Element sends it"
21527d42607b class: SelectorNode
Claus Gittinger <cg@exept.de>
parents: 3388
diff changeset
    76
21527d42607b class: SelectorNode
Claus Gittinger <cg@exept.de>
parents: 3388
diff changeset
    77
    ^ value
21527d42607b class: SelectorNode
Claus Gittinger <cg@exept.de>
parents: 3388
diff changeset
    78
!
21527d42607b class: SelectorNode
Claus Gittinger <cg@exept.de>
parents: 3388
diff changeset
    79
3388
e4fc8dac3fb3 class: SelectorNode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2818
diff changeset
    80
selector
e4fc8dac3fb3 class: SelectorNode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2818
diff changeset
    81
    ^ value
e4fc8dac3fb3 class: SelectorNode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2818
diff changeset
    82
e4fc8dac3fb3 class: SelectorNode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2818
diff changeset
    83
    "Created: / 25-02-2014 / 22:08:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e4fc8dac3fb3 class: SelectorNode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2818
diff changeset
    84
!
e4fc8dac3fb3 class: SelectorNode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2818
diff changeset
    85
2818
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
value
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
    ^ value
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
!
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    90
value:aString
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    91
    value := aString.
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
! !
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    94
!SelectorNode methodsFor:'testing'!
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    95
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    96
isSelector
4325
2922fc281577 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 3495
diff changeset
    97
    ^ true
2818
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    98
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    99
    "Created: / 16-02-2012 / 21:04:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4325
2922fc281577 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 3495
diff changeset
   100
    "Modified (format): / 22-01-2019 / 16:13:10 / Stefan Vogel"
2818
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   101
! !
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   102
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   103
!SelectorNode class methodsFor:'documentation'!
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   104
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   105
version
4325
2922fc281577 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 3495
diff changeset
   106
    ^ '$Header$'
2818
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   107
!
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   108
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   109
version_CVS
4325
2922fc281577 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 3495
diff changeset
   110
    ^ '$Header$'
2818
dc09e77ad723 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   111
! !
3388
e4fc8dac3fb3 class: SelectorNode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2818
diff changeset
   112