Package org.jruby.parser
Class ParserSupport
java.lang.Object
org.jruby.parser.ParserSupport
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ParserConfigurationprotected StaticScopeprivate booleanprivate booleanstatic final ByteListbooleanprotected RubyLexerprivate RubyParserResultprotected ScopedParserStateprotected IRubyWarningsprivate boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddOrMarkVariable(RubySymbol name, int slot) addRootNode(Node topOfAST) allocateNamedLocals(RegexpNode regexpNode) appendToBlock(Node head, Node tail) private static Nodearg_append(Node node1, Node node2) static Nodearg_blk_pass(Node firstNode, BlockPassNode secondNode) static Nodearg_concat(Node node1, Node node2) Define an array set condition so we can return lhsassignableInCurr(ByteList nameBytes, Node value) assignableKeyword(ByteList name, Node value) assignableLabelOrIdentifier(ByteList byteName, Node value) static intassociateEncoding(ByteList buffer, org.jcodings.Encoding newEncoding, int codeRange) Define an attribute set condition so we can return lhsvoidbackrefAssignError(Node node) private booleanassign_in_condprivate NodecheckForNilNode(Node node, int defaultPosition) voidcompile_error(String message) private NodecreateDStrNode(int line) createKeyValue(Node key, Node value) private ByteListcreateMaster(RegexpOptions options) declareIdentifier(ByteList byteName) voidformal_argument(ByteList identifier) voidfrobnicate_fcall_args(FCallNode fcall, Node args, Node iter) private NodegetFlipConditionNode(Node node) getMatchNode(Node firstNode, Node secondNode) getOperatorCallNode(Node firstNode, ByteList operator) getOperatorCallNode(Node firstNode, ByteList operator, Node secondNode) getOperatorCallNode(Node firstNode, ByteList operator, Node secondNode, int defaultPosition) private NodegetOperatorCallNodeInner(Node firstNode, ByteList operator, Node secondNode) intgetPosition(Node start) Gets the result.We know for callers of this that it cannot be any of the specials checked in gettable.protected voidgetterIdentifierError(RubySymbol identifier) private voidhandleUselessWarn(Node node, String useless) voidDescription of the RubyMethodDeprecated.booleanis_local_id(String name) Deprecated.static booleanis_local_id(ByteList name) static booleanis_private_local_id(ByteList name) private static booleanisBreakStatement(Node node) booleanbooleanisInDef()booleanbooleanprivate static booleanisStaticContent(Node node) list_append(Node list, Node item) list_concat(Node first, Node second) literal_concat(Node head, Node tail) protected NodemakeNullNil(Node node) method_cond(Node node) negateComplexNode(ComplexNode complexNode) negateFloat(FloatNode floatNode) negateInteger(NumericNode integerNode) negateNumeric(NumericNode node) negateRational(RationalNode rationalNode) new_args(int line, ListNode pre, ListNode optional, RestArgNode rest, ListNode post, ArgsTailHolder tail) new_args_tail(int line, ListNode keywordArg, ByteList keywordRestArgName, BlockArgNode blockArg) new_ary_op_assign(Node receiverNode, ByteList operatorName, Node argsNode, Node valueNode) new_attr_op_assign(Node receiverNode, ByteList callType, Node valueNode, ByteList variableName, ByteList operatorName) new_attrassign(int line, Node receiver, ByteList name, Node argsNode, boolean isLazy) new_bodystmt(Node head, RescueBodyNode rescue, Node rescueElse, Node ensure) new_colon2(int line, Node leftNode, ByteList name) new_colon3(int line, ByteList name) new_const_op_assign(int line, Node lhs, ByteList operatorName, Node rhs) new_op_assign(AssignableNode receiverNode, ByteList operatorName, Node valueNode) static NodenewAndNode(Node left, Node right) newArrayNode(int line, Node node) static CaseNodenewCaseNode(int line, Node expression, Node firstWhenNode) Ok I admit that this is somewhat ugly.newEvStrNode(int line, Node node) newline_node(Node node, int line) Wraps node with NEWLINE node.newRegexpNode(int line, Node contents, RegexpNode end) newRescueModNode(Node body, Node rescueBody) newSplatNode(Node node) newSValueNode(int line, Node node) static NodenewWhenNode(int line, Node expressionNodes, Node bodyNode, Node nextCase) static Nodenode_assign(Node lhs, Node rhs) voidintvoidvoidvoidreset()voidsetConfiguration(ParserConfiguration configuration) Sets the configuration.voidsetInDef(boolean inDef) voidsetIsInClass(boolean inClass) voidvoidsetResult(RubyParserResult result) Sets the result.voidsetWarnings(IRubyWarnings warnings) shadowing_lvar(ByteList nameBytes) private static voidsimplifyMultipleArgumentWhenNodes(WhenNode sourceWhen, ArrayNode cases) splat_array(Node node) If node is a splat and it is splatting a literal array then return the literal array.booleanvalue_expr(RubyLexer lexer, Node node) voidCheck to see if current node is an useless statement.void_stmts(Node node) Check all nodes but the last one in a BlockNode for useless (void context) statements.voidwarn(IRubyWarnings.ID id, int line, String message, Object... data) voidwarning(IRubyWarnings.ID id, int line, String message, Object... data) voidwarnUnlessEOption(IRubyWarnings.ID id, Node node, String message) voidgenerate parsing errorvoidgenerate parsing errorvoidyyerror(String message, ProductionState state)
-
Field Details
-
currentScope
-
scopedParserState
-
lexer
-
inDefinition
private boolean inDefinition -
inClass
private boolean inClass -
warnOnUnusedVariables
private boolean warnOnUnusedVariables -
warnings
-
configuration
-
result
-
isNextBreak
public boolean isNextBreak -
INTERNAL_ID
-
-
Constructor Details
-
ParserSupport
public ParserSupport()
-
-
Method Details
-
reset
public void reset() -
getCurrentScope
-
getConfiguration
-
popCurrentScope
public void popCurrentScope() -
pushBlockScope
public void pushBlockScope() -
pushLocalScope
public void pushLocalScope() -
arg_concat
-
arg_blk_pass
-
gettable2
We know for callers of this that it cannot be any of the specials checked in gettable.- Parameters:
node- to check its variable type- Returns:
- an AST node representing this new variable
-
declareIdentifier
-
assignableLabelOrIdentifier
-
addOrMarkVariable
-
assignableKeyword
-
getterIdentifierError
-
newline_node
Wraps node with NEWLINE node. -
addRootNode
-
appendToBlock
-
assignableInCurr
-
getOperatorCallNode
-
getOperatorCallNode
-
getOperatorCallNode
-
getOperatorCallNodeInner
-
getMatchNode
-
aryset
Define an array set condition so we can return lhs- Parameters:
receiver- array being setindex- node which should evalute to index of array set- Returns:
- an AttrAssignNode
-
attrset
Define an attribute set condition so we can return lhs- Parameters:
receiver- object which contains attributename- of the attribute being set- Returns:
- an AttrAssignNode
-
attrset
-
backrefAssignError
-
arg_add
-
node_assign
-
ret_args
-
isBreakStatement
-
warnUnlessEOption
-
value_expr
-
handleUselessWarn
-
void_expr
Check to see if current node is an useless statement. If useless a warning if printed.- Parameters:
node- to be checked.
-
void_stmts
Check all nodes but the last one in a BlockNode for useless (void context) statements.- Parameters:
node- to be checked.
-
checkAssignmentInCondition
assign_in_cond -
isStaticContent
-
makeNullNil
-
cond0
-
cond
-
method_cond
-
new_if
-
getFlipConditionNode
-
newSValueNode
-
newSplatNode
-
newArrayNode
-
position
-
newAndNode
-
newOrNode
-
newCaseNode
Ok I admit that this is somewhat ugly. We post-process a chain of when nodes and analyze them to re-insert them back into our new CaseNode the way we want. The grammar is being difficult and until I go back into the depths of that this is where things are.- Parameters:
expression- of the case node (e.g. case foo)firstWhenNode- first when (which could also be the else)- Returns:
- a new case node
-
simplifyMultipleArgumentWhenNodes
-
newWhenNode
-
new_op_assign
-
new_ary_op_assign
-
new_attr_op_assign
-
new_const_op_assign
-
new_bodystmt
-
symbolID
-
isLazy
-
isLazy
-
new_attrassign
-
new_call
-
new_call
-
new_call
-
new_colon2
-
new_colon3
-
frobnicate_fcall_args
-
fixpos
-
new_fcall
-
new_super
-
initTopLocalVariables
public void initTopLocalVariables()Description of the RubyMethod -
isInDef
public boolean isInDef() -
setInDef
public void setInDef(boolean inDef) -
isInClass
public boolean isInClass() -
setIsInClass
public void setIsInClass(boolean inClass) -
getResult
Gets the result.- Returns:
- Returns a RubyParserResult
-
setResult
Sets the result.- Parameters:
result- The result to set
-
setConfiguration
Sets the configuration.- Parameters:
configuration- The configuration to set
-
setWarnings
-
setLexer
-
createDStrNode
-
createKeyValue
-
asSymbol
-
asSymbol
-
literal_concat
-
newRescueModNode
-
newEvStrNode
-
new_yield
-
negateInteger
-
negateFloat
-
negateComplexNode
-
negateRational
-
checkForNilNode
-
new_args
public Node new_args(int line, ListNode pre, ListNode optional, RestArgNode rest, ListNode post, ArgsTailHolder tail) -
new_args_tail
public ArgsTailHolder new_args_tail(int line, ListNode keywordArg, ByteList keywordRestArgName, BlockArgNode blockArg) -
remove_duplicate_keys
-
newAlias
-
newUndef
-
yyerror
generate parsing error -
yyerror
-
yyerror
generate parsing error- Parameters:
message- text to be displayed.expected- list of acceptable tokens, if available.
-
getPosition
-
warn
-
warning
-
is_local_id
-
is_local_id
Deprecated. -
list_append
-
new_bv
-
arg_var
-
formal_argument
-
is_private_local_id
-
shadowing_lvar
-
list_concat
-
splat_array
If node is a splat and it is splatting a literal array then return the literal array. Otherwise return null. This allows grammar to not splat into a Ruby Array if splatting a literal array. -
arg_append
-
allocateNamedLocals
-
compile_error
-
newRegexpNode
-
createMaster
-
associateEncoding
public static int associateEncoding(ByteList buffer, org.jcodings.Encoding newEncoding, int codeRange) -
negateNumeric
-
internalId
Deprecated.
-