ParseNode.st
author Claus Gittinger <cg@exept.de>
Tue, 05 Aug 1997 17:28:04 +0200
changeset 598 f3e50cf083a0
parent 395 16156d8711c2
child 744 e871f9f072f8
permissions -rw-r--r--
checkin from browser

"
 COPYRIGHT (c) 1989 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

Object subclass:#ParseNode
	instanceVariableNames:'type comments parenthized'
	classVariableNames:''
	poolDictionaries:''
	category:'System-Compiler-Support'
!

!ParseNode class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1989 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    node for parse-trees; abstract class
    This is a helper class for the compiler.

    [author:]
        Claus Gittinger
"
! !

!ParseNode class methodsFor:'instance creation'!

type:t
    ^ (self basicNew) type:t
! !

!ParseNode class methodsFor:'code generation helper'!

codeLineNumber:nr on:aStream for:aCompiler
    "generate lineNumber information"

    nr > 0 ifTrue:[
        nr <= 255 ifTrue:[
            aStream nextPut:#lineno.
            aStream nextPut:nr
        ] ifFalse:[
            nr <= 16rFFFF ifTrue:[
                aStream nextPut:#lineno16.
                aStream nextPut:((nr bitShift:-8) bitAnd:16rFF).
                aStream nextPut:(nr bitAnd:16rFF).
            ]
        ]
    ]

    "Created: 21.10.1996 / 14:42:27 / cg"
! !

!ParseNode methodsFor:'accessing'!

lineNumber:dummy
    "set linenumber - ignored here"

    ^ self
!

parenthized
    ^ parenthized
!

parenthized:aBoolean
    parenthized := aBoolean
!

selectorPosition:aCharacterPosition
    "ignored here"

    "Created: 5.8.1997 / 16:32:17 / cg"
!

type
    "return the nodes type"

    ^ type
! !

!ParseNode methodsFor:'checks'!

plausibilityCheck
    ^ nil
! !

!ParseNode methodsFor:'code generation'!

codeForSideEffectOn:aStream inBlock:b for:aCompiler
    "generate code for this statement - value not needed"

    self codeOn:aStream inBlock:b for:aCompiler.
    aStream nextPut:#drop
!

codeLineNumber:nr on:aStream for:aCompiler
    "generate lineNumber information"

    nr > 0 ifTrue:[
        nr <= 255 ifTrue:[
            aStream nextPut:#lineno.
            aStream nextPut:nr
        ] ifFalse:[
            nr <= 16rFFFF ifTrue:[
                aStream nextPut:#lineno16.
                aStream nextPut:((nr bitShift:-8) bitAnd:16rFF).
                aStream nextPut:(nr bitAnd:16rFF).
            ]
        ]
    ]

    "Created: 21.10.1996 / 11:19:40 / cg"
! !

!ParseNode methodsFor:'evaluation'!

evaluateForCascade
    ^ self evaluate
! !

!ParseNode methodsFor:'printing'!

printOn:aStream
    self printOn:aStream indent:0
!

printString
    |stream|

    stream := WriteStream on:String new.
    self printOn:stream indent:0.
    ^ stream contents
! !

!ParseNode methodsFor:'private'!

type:t
    "set the nodes type"

    type := t
! !

!ParseNode methodsFor:'queries'!

canReuseAsArg:anotherNode
    ^ false

    "Created: 14.4.1996 / 00:43:08 / cg"
!

collectBlocksInto:aCollection
    ^ self

    "Created: 23.10.1996 / 15:45:00 / cg"
!

isAssignment
    "return true, if this is a node for an assignment"

    ^ false
!

isBinaryMessage
    "return true, if this is a node for a binary send"

    ^ false
!

isBlockNode
    "return true, if this is a node for a block"

    ^ false
!

isConstant
    "return true, if this is a node for a constant"

    ^ false
!

isGlobal
    "return true, if this is a node for a global variable"

    ^ false
!

isMessage
    "return true, if this is a node for a message expression"

    ^ false
!

isPrimary
    "return true, if this is a node for a primary (i.e. non-send)"

    ^ false
!

isReturnNode
    "return true, if this is a node for a return expression"

    ^ false
!

isSuper
    "return true, if this is a super-node"

    ^ false
!

isUnaryMessage
    "return true, if this is a node for a unary send"

    ^ false
!

isVariable
    "return true, if this is a node for a variable"

    ^ false

    "Created: 14.4.1996 / 00:46:44 / cg"
! !

!ParseNode class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libcomp/ParseNode.st,v 1.22 1997-08-05 15:28:04 cg Exp $'
! !