org.jruby.parser
Class ParserSupport

java.lang.Object
  extended by org.jruby.parser.ParserSupport

public class ParserSupport
extends java.lang.Object


Constructor Summary
ParserSupport()
           
 
Method Summary
 Node addRootNode(Node topOfAST, ISourcePosition position)
           
 Node appendPrintToBlock(Node block)
           
 Node appendToBlock(Node head, Node tail)
           
 Node appendWhileLoopToBlock(Node block, boolean chop, boolean split)
           
 Node arg_add(ISourcePosition position, Node node1, Node node2)
           
 Node arg_blk_pass(Node firstNode, BlockPassNode secondNode)
           
 Node arg_concat(ISourcePosition position, Node node1, Node node2)
           
 Node aryset(Node receiver, Node index)
          Define an array set condition so we can return lhs
 AssignableNode assignable(Token lhs, Node value)
           
 Node attrset(Node receiver, java.lang.String name)
          Define an attribute set condition so we can return lhs
 void backrefAssignError(Node node)
           
 void checkExpression(Node node)
          Does this node represent an expression?
 void checkUselessStatement(Node node)
          Check to see if current node is an useless statement.
 void checkUselessStatements(BlockNode blockNode)
          Check all nodes but the last one in a BlockNode for useless (void context) statements.
 ISourcePosition createEmptyArgsNodePosition(ISourcePosition pos)
           
 Node getConditionNode(Node node)
           
 StaticScope getCurrentScope()
           
 int getInSingle()
          Getter for property inSingle.
 Node getMatchNode(Node firstNode, Node secondNode)
           
 Node getOperatorCallNode(Node firstNode, java.lang.String operator)
           
 Node getOperatorCallNode(Node firstNode, java.lang.String operator, Node secondNode)
           
 Node getOperatorCallNode(Node firstNode, java.lang.String operator, Node secondNode, ISourcePosition defaultPosition)
           
 ArgumentNode getRestArgNode(Token token)
           
 RubyParserResult getResult()
          Gets the result.
 Node getReturnArgsNode(Node node)
           
 Node gettable(java.lang.String id, ISourcePosition position)
          Create AST node representing variable type it represents.
 Node gettable2(java.lang.String id, ISourcePosition position)
          We know for callers of this that it cannot be any of the specials checked in gettable.
 void initTopLocalVariables()
          Description of the RubyMethod
 boolean isBreakStatement(Node node)
          Is the supplied node a break/control statement?
 boolean isInDef()
           
 boolean isInSingle()
          Getter for property inSingle.
 boolean isLiteral(Node node)
          Is this a literal in the sense that MRI has a NODE_LIT for.
 Node literal_concat(ISourcePosition position, Node head, Node tail)
           
 FloatNode negateFloat(FloatNode floatNode)
           
 Node negateInteger(Node integerNode)
           
 Node new_call(Node receiver, Token name, Node args, Node iter)
           
 Node new_fcall(Token operation, Node args, Node iter)
           
 Node new_super(Node args, Token operation)
           
 Node new_yield(ISourcePosition position, Node node)
           
 AndNode newAndNode(Node left, Node right)
           
 Node newEvStrNode(ISourcePosition position, Node node)
           
 Node newline_node(Node node, ISourcePosition position)
          Wraps node with NEWLINE node.
 OrNode newOrNode(Node left, Node right)
           
 Node node_assign(Node lhs, Node rhs)
           
 void popCurrentScope()
           
 void pushBlockScope()
           
 void pushLocalScope()
           
 void reset()
           
 Node ret_args(Node node, ISourcePosition position)
           
 void setConfiguration(RubyParserConfiguration configuration)
          Sets the configuration.
 void setInDef(boolean inDef)
           
 void setInSingle(int inSingle)
          Setter for property inSingle.
 void setResult(RubyParserResult result)
          Sets the result.
 void setWarnings(IRubyWarnings warnings)
           
 ISourcePosition union(ISourcePositionHolder first, ISourcePositionHolder second)
           
 ISourcePosition union(ISourcePosition first, ISourcePosition second)
           
 Node unwrapNewlineNode(Node node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParserSupport

public ParserSupport()
Method Detail

reset

public void reset()

getCurrentScope

public StaticScope getCurrentScope()

popCurrentScope

public void popCurrentScope()

pushBlockScope

public void pushBlockScope()

pushLocalScope

public void pushLocalScope()

arg_concat

public Node arg_concat(ISourcePosition position,
                       Node node1,
                       Node node2)

arg_blk_pass

public Node arg_blk_pass(Node firstNode,
                         BlockPassNode secondNode)

appendPrintToBlock

public Node appendPrintToBlock(Node block)

appendWhileLoopToBlock

public Node appendWhileLoopToBlock(Node block,
                                   boolean chop,
                                   boolean split)

gettable2

public Node gettable2(java.lang.String id,
                      ISourcePosition position)
We know for callers of this that it cannot be any of the specials checked in gettable.

Parameters:
id - to check its variable type
position - location of this position
Returns:
an AST node representing this new variable

gettable

public Node gettable(java.lang.String id,
                     ISourcePosition position)
Create AST node representing variable type it represents.

Parameters:
id - to check its variable type
position - location of this position
Returns:
an AST node representing this new variable

assignable

public AssignableNode assignable(Token lhs,
                                 Node value)

newline_node

public Node newline_node(Node node,
                         ISourcePosition position)
Wraps node with NEWLINE node.

Parameters:
node -
Returns:
a NewlineNode or null if node is null.

union

public ISourcePosition union(ISourcePositionHolder first,
                             ISourcePositionHolder second)

union

public ISourcePosition union(ISourcePosition first,
                             ISourcePosition second)

addRootNode

public Node addRootNode(Node topOfAST,
                        ISourcePosition position)

appendToBlock

public Node appendToBlock(Node head,
                          Node tail)

getOperatorCallNode

public Node getOperatorCallNode(Node firstNode,
                                java.lang.String operator)

getOperatorCallNode

public Node getOperatorCallNode(Node firstNode,
                                java.lang.String operator,
                                Node secondNode)

getOperatorCallNode

public Node getOperatorCallNode(Node firstNode,
                                java.lang.String operator,
                                Node secondNode,
                                ISourcePosition defaultPosition)

getMatchNode

public Node getMatchNode(Node firstNode,
                         Node secondNode)

aryset

public Node aryset(Node receiver,
                   Node index)
Define an array set condition so we can return lhs

Parameters:
receiver - array being set
index - node which should evalute to index of array set
Returns:
an AttrAssignNode

attrset

public Node attrset(Node receiver,
                    java.lang.String name)
Define an attribute set condition so we can return lhs

Parameters:
receiver - object which contains attribute
name - of the attribute being set
Returns:
an AttrAssignNode

backrefAssignError

public void backrefAssignError(Node node)

arg_add

public Node arg_add(ISourcePosition position,
                    Node node1,
                    Node node2)

node_assign

public Node node_assign(Node lhs,
                        Node rhs)

ret_args

public Node ret_args(Node node,
                     ISourcePosition position)

isBreakStatement

public boolean isBreakStatement(Node node)
Is the supplied node a break/control statement?

Parameters:
node - to be checked
Returns:
true if a control node, false otherwise

checkExpression

public void checkExpression(Node node)
Does this node represent an expression?

Parameters:
node - to be checked

isLiteral

public boolean isLiteral(Node node)
Is this a literal in the sense that MRI has a NODE_LIT for. This is different than ILiteralNode. We should pick a different name since ILiteralNode is something we created which is similiar but used for a slightly different condition (can I do singleton things).

Parameters:
node - to be tested
Returns:
true if it is a literal

checkUselessStatement

public void checkUselessStatement(Node node)
Check to see if current node is an useless statement. If useless a warning if printed.

Parameters:
node - to be checked.

checkUselessStatements

public void checkUselessStatements(BlockNode blockNode)
Check all nodes but the last one in a BlockNode for useless (void context) statements.

Parameters:
blockNode - to be checked.

getConditionNode

public Node getConditionNode(Node node)

newAndNode

public AndNode newAndNode(Node left,
                          Node right)

newOrNode

public OrNode newOrNode(Node left,
                        Node right)

getReturnArgsNode

public Node getReturnArgsNode(Node node)

new_call

public Node new_call(Node receiver,
                     Token name,
                     Node args,
                     Node iter)

new_fcall

public Node new_fcall(Token operation,
                      Node args,
                      Node iter)

new_super

public Node new_super(Node args,
                      Token operation)

initTopLocalVariables

public void initTopLocalVariables()
Description of the RubyMethod


isInSingle

public boolean isInSingle()
Getter for property inSingle.

Returns:
Value of property inSingle.

setInSingle

public void setInSingle(int inSingle)
Setter for property inSingle.

Parameters:
inSingle - New value of property inSingle.

isInDef

public boolean isInDef()

setInDef

public void setInDef(boolean inDef)

getInSingle

public int getInSingle()
Getter for property inSingle.

Returns:
Value of property inSingle.

getResult

public RubyParserResult getResult()
Gets the result.

Returns:
Returns a RubyParserResult

setResult

public void setResult(RubyParserResult result)
Sets the result.

Parameters:
result - The result to set

setConfiguration

public void setConfiguration(RubyParserConfiguration configuration)
Sets the configuration.

Parameters:
configuration - The configuration to set

setWarnings

public void setWarnings(IRubyWarnings warnings)

literal_concat

public Node literal_concat(ISourcePosition position,
                           Node head,
                           Node tail)

newEvStrNode

public Node newEvStrNode(ISourcePosition position,
                         Node node)

new_yield

public Node new_yield(ISourcePosition position,
                      Node node)

negateInteger

public Node negateInteger(Node integerNode)

negateFloat

public FloatNode negateFloat(FloatNode floatNode)

createEmptyArgsNodePosition

public ISourcePosition createEmptyArgsNodePosition(ISourcePosition pos)

unwrapNewlineNode

public Node unwrapNewlineNode(Node node)

getRestArgNode

public ArgumentNode getRestArgNode(Token token)


Copyright © 2002-2007 JRuby Team. All Rights Reserved.