Class RubyParserBase

java.lang.Object
org.jruby.parser.RubyParserBase
Direct Known Subclasses:
RubyParser

public abstract class RubyParserBase extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • reset

      public void reset()
    • getCurrentScope

      public StaticScope getCurrentScope()
    • popCurrentScope

      public void popCurrentScope()
    • pushBlockScope

      public void pushBlockScope()
    • pushLocalScope

      public void pushLocalScope()
    • numparam_push

      public Node numparam_push()
    • numparam_pop

      public void numparam_pop(Node previousInner)
    • args_with_numbered

      public ArgsNode args_with_numbered(ArgsNode args, int paramCount, Node itNode)
    • resetMaxNumParam

      public int resetMaxNumParam()
    • restoreMaxNumParam

      public int restoreMaxNumParam(int maxNum)
    • ordinalMaxNumParam

      public void ordinalMaxNumParam()
    • arg_concat

      public static Node arg_concat(Node node1, Node node2)
    • arg_blk_pass

      public static Node arg_blk_pass(Node firstNode, BlockPassNode secondNode)
    • gettable2

      public Node gettable2(Node node)
      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
    • hasNumParam

      public boolean hasNumParam()
    • numparam_name

      public void numparam_name(RubySymbol name)
    • numparam_name

      public void numparam_name(ByteList name)
    • declareIdentifier

      public Node declareIdentifier(ByteList byteName)
    • isArgsInfoEmpty

      public boolean isArgsInfoEmpty(ArgsNode argsNode)
    • assignableLabelOrIdentifier

      public AssignableNode assignableLabelOrIdentifier(ByteList byteName, Node value)
    • assignableKeyword

      public AssignableNode assignableKeyword(ByteList name, Node value)
    • getterIdentifierError

      protected void getterIdentifierError(RubySymbol identifier)
    • newline_node

      public Node newline_node(Node node, int line)
      Wraps node with NEWLINE node.
    • addRootNode

      public Node addRootNode(Node topOfAST)
    • appendToBlock

      public Node appendToBlock(Node head, Node tail)
    • assignableInCurr

      public AssignableNode assignableInCurr(ByteList nameBytes, Node value)
    • call_uni_op

      public Node call_uni_op(Node firstNode, ByteList operator)
    • call_bin_op

      public Node call_bin_op(Node firstNode, ByteList operator, Node secondNode)
    • call_bin_op

      public Node call_bin_op(Node firstNode, ByteList operator, Node secondNode, int defaultPosition)
    • new_defined

      public Node new_defined(long line, Node node)
    • match_op

      public Node match_op(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, ByteList 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
    • attrset

      public Node attrset(Node receiver, ByteList callType, ByteList name)
    • backref_error

      public void backref_error(Node node)
    • node_assign

      public static Node node_assign(Node lhs, Node rhs, LexContext _lexContext)
    • ret_args

      public Node ret_args(Node node, int line)
    • warnUnlessEOption

      public void warnUnlessEOption(IRubyWarnings.ID id, Node node, String message)
    • value_expr

      public boolean value_expr(Node node)
    • void_expr

      public void void_expr(Node node)
      Check to see if current node is an useless statement. If useless a warning if printed.
      Parameters:
      node - to be checked.
    • gettable

      public Node gettable(ByteList id)
    • void_stmts

      public Node void_stmts(Node node)
      Check all nodes but the last one in a BlockNode for useless (void context) statements.
      Parameters:
      node - to be checked.
    • makeNullNil

      protected Node makeNullNil(Node node)
    • cond

      public Node cond(Node node)
    • method_cond

      public Node method_cond(Node node)
    • new_if

      public Node new_if(int line, Node condition, Node thenNode, Node elseNode)
    • newSValueNode

      public SValueNode newSValueNode(int line, Node node)
    • newSplatNode

      public SplatNode newSplatNode(Node node)
    • newArrayNode

      public ArrayNode newArrayNode(int line, Node node)
    • position

      public int position(Node one, Node two)
    • logop

      public Node logop(Node left, ByteList op, Node right)
    • newCaseNode

      public static CaseNode newCaseNode(int line, Node expression, Node firstWhenNode)
      We post-process a chain of when nodes and analyze them to re-insert them back into our new CaseNode as a list. The grammar is more amenable to linked list style so we correct it at this point.
      Parameters:
      expression - of the case node (e.g. case foo)
      firstWhenNode - first when (which could also be the else)
      Returns:
      a new case node
    • newPatternCaseNode

      public static PatternCaseNode newPatternCaseNode(int line, Node expression, Node firstWhenNode)
    • newWhenNode

      public WhenNode newWhenNode(int line, Node expressionNodes, Node bodyNode, Node nextCase)
    • new_op_assign

      public Node new_op_assign(AssignableNode receiverNode, ByteList operatorName, Node valueNode, LexContext _lexContext)
    • new_ary_op_assign

      public Node new_ary_op_assign(Node receiverNode, Node argsNode, ByteList operatorName, Node valueNode)
    • new_attr_op_assign

      public Node new_attr_op_assign(Node receiverNode, ByteList callType, ByteList variableName, ByteList operatorName, Node valueNode)
    • new_const_op_assign

      public Node new_const_op_assign(int line, Node lhs, ByteList operatorName, Node rhs, LexContext _lexContext)
    • new_bodystmt

      public Node new_bodystmt(Node head, RescueBodyNode rescue, Node rescueElse, Node ensure)
    • symbolID

      public RubySymbol symbolID(ByteList identifierValue)
    • isLazy

      public boolean isLazy(String callType)
    • isLazy

      public boolean isLazy(ByteList callType)
    • new_attrassign

      public Node new_attrassign(int line, Node receiver, ByteList name, Node argsNode, boolean isLazy)
    • new_call

      public Node new_call(Node receiver, ByteList callType, ByteList name, Node argsNode, Node iter)
    • new_call

      public Node new_call(Node receiver, ByteList callType, ByteList name, Node argsNode, Node iter, int line)
    • new_call

      public Node new_call(Node receiver, ByteList name, Node argsNode, Node iter)
    • new_colon2

      public Colon2Node new_colon2(int line, Node leftNode, ByteList name)
    • new_colon3

      public Colon3Node new_colon3(int line, ByteList name)
    • frobnicate_fcall_args

      public void frobnicate_fcall_args(FCallNode fcall, Node args, Node iter)
    • fixpos

      public void fixpos(Node node, Node orig)
    • new_fcall

      public Node new_fcall(ByteList operation)
    • new_super

      public Node new_super(int line, Node args)
    • initTopLocalVariables

      public void initTopLocalVariables()
      Description of the RubyMethod
    • isEval

      protected boolean isEval()
    • finalizeDynamicScope

      public void finalizeDynamicScope()
    • getResult

      public RubyParserResult getResult()
      Gets the result.
      Returns:
      Returns a RubyParserResult
    • createDStrNode

      public DStrNode createDStrNode(int line)
    • createKeyValue

      public KeyValuePair<Node,Node> createKeyValue(Node key, Node value)
    • asSymbol

      public Node asSymbol(int line, ByteList value)
    • asSymbol

      public Node asSymbol(int line, Node value)
    • literal_concat

      public Node literal_concat(Node head, Node tail)
    • newRescueModNode

      public Node newRescueModNode(Node body, Node rescueBody)
    • newEvStrNode

      public Node newEvStrNode(int line, Node node)
    • new_yield

      public Node new_yield(int line, Node node)
    • negateInteger

      public NumericNode negateInteger(NumericNode integerNode)
    • negateFloat

      public FloatNode negateFloat(FloatNode floatNode)
    • negateComplexNode

      public ComplexNode negateComplexNode(ComplexNode complexNode)
    • negateRational

      public RationalNode negateRational(RationalNode rationalNode)
    • new_args

      public ArgsNode 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)
    • new_args_tail

      protected ArgsTailHolder new_args_tail(int line, ListNode keywordArg, ByteList keywordRestArgName, ByteList block)
    • remove_duplicate_keys

      public Node remove_duplicate_keys(HashNode hash)
    • newAlias

      public static Node newAlias(int line, Node newNode, Node oldNode)
    • newUndef

      public static Node newUndef(int line, Node nameNode)
    • yyerror

      public void yyerror(String message)
      generate parsing error
    • yyerror

      public void yyerror(String message, ProductionState state)
    • yyerror

      public void yyerror(String message, String[] expected, String found)
      generate parsing error
      Parameters:
      message - text to be displayed.
      expected - list of acceptable tokens, if available.
    • getPosition

      public int getPosition(Node start)
    • warn

      public void warn(String message)
    • warn

      public void warn(int line, String message)
    • warning

      public void warning(int line, String message)
    • warning

      public void warning(IRubyWarnings.ID id, String file, int line, String message)
    • is_local_id

      public static boolean is_local_id(ByteList name)
    • is_local_id

      @Deprecated public boolean is_local_id(String name)
      Deprecated.
    • list_append

      public ListNode list_append(Node list, Node item)
    • new_bv

      public Node new_bv(ByteList identifier)
    • arg_var

      public ArgumentNode arg_var(RubySymbol name)
    • arg_var

      public ArgumentNode arg_var(ByteList byteName)
    • formal_argument

      public ByteList formal_argument(ByteList identifier, Object _unused)
    • id_type

      public static RubyParserBase.IDType id_type(ByteList identifier)
    • is_private_local_id

      public static boolean is_private_local_id(ByteList name)
    • shadowing_lvar

      public ByteList shadowing_lvar(ByteList nameBytes)
    • list_concat

      public ListNode list_concat(Node first, Node second)
    • splat_array

      public Node splat_array(Node node)
      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

      public Node arg_append(Node node1, Node node2)
    • compile_error

      public void compile_error(String message)
    • new_regexp

      public Node new_regexp(int line, Node contents, RegexpNode end)
    • associateEncoding

      public static int associateEncoding(ByteList buffer, org.jcodings.Encoding newEncoding, int codeRange)
    • negateNumeric

      public NumericNode negateNumeric(NumericNode node)
    • internalId

      @Deprecated public String internalId()
      Deprecated.
    • begin_definition

      protected void begin_definition(String name)
    • push_pvtbl

      public Set<ByteList> push_pvtbl()
    • pop_pvtbl

      public void pop_pvtbl(Set<ByteList> table)
    • push_pktbl

      public Set<ByteList> push_pktbl()
    • pop_pktbl

      public void pop_pktbl(Set<ByteList> table)
    • newIn

      public Node newIn(int line, Node expression, Node body, Node nextCase)
    • endless_method_name

      public void endless_method_name(DefHolder name, ProductionState loc)
    • reduce_nodes

      public Node reduce_nodes(Node body)
    • restore_defun

      public void restore_defun(DefHolder holder)
    • new_array_pattern

      public ArrayPatternNode new_array_pattern(int line, Node constant, Node preArg, ArrayPatternNode arrayPattern)
    • new_hash_pattern

      public HashPatternNode new_hash_pattern(Node constant, HashPatternNode hashPatternNode)
    • none

      public HashNode none()
    • new_hash_pattern_tail

      public HashPatternNode new_hash_pattern_tail(int line, HashNode keywordArgs, ByteList keywordRestArg)
    • rescued_expr

      public Node rescued_expr(int line, Node arg, Node rescue)
    • new_array_pattern_tail

      public ArrayPatternNode new_array_pattern_tail(int line, ListNode preArgs, boolean hasRest, ByteList restArg, ListNode postArgs)
    • error_duplicate_pattern_key

      public void error_duplicate_pattern_key(ByteList key)
    • error_duplicate_pattern_variable

      public void error_duplicate_pattern_variable(ByteList variable)
    • new_find_pattern

      public Node new_find_pattern(Node constant, FindPatternNode findPattern)
    • new_find_pattern_tail

      public Node new_find_pattern_tail(int line, ByteList preRestArg, ListNode postArgs, ByteList postRestArg)
    • local_id

      public boolean local_id(ByteList value)
    • check_forwarding_args

      public boolean check_forwarding_args()
    • add_forwarding_args

      public void add_forwarding_args()
    • new_args_forward_call

      public Node new_args_forward_call(int line, Node leadingArgs)
    • check_literal_when

      public void check_literal_when(Node one)
    • last_arg_append

      public Node last_arg_append(Node args, Node lastArg)
    • rest_arg_append

      public Node rest_arg_append(Node args, Node restArg)
    • remove_begin

      public Node remove_begin(Node node)
    • nd_set_first_loc

      public void nd_set_first_loc(Node node, int line)
    • parse

      public RubyParserResult parse() throws IOException
      Throws:
      IOException
    • yyparse

      protected abstract Object yyparse(RubyLexer lexer, Object yyDebug) throws IOException
      Throws:
      IOException
    • getLexContext

      protected LexContext getLexContext()
    • setLexContext

      protected void setLexContext(LexContext lexContext)
    • src_line

      protected int src_line()
    • getHeredocIndent

      protected int getHeredocIndent()
    • setHeredocIndent

      protected void setHeredocIndent(int value)
    • getBraceNest

      protected int getBraceNest()
    • setBraceNest

      protected void setBraceNest(int value)
    • getState

      protected int getState()
    • setState

      protected void setState(int value)
    • getEncoding

      protected org.jcodings.Encoding getEncoding()
    • setCommandStart

      protected void setCommandStart(boolean value)
    • getCurrentArg

      protected ByteList getCurrentArg()
    • setCurrentArg

      protected void setCurrentArg(RubySymbol value)
    • createStr

      protected StrNode createStr(ByteList buffer, int flags)
    • getCmdArgumentState

      protected StackState getCmdArgumentState()
    • getConditionState

      protected StackState getConditionState()
    • getLeftParenBegin

      protected int getLeftParenBegin()
    • getParenNest

      protected int getParenNest()
    • extractByteList

      protected ByteList extractByteList(Object value)
    • setLeftParenBegin

      protected void setLeftParenBegin(int value)
    • getFile

      protected String getFile()
    • heredoc_dedent

      protected void heredoc_dedent(Node node)
    • getStrTerm

      protected StrTerm getStrTerm()
    • setStrTerm

      protected void setStrTerm(StrTerm value)
    • setHeredocLineIndent

      protected void setHeredocLineIndent(int indent)
    • cont_decl

      protected ConstDeclNode cont_decl(int position, INameNode constNode)
    • getRuntime

      public Ruby getRuntime()
    • nil

      public Node nil()
    • get_id

      public RubySymbol get_id(ByteList id)
    • getWarnings

      public IRubyWarnings getWarnings()
    • isEndSeen

      public boolean isEndSeen()
    • getStringStyle

      public StringStyle getStringStyle()
    • setStringStyle

      public void setStringStyle(Boolean frozen)
    • finalizeDynamicScope

      public DynamicScope finalizeDynamicScope(StaticScope staticScope)
    • getTopStaticScope

      public StaticScope getTopStaticScope(String file)
      Returns the static scope which represents the top of the parse. If an eval then we will have an existing scope to return. If not then we make a new one since we are starting from scratch.
      Parameters:
      file - to name top scope if we have a new scope
      Returns:
      a static scope
    • isCoverageEnabled

      public boolean isCoverageEnabled()
    • coverLine

      public void coverLine(int i)
      Zero out coverable lines as they're encountered
    • growCoverageLines

      public void growCoverageLines(int i)
      Called by coverLine to grow it large enough to add new covered line. Also called at end up parse to pick up any extra non-code lines which should be marked -1 for not valid code lines.
    • finishCoverage

      public CoverageData finishCoverage(String file, int lines)
      At end of a parse if coverage is enabled we will do final processing of the primitive coverage array and make sure runtimes coverage data has been updated with this new data.
    • token_info_setup

      protected void token_info_setup(String value, ProductionState loc)
    • token_info_push

      protected void token_info_push(String value, ProductionState loc)
    • token_info_pop

      protected void token_info_pop(String value, ProductionState loc)
    • token_info_drop

      protected void token_info_drop(String value, ProductionState loc)
    • token_info_warn

      protected void token_info_warn(String name, int same, ProductionState loc)
    • getTokenInfo

      protected TokenInfo getTokenInfo()
    • push_end_expect_token_locations

      protected void push_end_expect_token_locations(int line)
    • allow_block_exit

      protected NodeExits allow_block_exit()
    • clear_block_exit

      protected void clear_block_exit(boolean value)
    • next_rescue_context

      protected void next_rescue_context(LexContext context, LexContext.InRescue value)
    • it_id

      protected Node it_id()
    • set_it_id

      protected void set_it_id(Node node)
    • init_block_exit

      protected NodeExits init_block_exit()
    • restore_block_exit

      protected void restore_block_exit(NodeExits nodeExits)
    • NEW_ERROR

      protected Node NEW_ERROR(ProductionState loc)
    • forwarding_arg_check

      protected void forwarding_arg_check(ByteList rest, ByteList all, String var)
    • WARN_EOL

      protected void WARN_EOL(String name)
    • dyna_in_block

      protected boolean dyna_in_block()