public class ParserSupport
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected ParserConfiguration |
configuration |
protected StaticScope |
currentScope |
static ByteList |
INTERNAL_ID |
protected RubyLexer |
lexer |
protected IRubyWarnings |
warnings |
Constructor and Description |
---|
ParserSupport() |
Modifier and Type | Method and Description |
---|---|
Node |
addRootNode(Node topOfAST) |
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(ByteList id) |
Node |
aryset(Node receiver,
Node index)
Define an array set condition so we can return lhs
|
AssignableNode |
assignableInCurr(ByteList nameBytes,
Node value) |
AssignableNode |
assignableKeyword(ByteList name,
Node value) |
AssignableNode |
assignableLabelOrIdentifier(ByteList name,
Node value) |
static int |
associateEncoding(ByteList buffer,
org.jcodings.Encoding newEncoding,
int codeRange) |
Node |
asSymbol(ISourcePosition position,
ByteList value) |
Node |
asSymbol(ISourcePosition position,
Node value) |
Node |
attrset(Node receiver,
ByteList name)
Define an attribute set condition so we can return lhs
|
Node |
attrset(Node receiver,
ByteList callType,
ByteList name) |
void |
backrefAssignError(Node node) |
boolean |
checkExpression(Node node)
Deprecated.
|
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.
|
void |
compile_error(java.lang.String message) |
DStrNode |
createDStrNode(ISourcePosition position) |
KeyValuePair<Node,Node> |
createKeyValue(Node key,
Node value) |
Node |
declareIdentifier(ByteList name) |
void |
fixpos(Node node,
Node orig) |
ByteList |
formal_argument(ByteList identifier) |
java.lang.String |
formal_argument(java.lang.String identifier)
Deprecated.
|
void |
frobnicate_fcall_args(FCallNode fcall,
Node args,
Node iter) |
Node |
getConditionNode(Node node) |
ParserConfiguration |
getConfiguration() |
StaticScope |
getCurrentScope() |
Node |
getMatchNode(Node firstNode,
Node secondNode) |
Node |
getOperatorCallNode(Node firstNode,
ByteList operator) |
Node |
getOperatorCallNode(Node firstNode,
ByteList operator,
Node secondNode) |
Node |
getOperatorCallNode(Node firstNode,
ByteList operator,
Node secondNode,
ISourcePosition defaultPosition) |
ISourcePosition |
getPosition(ISourcePositionHolder start) |
RubyParserResult |
getResult()
Gets the result.
|
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,
RubySymbol identifier) |
void |
initTopLocalVariables()
Description of the RubyMethod
|
java.lang.String |
internalId()
Deprecated.
|
boolean |
is_local_id(ByteList name) |
boolean |
is_local_id(java.lang.String name)
Deprecated.
|
boolean |
isBlockTopLevel()
Is the top of this scope a block scope (which happens in evals).
|
boolean |
isBreakStatement(Node node)
Is the supplied node a break/control statement?
|
boolean |
isInClass() |
boolean |
isInDef() |
boolean |
isLazy(ByteList callType) |
boolean |
isLazy(java.lang.String callType) |
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) |
ComplexNode |
negateComplexNode(ComplexNode complexNode) |
FloatNode |
negateFloat(FloatNode floatNode) |
NumericNode |
negateInteger(NumericNode integerNode) |
NumericNode |
negateNumeric(NumericNode node) |
RationalNode |
negateRational(RationalNode rationalNode) |
ArgsTailHolder |
new_args_tail(ISourcePosition position,
ListNode keywordArg,
ByteList keywordRestArgName,
BlockArgNode blockArg) |
Node |
new_args(ISourcePosition position,
ListNode pre,
ListNode optional,
RestArgNode rest,
ListNode post,
ArgsTailHolder tail) |
Node |
new_attrassign(ISourcePosition position,
Node receiver,
ByteList name,
Node args,
boolean isLazy) |
Node |
new_bv(ByteList identifier) |
Node |
new_call(Node receiver,
ByteList callType,
ByteList name,
Node argsNode,
Node iter) |
Node |
new_call(Node receiver,
ByteList name,
Node argsNode,
Node iter) |
Colon2Node |
new_colon2(ISourcePosition position,
Node leftNode,
ByteList name) |
Colon3Node |
new_colon3(ISourcePosition position,
ByteList name) |
Node |
new_defined(ISourcePosition position,
Node something) |
Node |
new_fcall(ByteList operation) |
Node |
new_opElementAsgnNode(Node receiverNode,
ByteList operatorName,
Node argsNode,
Node valueNode) |
Node |
new_super(ISourcePosition position,
Node args) |
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) |
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.
|
Node |
newOpAsgn(ISourcePosition position,
Node receiverNode,
ByteList callType,
Node valueNode,
ByteList variableName,
ByteList operatorName) |
Node |
newOpConstAsgn(ISourcePosition position,
Node lhs,
ByteList operatorName,
Node rhs) |
OrNode |
newOrNode(ISourcePosition position,
Node left,
Node right) |
Node |
newRegexpNode(ISourcePosition position,
Node contents,
RegexpNode end) |
Node |
newRescueModNode(Node body,
Node rescueBody) |
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() |
Node |
remove_duplicate_keys(HashNode hash) |
void |
reset() |
Node |
ret_args(Node node,
ISourcePosition position) |
void |
setConfiguration(ParserConfiguration configuration)
Sets the configuration.
|
void |
setInDef(boolean inDef) |
void |
setIsInClass(boolean inClass) |
void |
setLexer(RubyLexer lexer) |
void |
setResult(RubyParserResult result)
Sets the result.
|
void |
setWarnings(IRubyWarnings warnings) |
ByteList |
shadowing_lvar(ByteList nameBytes) |
java.lang.String |
shadowing_lvar(java.lang.String name)
Deprecated.
|
Node |
splat_array(Node node)
If node is a splat and it is splatting a literal array then return the literal array.
|
RubySymbol |
symbolID(ByteList identifierValue) |
static boolean |
value_expr(RubyLexer lexer,
Node node) |
void |
warn(IRubyWarnings.ID id,
ISourcePosition position,
java.lang.String message,
java.lang.Object... data) |
void |
warning(IRubyWarnings.ID id,
ISourcePosition position,
java.lang.String message,
java.lang.Object... data) |
void |
warningUnlessEOption(IRubyWarnings.ID id,
Node node,
java.lang.String message) |
void |
warnUnlessEOption(IRubyWarnings.ID id,
Node node,
java.lang.String message) |
void |
yyerror(java.lang.String message)
generate parsing error
|
void |
yyerror(java.lang.String message,
java.lang.String[] expected,
java.lang.String found)
generate parsing error
|
protected StaticScope currentScope
protected RubyLexer lexer
protected IRubyWarnings warnings
protected ParserConfiguration configuration
public static final ByteList INTERNAL_ID
public void reset()
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 AssignableNode assignableLabelOrIdentifier(ByteList name, Node value)
public AssignableNode assignableKeyword(ByteList name, Node value)
protected void getterIdentifierError(ISourcePosition position, RubySymbol identifier)
public Node newline_node(Node node, ISourcePosition position)
node
- public AssignableNode assignableInCurr(ByteList nameBytes, Node value)
public Node getOperatorCallNode(Node firstNode, ByteList operator, Node secondNode)
public Node getOperatorCallNode(Node firstNode, ByteList 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, ByteList 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, java.lang.String message)
public void warningUnlessEOption(IRubyWarnings.ID id, Node node, java.lang.String message)
@Deprecated 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_opElementAsgnNode(Node receiverNode, ByteList operatorName, Node argsNode, Node valueNode)
public RubySymbol symbolID(ByteList identifierValue)
public Node newOpAsgn(ISourcePosition position, Node receiverNode, ByteList callType, Node valueNode, ByteList variableName, ByteList operatorName)
public Node newOpConstAsgn(ISourcePosition position, Node lhs, ByteList operatorName, Node rhs)
public boolean isLazy(java.lang.String callType)
public boolean isLazy(ByteList callType)
public Node new_attrassign(ISourcePosition position, Node receiver, ByteList name, Node args, boolean isLazy)
public Node new_call(Node receiver, ByteList callType, ByteList name, Node argsNode, Node iter)
public Colon2Node new_colon2(ISourcePosition position, Node leftNode, ByteList name)
public Colon3Node new_colon3(ISourcePosition position, ByteList name)
public Node new_super(ISourcePosition position, Node args)
public void initTopLocalVariables()
public boolean isInDef()
public void setInDef(boolean inDef)
public boolean isInClass()
public void setIsInClass(boolean inClass)
public boolean isBlockTopLevel()
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(RubyLexer lexer)
public DStrNode createDStrNode(ISourcePosition position)
public KeyValuePair<Node,Node> createKeyValue(Node key, Node value)
public Node asSymbol(ISourcePosition position, ByteList 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 Node new_yield(ISourcePosition position, Node node)
public NumericNode negateInteger(NumericNode integerNode)
public ComplexNode negateComplexNode(ComplexNode complexNode)
public RationalNode negateRational(RationalNode rationalNode)
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, ByteList keywordRestArgName, BlockArgNode blockArg)
public Node newAlias(ISourcePosition position, Node newNode, Node oldNode)
public Node newUndef(ISourcePosition position, Node nameNode)
public void yyerror(java.lang.String message)
public void yyerror(java.lang.String message, java.lang.String[] expected, java.lang.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, java.lang.String message, java.lang.Object... data)
public void warning(IRubyWarnings.ID id, ISourcePosition position, java.lang.String message, java.lang.Object... data)
public boolean is_local_id(ByteList name)
@Deprecated public boolean is_local_id(java.lang.String name)
public ArgumentNode arg_var(ByteList id)
@Deprecated public java.lang.String formal_argument(java.lang.String identifier)
@Deprecated public java.lang.String shadowing_lvar(java.lang.String name)
public Node splat_array(Node node)
public void compile_error(java.lang.String message)
public Node newRegexpNode(ISourcePosition position, Node contents, RegexpNode end)
public static int associateEncoding(ByteList buffer, org.jcodings.Encoding newEncoding, int codeRange)
public KeywordArgNode keyword_arg(ISourcePosition position, AssignableNode assignable)
public NumericNode negateNumeric(NumericNode node)
public Node new_defined(ISourcePosition position, Node something)
@Deprecated public java.lang.String internalId()
Copyright © 2001-2018 JRuby. All Rights Reserved.