eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'RBParser':

Home

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

Class: RBParser


Inheritance:

   Object
   |
   +--RBParser

Package:
stx:goodies/refactoryBrowser/parser
Category:
Refactory-Parser
Version:
rev: 1.120 date: 2024/01/22 15:09:27
user: cg
file: RBParser.st directory: goodies/refactoryBrowser/parser
module: stx stc-classLibrary: parser

Class protocol:

accessing
o  cacheRecentlyParsedMethods

o  cacheRecentlyParsedMethods: aBoolean
flush cache

Usage example(s):

     self cacheRecentlyParsedMethods:true
     self cacheRecentlyParsedMethods:false

class initialization
o  initialize
Try to determine which image we're running in

Usage example(s):

	 self initialize

o  parserType

o  parserType: aSymbol

formatting
o  format: textOrStream in: aClass notifying: aRequestor contentsSymbol: aSymbol
Compile a parse tree from the argument, textOrStream. Answer a string containing the original code, formatted nicely. If aBoolean is true, then decorate the resulting text with color and hypertext actions

o  format: aString in: anIgnoredClass notifying: aRequester decorated: decorated

parsing
o  flushCachedTree: aTree
RecentlyParsedMethods := nil

o  flushCachedTreeFor: aString

o  flushCachedTrees
self flushCachedTrees

o  lowSpaceCleanup
self lowSpaceCleanup

o  parseDoItMethodBody: aString onError: aBlock

o  parseExpression: aString

o  parseExpression: aString onError: aBlockOrNil

o  parseExpression: aString onError: aBlock rememberNodes: rememberNodes nodeGenerationCallback: nodeGenerationCallbackOrNil
a more general entry which calls a hook on node generation and
remembers them optionally. Use to get the nodes before erroneous code
even if a real parse tree cannot be constructed (due to syntax errors).
Needed for the code-completion and explainers to get 'up-to-the-point' where
the cursor is, even if there is nothing valid after it

o  parseExpression: aString setup: setupBlock onError: aBlock
a more general entry which calls a hook on node generation and
remembers them optionally. Use to get the nodes before erroneous code
even if a real parse tree cannot be constructed (due to syntax errors).
Needed for the code-completion and explainers to get 'up-to-the-point' where
the cursor is, even if there is nothing valid after it

o  parseMethod: aString

o  parseMethod: aString onError: aBlock

o  parseMethod: aString onError: aBlock proceedAfterError: proceedAfterError

o  parseMethod: aString onError: aBlock proceedAfterError: proceedAfterError rememberNodes: rememberNodes

o  parseMethod: aString onError: aBlock rememberNodes: rememberNodes
a more general entry which calls a hook on node generation and
remembers them optionally. Use to get the nodes before erroneous code
even if a real parse tree cannot be constructed (due to syntax errors).
Needed for the code-completion and explainers to get 'up-to-the-point' where
the cursor is, even if there is nothing valid after it

o  parseMethod: aString onError: aBlock rememberNodes: rememberNodes nodeGenerationCallback: nodeGenerationCallbackOrNil
a more general entry which calls a hook on node generation and
remembers them optionally. Use to get the nodes before erroneous code
even if a real parse tree cannot be constructed (due to syntax errors).
Needed for the code-completion and explainers to get 'up-to-the-point' where
the cursor is, even if there is nothing valid after it

o  parseMethod: aString setup: setupBlock onError: aBlock
a more general entry which calls a hook on node generation and
remembers them optionally. Use to get the nodes before erroneous code
even if a real parse tree cannot be constructed (due to syntax errors).
Needed for the code-completion and explainers to get 'up-to-the-point' where
the cursor is, even if there is nothing valid after it

o  parseMethod: aString tryCache: tryCacheBoolean onError: aBlock
Transcript showCR:'hit'.

o  parseMethodPattern: aString
BRParser parseMethodPattern:'foo:foo1 bar:bar1 baz:baz1'

o  parseMethodWithNoComments: aString

o  parseMethodWithNoComments: aString onError: aBlock
Modified (format): / 22-01-2024 / 15:34:29 / cg

o  parseRewriteExpression: aString

o  parseRewriteExpression: aString keepComments: keepComments

o  parseRewriteExpression: aString keepComments: keepComments onError: aBlock

o  parseRewriteExpression: aString onError: aBlock

o  parseRewriteMethod: aString

o  parseRewriteMethod: aString onError: aBlock

o  parseSearchMethod: aString onError: aBlock

