Squeak Class Documentation category index | class index  
 
Parser
  category: System-Compiler
  superclass: Scanner
  subclasses: DialectParser

I parse Smalltalk syntax and create a MethodNode that is the root of the parse tree. I look one token ahead.

instance methods
  error correction
  correctSelector:wordIntervals:exprInterval:ifAbort:
correctVariable:interval:
declareClassVar:
declareGlobal:
declareTempAndPaste:
queryUndefined
removeUnusedTemps
substituteSelector:wordIntervals:
substituteWord:wordInterval:offset:

  error handling
  expected:
fail
interactive
notify:
notify:at:
offEnd:

  expression types
  argumentName
assignment:
blockExpression
braceExpression
cascade
expression
keylessMessagePartTest:repeat:
messagePart:repeat:
method:context:encoder:
newMethodNode
pattern:inContext:
primaryExpression
statements:innerBlock:
temporaries
temporaryBlockVariables
variable

  primitives
  allocateLiteral:
externalFunctionDeclaration
externalType:
primitive
primitiveDeclarations

  private
  addComment
init:notifying:failBlock:
initPattern:notifying:return:

  public access
  encoder
parse:class:noPattern:context:notifying:ifFail:
parseArgsAndTemps:notifying:
parseMethodComment:setPattern:
parseSelector:

  scanning
  advance
endOfLastToken
match:
matchReturn
matchToken:
startOfNextToken

  temps
  bindArg:
bindTemp:

class methods
  no messages
 

instance methods
  error correction top  
 

correctSelector:wordIntervals:exprInterval:ifAbort:

Correct the proposedKeyword to some selector symbol, correcting the original text if such action is indicated. abortAction is invoked if the proposedKeyword couldn't be converted into a valid selector. Spots is an ordered collection of intervals within the test stream of the for each of the keyword parts.


 

correctVariable:interval:

Correct the proposedVariable to a known variable, or declare it as a new
variable if such action is requested. We support declaring lowercase
variables as temps, and uppercase variables as Globals or ClassVars,
depending on whether the context is nil (class=UndefinedObject).
Spot is the interval within the test stream of the variable.


 

declareClassVar:


 

declareGlobal:


 

declareTempAndPaste:


 

queryUndefined


 

removeUnusedTemps

Scan for unused temp names, and prompt the user about the prospect of removing each one found


 

substituteSelector:wordIntervals:

Substitute the correctSelector into the (presuamed interactive) receiver.


 

substituteWord:wordInterval:offset:

Substitute the correctSelector into the (presuamed interactive) receiver.


  error handling top  
 

expected:

Notify a problem at token 'here'.


 

fail


 

interactive


 

notify:

Notify problem at token before 'here'.


 

notify:at:

Create and schedule a Notifier with the argument as the message in
order to request confirmation before a process can proceed. Subclasses can
override this and insert an error message at location within aString.


 

offEnd:

Notify a problem beyond 'here' (in lookAhead token). Don't be offEnded!


  expression types top  
 

argumentName


 

assignment:

var '_' expression => AssignmentNode.


 

blockExpression

[ ({:var} |) (| {temps} |) (statements) ] => BlockNode.


 

braceExpression

{ elements } => BraceNode.


 

cascade

{; message} => CascadeNode.


 

expression


 

keylessMessagePartTest:repeat:


 

messagePart:repeat:


 

method:context:encoder:

pattern [ | temporaries ] block => MethodNode.


 

newMethodNode


 

pattern:inContext:

unarySelector | binarySelector arg | keyword arg {keyword arg} =>
{selector, arguments, precedence}.


 

primaryExpression


 

statements:innerBlock:


 

temporaries

[ '|' (variable)* '|' ]


 

temporaryBlockVariables

Scan and answer temporary block variables.


 

variable


  primitives top  
 

allocateLiteral:


 

externalFunctionDeclaration

Parse the function declaration for a call to an external library.


 

externalType:

Parse an return an external type


 

primitive


 

primitiveDeclarations


  private top  
 

addComment


 

init:notifying:failBlock:


 

initPattern:notifying:return:


  public access top  
 

encoder


 

parse:class:noPattern:context:notifying:ifFail:

Answer a MethodNode for the argument, sourceStream, that is the root of
a parse tree. Parsing is done with respect to the argument, class, to find
instance, class, and pool variables; and with respect to the argument,
ctxt, to find temporary variables. Errors in parsing are reported to the
argument, req, if not nil; otherwise aBlock is evaluated. The argument
noPattern is a Boolean that is true if the the sourceStream does not
contain a method header (i.e., for DoIts).


 

parseArgsAndTemps:notifying:

Parse the argument, aString, notifying req if an error occurs. Otherwise,
answer a two-element Array containing Arrays of strings (the argument
names and temporary variable names).


 

parseMethodComment:setPattern:

Answer the method comment for the argument, aString. Evaluate aBlock
with the message pattern in the form #(selector, arguments, precedence).


 

parseSelector:

Answer the message selector for the argument, aString, which should
parse successfully up to the temporary declaration or the end of the
method header.


  scanning top  
 

advance


 

endOfLastToken


 

match:

Answer with true if next tokens type matches.


 

matchReturn


 

matchToken:

Matches the token, not its type.


 

startOfNextToken

Return starting position in source of next token.


  temps top  
 

bindArg:


 

bindTemp:


class methods
  no messages top