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.105 date: 2017/02/06 15:07:16
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  parseDoItMethodBody: aString onError: aBlock

o  parseExpression: aString

o  parseExpression: aString onError: aBlock

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

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

o  proceedAfterError: aBoolean

o  rememberedTokens

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

o  rememberNodes: aBoolean

o  rememberTokens: aBoolean

o  saveComments: aBoolean

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
set early, in case of an error (so arguments are already present in block)

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

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

o  parseUnaryMessageWith: aNode

o  parseUnaryPattern

o  parseVariableNode

testing
o  atEnd
class == RBToken



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Thu, 15 Nov 2018 13:18:14 GMT