public class ParserSupport extends Object
Modifier and Type | Field and Description |
---|---|
protected ParserConfiguration |
configuration |
protected StaticScope |
currentScope |
protected RubyYaccLexer |
lexer |
protected IRubyWarnings |
warnings |
Constructor and Description |
---|
ParserSupport() |
Modifier and Type | Method and Description |
---|---|
Node |
addRootNode(Node topOfAST,
ISourcePosition position) |
void |
allowDubyExtension(ISourcePosition position) |
Node |
appendToBlock(Node head,
Node tail) |
Node |
arg_add(ISourcePosition position,
Node node1,
Node node2) |
Node |
arg_append(Node node1,
Node node2) |
Node |
arg_blk_pass(Node firstNode,
BlockPassNode secondNode) |
Node |
arg_concat(ISourcePosition position,
Node node1,
Node node2) |
ArgumentNode |
arg_var(Token identifier) |
Node |
aryset(Node receiver,
Node index)
Define an array set condition so we can return lhs
|
AssignableNode |
assignable(Token lhs,
Node value) |
static int |
associateEncoding(org.jruby.util.ByteList buffer,
org.jcodings.Encoding newEncoding,
int codeRange) |
Node |
asSymbol(ISourcePosition position,
Node value) |
Node |
asSymbol(ISourcePosition position,
String value)
Used by 1.9 parser (so encoding aware)
|
Node |
attrset(Node receiver,
String name)
Define an attribute set condition so we can return lhs
|
void |
backrefAssignError(Node node) |
boolean |
checkExpression(Node node) |
protected void |
checkRegexpSyntax(org.jruby.util.ByteList value,
RegexpOptions options) |
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.
|
DStrNode |
createDStrNode(ISourcePosition position) |
ISourcePosition |
createEmptyArgsNodePosition(ISourcePosition pos) |
Token |
formal_argument(Token identifier) |
Node |
getConditionNode(Node node) |
ParserConfiguration |
getConfiguration() |
StaticScope |
getCurrentScope() |
int |
getInSingle()
Getter for property inSingle.
|
Node |
getMatchNode(Node firstNode,
Node secondNode) |
Node |
getOperatorCallNode(Node firstNode,
String operator) |
Node |
getOperatorCallNode(Node firstNode,
String operator,
Node secondNode) |
Node |
getOperatorCallNode(Node firstNode,
String operator,
Node secondNode,
ISourcePosition defaultPosition) |
ISourcePosition |
getPosition(ISourcePositionHolder start) |
RubyParserResult |
getResult()
Gets the result.
|
Node |
getReturnArgsNode(Node node) |
Node |
gettable(Token token)
Create AST node representing variable type it represents.
|
Node |
gettable2(Node node)
We know for callers of this that it cannot be any of the specials checked in gettable.
|
protected void |
getterIdentifierError(ISourcePosition position,
String identifier) |
void |
initTopLocalVariables()
Description of the RubyMethod
|
boolean |
is_local_id(Token identifier) |
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.
|
KeywordArgNode |
keyword_arg(ISourcePosition position,
AssignableNode assignable) |
ListNode |
list_append(Node list,
Node item) |
ListNode |
list_concat(Node first,
Node second) |
Node |
literal_concat(ISourcePosition position,
Node head,
Node tail) |
protected Node |
makeNullNil(Node node) |
FloatNode |
negateFloat(FloatNode floatNode) |
Node |
negateInteger(Node integerNode) |
Node |
new_aref(Node receiver,
Token name,
Node argsNode) |
ArgsTailHolder |
new_args_tail(ISourcePosition position,
ListNode keywordArg,
Token keywordRestArgName,
BlockArgNode blockArg) |
Node |
new_args(ISourcePosition position,
ListNode pre,
ListNode optional,
RestArgNode rest,
ListNode post,
ArgsTailHolder tail) |
Node |
new_args(ISourcePosition position,
ListNode pre,
ListNode optional,
RestArgNode rest,
ListNode post,
BlockArgNode block) |
Node |
new_attrassign(ISourcePosition position,
Node receiver,
String name,
Node args) |
Node |
new_bv(Token identifier) |
Node |
new_call(Node receiver,
Token name,
Node argsNode,
Node iter) |
Colon2Node |
new_colon2(ISourcePosition position,
Node leftNode,
String name) |
Colon3Node |
new_colon3(ISourcePosition position,
String name) |
Node |
new_fcall(Token operation,
Node args,
Node iter) |
IterNode |
new_iter(ISourcePosition position,
Node vars,
StaticScope scope,
Node body) |
Node |
new_opAssign(AssignableNode lhs,
String asgnOp,
Node rhs) |
Node |
new_opElementAsgnNode(ISourcePosition position,
Node receiverNode,
String operatorName,
Node argsNode,
Node valueNode) |
Node |
new_super(Node args,
Token operation) |
Node |
new_yield(ISourcePosition position,
Node node) |
Node |
newAlias(ISourcePosition position,
Node newNode,
Node oldNode) |
AndNode |
newAndNode(ISourcePosition position,
Node left,
Node right) |
ArrayNode |
newArrayNode(ISourcePosition position,
Node firstNode) |
BlockArgNode |
newBlockArg(ISourcePosition position,
Token nameToken) |
BlockArg18Node |
newBlockArg18(ISourcePosition position,
Node blockValue,
Node args) |
CaseNode |
newCaseNode(ISourcePosition position,
Node expression,
Node firstWhenNode)
Ok I admit that this is somewhat ugly.
|
Node |
newEvStrNode(ISourcePosition position,
Node node) |
Node |
newline_node(Node node,
ISourcePosition position)
Wraps node with NEWLINE node.
|
OrNode |
newOrNode(ISourcePosition position,
Node left,
Node right) |
Node |
newRegexpNode(ISourcePosition position,
Node contents,
RegexpNode end) |
SplatNode |
newSplatNode(ISourcePosition position,
Node node) |
SValueNode |
newSValueNode(ISourcePosition position,
Node node) |
Node |
newUndef(ISourcePosition position,
Node nameNode) |
WhenNode |
newWhenNode(ISourcePosition position,
Node expressionNodes,
Node bodyNode,
Node nextCase) |
Node |
node_assign(Node lhs,
Node rhs) |
void |
popCurrentScope() |
ISourcePosition |
position(ISourcePositionHolder one,
ISourcePositionHolder two) |
void |
pushBlockScope() |
void |
pushLocalScope() |
void |
regexpFragmentCheck(RegexpNode end,
org.jruby.util.ByteList value) |
void |
reset() |
Node |
ret_args(Node node,
ISourcePosition position) |
void |
setConfiguration(ParserConfiguration configuration)
Sets the configuration.
|
void |
setInDef(boolean inDef) |
void |
setInSingle(int inSingle)
Setter for property inSingle.
|
void |
setLexer(RubyYaccLexer lexer) |
void |
setResult(RubyParserResult result)
Sets the result.
|
void |
setWarnings(IRubyWarnings warnings) |
Token |
shadowing_lvar(Token identifier) |
Node |
splat_array(Node node)
If node is a splat and it is splatting a literal array then return the literal array.
|
Node |
unwrapNewlineNode(Node node) |
void |
warn(IRubyWarnings.ID id,
ISourcePosition position,
String message,
Object... data) |
void |
warning(IRubyWarnings.ID id,
ISourcePosition position,
String message,
Object... data) |
void |
warningUnlessEOption(IRubyWarnings.ID id,
Node node,
String message) |
void |
warnUnlessEOption(IRubyWarnings.ID id,
Node node,
String message) |
void |
yyerror(String message)
generate parsing error
|
void |
yyerror(String message,
String[] expected,
String found)
generate parsing error
|
protected StaticScope currentScope
protected RubyYaccLexer lexer
protected IRubyWarnings warnings
protected ParserConfiguration configuration
public void reset()
public void allowDubyExtension(ISourcePosition position)
public StaticScope getCurrentScope()
public ParserConfiguration getConfiguration()
public void popCurrentScope()
public void pushBlockScope()
public void pushLocalScope()
public Node arg_concat(ISourcePosition position, Node node1, Node node2)
public Node arg_blk_pass(Node firstNode, BlockPassNode secondNode)
public Node gettable2(Node node)
node
- to check its variable typepublic Node gettable(Token token)
token
- to check its variable typeprotected void getterIdentifierError(ISourcePosition position, String identifier)
public AssignableNode assignable(Token lhs, Node value)
public Node newline_node(Node node, ISourcePosition position)
node
- public Node addRootNode(Node topOfAST, ISourcePosition position)
public Node getOperatorCallNode(Node firstNode, String operator, Node secondNode)
public Node getOperatorCallNode(Node firstNode, String operator, Node secondNode, ISourcePosition defaultPosition)
public Node aryset(Node receiver, Node index)
receiver
- array being setindex
- node which should evalute to index of array setpublic Node attrset(Node receiver, String name)
receiver
- object which contains attributename
- of the attribute being setpublic void backrefAssignError(Node node)
public Node arg_add(ISourcePosition position, Node node1, Node node2)
public Node ret_args(Node node, ISourcePosition position)
public boolean isBreakStatement(Node node)
node
- to be checkedpublic void warnUnlessEOption(IRubyWarnings.ID id, Node node, String message)
public void warningUnlessEOption(IRubyWarnings.ID id, Node node, String message)
public boolean checkExpression(Node node)
public boolean isLiteral(Node node)
node
- to be testedpublic void checkUselessStatement(Node node)
node
- to be checked.public void checkUselessStatements(BlockNode blockNode)
blockNode
- to be checked.public SValueNode newSValueNode(ISourcePosition position, Node node)
public SplatNode newSplatNode(ISourcePosition position, Node node)
public ArrayNode newArrayNode(ISourcePosition position, Node firstNode)
public ISourcePosition position(ISourcePositionHolder one, ISourcePositionHolder two)
public AndNode newAndNode(ISourcePosition position, Node left, Node right)
public OrNode newOrNode(ISourcePosition position, Node left, Node right)
public CaseNode newCaseNode(ISourcePosition position, Node expression, Node firstWhenNode)
expression
- of the case node (e.g. case foo)firstWhenNode
- first when (which could also be the else)public WhenNode newWhenNode(ISourcePosition position, Node expressionNodes, Node bodyNode, Node nextCase)
public Node new_opAssign(AssignableNode lhs, String asgnOp, Node rhs)
public Node new_opElementAsgnNode(ISourcePosition position, Node receiverNode, String operatorName, Node argsNode, Node valueNode)
public Node new_attrassign(ISourcePosition position, Node receiver, String name, Node args)
public Colon2Node new_colon2(ISourcePosition position, Node leftNode, String name)
public Colon3Node new_colon3(ISourcePosition position, String name)
public void initTopLocalVariables()
public boolean isInSingle()
public void setInSingle(int inSingle)
inSingle
- New value of property inSingle.public boolean isInDef()
public void setInDef(boolean inDef)
public int getInSingle()
public RubyParserResult getResult()
public void setResult(RubyParserResult result)
result
- The result to setpublic void setConfiguration(ParserConfiguration configuration)
configuration
- The configuration to setpublic void setWarnings(IRubyWarnings warnings)
public void setLexer(RubyYaccLexer lexer)
public DStrNode createDStrNode(ISourcePosition position)
public Node asSymbol(ISourcePosition position, String value)
public Node asSymbol(ISourcePosition position, Node value)
public Node literal_concat(ISourcePosition position, Node head, Node tail)
public Node newEvStrNode(ISourcePosition position, Node node)
public IterNode new_iter(ISourcePosition position, Node vars, StaticScope scope, Node body)
public Node new_yield(ISourcePosition position, Node node)
public ISourcePosition createEmptyArgsNodePosition(ISourcePosition pos)
public Node new_args(ISourcePosition position, ListNode pre, ListNode optional, RestArgNode rest, ListNode post, BlockArgNode block)
public Node new_args(ISourcePosition position, ListNode pre, ListNode optional, RestArgNode rest, ListNode post, ArgsTailHolder tail)
public ArgsTailHolder new_args_tail(ISourcePosition position, ListNode keywordArg, Token keywordRestArgName, BlockArgNode blockArg)
public Node newAlias(ISourcePosition position, Node newNode, Node oldNode)
public Node newUndef(ISourcePosition position, Node nameNode)
public BlockArg18Node newBlockArg18(ISourcePosition position, Node blockValue, Node args)
public BlockArgNode newBlockArg(ISourcePosition position, Token nameToken)
public void yyerror(String message)
public void yyerror(String message, String[] expected, String found)
message
- text to be displayed.expected
- list of acceptable tokens, if available.public ISourcePosition getPosition(ISourcePositionHolder start)
public void warn(IRubyWarnings.ID id, ISourcePosition position, String message, Object... data)
public void warning(IRubyWarnings.ID id, ISourcePosition position, String message, Object... data)
public boolean is_local_id(Token identifier)
public ArgumentNode arg_var(Token identifier)
public Node splat_array(Node node)
public void regexpFragmentCheck(RegexpNode end, org.jruby.util.ByteList value)
protected void checkRegexpSyntax(org.jruby.util.ByteList value, RegexpOptions options)
public Node newRegexpNode(ISourcePosition position, Node contents, RegexpNode end)
public static int associateEncoding(org.jruby.util.ByteList buffer, org.jcodings.Encoding newEncoding, int codeRange)
public KeywordArgNode keyword_arg(ISourcePosition position, AssignableNode assignable)
Copyright © 2001-2015 JRuby. All Rights Reserved.