o  parseVariableNames: aString
RBParser parseVariableNames:'foo bar ',Character doubleQuote,'comment',Character doubleQuote,' baz'

testing
o  isIBM

o  isSmalltalkX
self isSmalltalkX

o  isSqueak

o  isVisualWorks
ST/X is visualworks alike enough to allow for this ...


Instance protocol:

accessing
o  currentMethodNode
only valid while within a method-parse (nil otherwise).
Useful to see what has been parsed so far,
in case of an error
(codecompletion uses this to look for
args and locals, even if the source is not syntactically correct)

o  currentScope
only valid while within a method-parse (nil otherwise).
Useful to see what has been parsed so far, in case of an error
(codecompletion uses this to look for variables in scope,
even if the source is not syntactically correct)

o  errorBlock: aBlock

o  initializeParserWith: aString type: aSymbol
Smalltalk dialectName = 'SmalltalkX' ifTrue:[

o  nodesSoFar
In case of an error, this allows for the nodes which have been collected
so far to be fetched. Useful for code completion of incomplete (erroneous) code.

o  parseDoItMethodBody: aString

o  parseExpression

o  parseMethod: aString

o  parseMethodWithNoComments: aString
Modified (format): / 22-01-2024 / 15:34:38 / cg

o  proceedAfterError: aBoolean

o  rememberedTokens
In case of an error, this allows for the tokens which have been collected
so far to be fetched. Useful for code completion of incomplete (erroneous) code.

error handling
o  errorBlock

o  errorPosition

o  parserError: aString
Evaluate the errorBlock. If it returns raise an error

o  parserError: msg lastNode: aNode

o  rememberLastNode: aNode

o  scannerError: aString
Evaluate the block. If it returns raise an error

initialization & release
o  initializeForIBM

o  initializeForSmalltalkX

o  initializeForSqueak

o  initializeForVisualWorks

o  nodeGenerationCallback: nodeGenerationCallbackOrNil

o  rememberNodes

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  rememberNodes: aBoolean
enable node remembering.
In case of an error, this allows for the nodes which have been collected
so far to be fetched. Useful for code completion of incomplete (erroneous) code.

o  rememberTokens: aBoolean
enable token remembering.
In case of an error, this allows for the tokens which have been collected
so far to be fetched. Useful for code completion of incomplete (erroneous) code.

o  saveComments: aBoolean

o  scanner

o  scanner: aScanner

private
o  addComments: comments afterNode: aNode

o  addComments: comments beforeNode: aNode

o  nextToken

o  patchLiteralMessage

o  patchNegativeLiteral
Handle the special negative number case for binary message sends.

o  step

private-parsing
o  parseArgs
currentToken isIdentifier ifTrue:[

o  parseArray
parse Squeak's {} construct

o  parseAssignment
Need one token lookahead to see if we have a ':='. This method could
make it possible to assign the literals true, false and nil.

o  parseBinaryMessage

o  parseBinaryMessageWith: leftNode
create first, so we have the node in case of an error.

o  parseBinaryPattern

o  parseBlock
node arguments do:[:eachArg | eachArg parent:self].

o  parseBlockArgsInto: blockNode
:

o  parseCascadeMessage

o  parseDoItMethodBody

o  parseKeywordMessage
comments notEmptyOrNil ifTrue:[self halt].

o  parseKeywordMessageWith: node

o  parseKeywordPattern
CG: lifted /duplicated the error check to allow for the keyword-node to

o  parseMessagePattern

o  parseMethod
comments after last argument are treated like a body comment

o  parseMethodWithNoComments
self addCommentsTo: methodNode.

o  parseNegatedNumber
create a new token out of the $- and the number

o  parseOptimizedExpression

o  parseParenthesizedExpression

o  parsePatternBlock
ensure that right is set, even if parse aborted due to an error

o  parsePrimitiveIdentifier
scanner has already advanced - comments do not belong to node

o  parsePrimitiveLiteral
RBParser parseExpression:' e''a {1} b { 2 }'' '

o  parsePrimitiveObject

o  parsePrimitiveObjectIfFail: failBlock
primitive c-code expressions

o  parseResourceTag
remembers resources in the tags instVar

o  parseSTXPrimitiveCCodeExpression

o  parseStatementList: tagBoolean into: sequenceNode
skip empty statements

o  parseStatements: tagBoolean
locals size > 0 ifTrue:[ self halt.

o  parseUnaryMessage
primary should follow

o  parseUnaryMessageWith: aNode

o  parseUnaryPattern

o  parseVariableNode

testing
o  atEnd
class == RBToken



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 16:24:24 GMT