eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ParseNode':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: ParseNode


Inheritance:

   Object
   |
   +--ParseNode
      |
      +--AssignmentNode
      |
      +--BlockNode
      |
      +--BreakpointNode
      |
      +--JavaScriptClassNode
      |
      +--JavaScriptFunctionNode
      |
      +--JavaScriptParser::CommaExpression
      |
      +--JavaScriptParser::ConditionalNode
      |
      +--JavaScriptParser::JavaScriptMultiVariableNode
      |
      +--MessageNode
      |
      +--MethodNode
      |
      +--ParseErrorNode
      |
      +--PrimaryNode
      |
      +--ProgramNode
      |
      +--SelectorNode
      |
      +--StatementNode

Package:
stx:libcomp
Category:
System-Compiler-Support
Version:
rev: 1.124 date: 2024/02/13 20:10:18
user: cg
file: ParseNode.st directory: libcomp
module: stx stc-classLibrary: libcomp

Description:


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

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.

Class protocol:

instance creation
o  type: t

queries
o  isAbstract
Return if this class is an abstract class.
True is returned here for myself only; false for subclasses.
Abstract subclasses must redefine this again.


Instance protocol:

RBParser compatibility
o  bestNodeFor: anInterval

o  children

o  childrenDo: aBlock

o  containedBy: anInterval
true if the interval contains me completely

o  intersectsInterval: anInterval

o  nodesDo: aBlock

o  start
for RBToken compat.

o  whichNodeIntersects: anInterval
I intersect

o  whichNodeIsContainedBy: anInterval
ouch: multiple children in interval

accessing
o  enclosingBlock
Return closest enclosing block node or nil

o  endPosition
the node's last character position in the original source

o  endPosition: aCharacterPosition

o  line
Compatibility

o  lineNumber

o  lineNumber: dummy
set linenumber - ignored here

o  parent

o  parent: aParseNode

o  parenthesized

o  parenthesized: aBoolean

o  parenthized
obsolete - typo in message name - use parenthesized

o  parenthized: aBoolean
obsolete - typo in message name - use parenthesized:

o  realNode

o  selectorPartPositions: selectorPartPositions
ignored here, but implemented because sent without checking

o  selectorPosition: aCharacterPosition
ignored here

o  startPosition
the node's character position in the original source

o  startPosition: start

o  startPosition: start endPosition: endIn
a synthetic node

o  type
return the node's type

attributes access
o  objectAttributes
return a Collection of attributes - nil if there is none.

o  objectAttributes: anObject
(comment from inherited method)
set the collection of attributes.

The default implementation here uses a global Dictionary to store
attributes which may be too slow for high frequency change&update.
Therefore, some classes may redefine this for better performance.

checks
o  plausibilityCheckIn: aParser

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

o  codeForSimpleReturnOn: aStream inBlock: b lineNumber: lineNrOrNil for: aCompiler
generate code to return myself as a simple method return

o  codeInlineOn: aStream inBlock: b valueNeeded: valueNeeded for: aCompiler
generate code for this statement - value is needed

o  codeLineNumber: nr on: codeStream for: aCompiler
generate lineNumber information

o  codeOn: aStream inBlock: codeBlock for: aCompiler

** This method must be redefined in concrete classes (subclassResponsibility) **

o  codeThenDropOn: aStream inBlock: b for: aCompiler
generate code for this statement - value not needed

code generation helpers
o  emitPushGlobalWithLiteralIndex: litIndex on: aTokenCodeStream for: aCompiler

o  emitPushLiteral: value on: aTokenCodeStream for: aCompiler

o  emitPushLiteralIndex: index on: aTokenCodeStream for: aCompiler

o  emitSendLiteralIndex: litIndex numArgs: nargs line: lineNr on: aStream for: aCompiler

o  emitStoreGlobalWithLiteralIndex: litIndex on: aTokenCodeStream for: aCompiler

o  emitSuperSendLiteralIndex: litIndex classLiteralIndex: clsLitIndex numArgs: nargs line: lineNr on: aStream for: aCompiler

enumeration
o  allMessageSelectorsDo: aBlock
evaluate aBlock for each message-node here and in subnodes

o  allMessagesDo: aBlock
evaluate aBlock for each message-node here and in subnodes

o  allNodesDo: aBlock
evaluate aBlock for each variable-node here and in subnodes

o  allSubNodesDo: aBlock
self subclassResponsibility.

o  messageNodesDo: aBlock
evaluate aBlock for each message-node here and in subnodes

o  messageSelectors
return a collection of message selectors

o  messageSelectorsDo: aBlock
evaluate aBlock for each message-selector here and in subnodes

o  messages
return a collection of messageNodes

o  messagesDo: aBlock
evaluate aBlock for each message-node here and in subnodes

o  statements: statements do: aBlock
temporary hack

o  variableNodesDo: aBlock
evaluate aBlock for each variable-node here and in subnodes

evaluation
o  evaluate

o  evaluateForCascade

o  evaluateForCascadeIn: anEnvironment

o  evaluateIn: anEnvironment

** This method must be redefined in concrete classes (subclassResponsibility) **

o  isStatement

printing & storing
o  printOn: aStream
append a user printed representation of the receiver to aStream.
The format is suitable for a human - not meant to be read back.

o  printOn: aStream indent: indent
append a user printed representation of the receiver to aStream.
The format is suitable for a human - not meant to be read back.

** This method must be redefined in concrete classes (subclassResponsibility) **

o  printOn: aStream indent: indent parenthized: parenthized

o  printStatementListOn: aStream indent: i

private
o  type: t
set the nodes type

queries
o  canReuseAsArg: anotherNode

o  collectBlocksInto: aCollection

o  containsReturn

o  parseNodeVisitorClass

o  positionToInsertPeriodForStatementSeparation

o  precedence

o  whoDefines: aName
return the node (blockNode) in which this variable is defined.
(nil if instvar, classvar or global)

o  withConstantValueDo: aBlock
return true, if this evaluates to a constant value
and evaluate aBlock with it

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

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

o  isBlockArg
return true if this is a block argument

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

o  isBlockVariable
return false here; to be redefined in subclass(es)

o  isBreakPointNode

o  isBreakStatement
( an extension from the stx:libjavascript package )

o  isCascade

o  isCascadeToSuper

o  isClassVariable

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

o  isConstantNumber
return true, if this is a node for a constant number

o  isErrorNode

o  isFunctionCallNode

o  isFunctionNode

o  isGlobal
return true, if this is a node for an existing! global variable

o  isGlobalNamed: globalName
return true, if this is a node for a particular
(and existing) global variable

o  isGlobalVariable
return true, if this is a node for global variable

o  isImmutable
not used with ST/X -
for JavaScript nodes return true here.

o  isImplicitJavaScriptMessage
return true, if this is a node for an implicit getter/setter send

o  isInnerFunction

o  isInnerJavaScriptBlock

o  isJAVA
Return true, if receiver is global variable node JAVA.
Used to highlight Java class references.

o  isJavaPackageReference
Return true, given node is JAVA package reference in form:
JAVA package1 package2

o  isJavaScriptAndExpression

o  isJavaScriptArrayAccess
return true, if this is a node for a javascript array reference i.e. expr[]

o  isJavaScriptBlock
return true, if this is a node for a javascript block

o  isJavaScriptClassNode

o  isJavaScriptConditionalExpression
return true, if this is a node for a ?: expression

o  isJavaScriptOrExpression

o  isLiteral
return true, if this is a node for a constant

o  isLiteralArray
return true, if this is a node for an array constant

o  isLiteralCString
return true, if this is a node for a c-string constant

o  isLiteralString
return true, if this is a node for a string constant

o  isLocalVariable
return true, if this is a node for a local variable

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

o  isMessageWithSelector: aStringOrSymbol
return true, if this is a node for a specific message expression

o  isMethodArg

o  isMethodNode

o  isMethodVariable
return true, if this is a node for a method local variable variable

o  isNew
return true, if this is a new XXXX node

o  isPostIncDec
for JavaScript

o  isPreIncDec
for JavaScript

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

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

o  isSelf
return true, if this is a self-node

o  isSequence
return true, if this is a sequence node (JS)

o  isStatementNode
return true, if this is a statement node

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

o  isSynthetic
true if I am a synthetic node (generated from embedded expression strings)

o  isThis
for JavaScript

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

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

o  isVariableNode
return true, if this is a node for a variable



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 04:29:56 GMT