docs/mapping

Mapping

When considering the previous CRuby parser versus YARP, this document should be helpful to understand how various concepts are mapped.

Nodes

The following table shows how the various CRuby nodes are mapped to YARP nodes.

CRuby YARP
NODE_SCOPE
NODE_BLOCK
NODE_IF YP_NODE_IF_NODE
NODE_UNLESS YP_NODE_UNLESS_NODE
NODE_CASE YP_NODE_CASE_NODE
NODE_CASE2 YP_NODE_CASE_NODE (with a null predicate)
NODE_CASE3
NODE_WHEN YP_NODE_WHEN_NODE
NODE_IN YP_NODE_IN_NODE
NODE_WHILE YP_NODE_WHILE_NODE
NODE_UNTIL YP_NODE_UNTIL_NODE
NODE_ITER YP_NODE_CALL_NODE (with a non-null block)
NODE_FOR YP_NODE_FOR_NODE
NODE_FOR_MASGN YP_NODE_FOR_NODE (with a multi-write node as the index)
NODE_BREAK YP_NODE_BREAK_NODE
NODE_NEXT YP_NODE_NEXT_NODE
NODE_REDO YP_NODE_REDO_NODE
NODE_RETRY YP_NODE_RETRY_NODE
NODE_BEGIN YP_NODE_BEGIN_NODE
NODE_RESCUE YP_NODE_RESCUE_NODE
NODE_RESBODY
NODE_ENSURE YP_NODE_ENSURE_NODE
NODE_AND YP_NODE_AND_NODE
NODE_OR YP_NODE_OR_NODE
NODE_MASGN YP_NODE_MULTI_WRITE_NODE
NODE_LASGN YP_NODE_LOCAL_VARIABLE_WRITE_NODE
NODE_DASGN YP_NODE_LOCAL_VARIABLE_WRITE_NODE
NODE_GASGN YP_NODE_GLOBAL_VARIABLE_WRITE_NODE
NODE_IASGN YP_NODE_INSTANCE_VARIABLE_WRITE_NODE
NODE_CDECL YP_NODE_CONSTANT_PATH_WRITE_NODE
NODE_CVASGN YP_NODE_CLASS_VARIABLE_WRITE_NODE
NODE_OP_ASGN1
NODE_OP_ASGN2
NODE_OP_ASGN_AND YP_NODE_OPERATOR_AND_ASSIGNMENT_NODE
NODE_OP_ASGN_OR YP_NODE_OPERATOR_OR_ASSIGNMENT_NODE
NODE_OP_CDECL
NODE_CALL YP_NODE_CALL_NODE
NODE_OPCALL YP_NODE_CALL_NODE (with an operator as the method)
NODE_FCALL YP_NODE_CALL_NODE (with a null receiver and parentheses)
NODE_VCALL YP_NODE_CALL_NODE (with a null receiver and parentheses or arguments)
NODE_QCALL YP_NODE_CALL_NODE (with a &. operator)
NODE_SUPER YP_NODE_SUPER_NODE
NODE_ZSUPER YP_NODE_FORWARDING_SUPER_NODE
NODE_LIST YP_NODE_ARRAY_NODE
NODE_ZLIST YP_NODE_ARRAY_NODE (with no child elements)
NODE_VALUES YP_NODE_ARGUMENTS_NODE
NODE_HASH YP_NODE_HASH_NODE
NODE_RETURN YP_NODE_RETURN_NODE
NODE_YIELD YP_NODE_YIELD_NODE
NODE_LVAR YP_NODE_LOCAL_VARIABLE_READ_NODE
NODE_DVAR YP_NODE_LOCAL_VARIABLE_READ_NODE
NODE_GVAR YP_NODE_GLOBAL_VARIABLE_READ_NODE
NODE_IVAR YP_NODE_INSTANCE_VARIABLE_READ_NODE
NODE_CONST YP_NODE_CONSTANT_PATH_READ_NODE
NODE_CVAR YP_NODE_CLASS_VARIABLE_READ_NODE
NODE_NTH_REF YP_NODE_NUMBERED_REFERENCE_READ_NODE
NODE_BACK_REF YP_NODE_BACK_REFERENCE_READ_NODE
NODE_MATCH
NODE_MATCH2 YP_NODE_CALL_NODE (with regular expression as receiver)
NODE_MATCH3 YP_NODE_CALL_NODE (with regular expression as only argument)
NODE_LIT
NODE_STR YP_NODE_STRING_NODE
NODE_DSTR YP_NODE_INTERPOLATED_STRING_NODE
NODE_XSTR YP_NODE_X_STRING_NODE
NODE_DXSTR YP_NODE_INTERPOLATED_X_STRING_NODE
NODE_EVSTR YP_NODE_STRING_INTERPOLATED_NODE
NODE_DREGX YP_NODE_INTERPOLATED_REGULAR_EXPRESSION_NODE
NODE_ONCE
NODE_ARGS YP_NODE_PARAMETERS_NODE
NODE_ARGS_AUX
NODE_OPT_ARG YP_NODE_OPTIONAL_PARAMETER_NODE
NODE_KW_ARG YP_NODE_KEYWORD_PARAMETER_NODE
NODE_POSTARG YP_NODE_REQUIRED_PARAMETER_NODE
NODE_ARGSCAT
NODE_ARGSPUSH
NODE_SPLAT YP_NODE_SPLAT_NODE
NODE_BLOCK_PASS YP_NODE_BLOCK_ARGUMENT_NODE
NODE_DEFN YP_NODE_DEF_NODE (with a null receiver)
NODE_DEFS YP_NODE_DEF_NODE (with a non-null receiver)
NODE_ALIAS YP_NODE_ALIAS_NODE
NODE_VALIAS YP_NODE_ALIAS_NODE (with a global variable first argument)
NODE_UNDEF YP_NODE_UNDEF_NODE
NODE_CLASS YP_NODE_CLASS_NODE
NODE_MODULE YP_NODE_MODULE_NODE
NODE_SCLASS YP_NODE_S_CLASS_NODE
NODE_COLON2 YP_NODE_CONSTANT_PATH_NODE
NODE_COLON3 YP_NODE_CONSTANT_PATH_NODE (with a null receiver)
NODE_DOT2 YP_NODE_RANGE_NODE (with a .. operator)
NODE_DOT3 YP_NODE_RANGE_NODE (with a … operator)
NODE_FLIP2 YP_NODE_RANGE_NODE (with a .. operator)
NODE_FLIP3 YP_NODE_RANGE_NODE (with a … operator)
NODE_SELF YP_NODE_SELF_NODE
NODE_NIL YP_NODE_NIL_NODE
NODE_TRUE YP_NODE_TRUE_NODE
NODE_FALSE YP_NODE_FALSE_NODE
NODE_ERRINFO
NODE_DEFINED YP_NODE_DEFINED_NODE
NODE_POSTEXE YP_NODE_POST_EXECUTION_NODE
NODE_DSYM YP_NODE_INTERPOLATED_SYMBOL_NODE
NODE_ATTRASGN YP_NODE_CALL_NODE (with a message that ends with =)
NODE_LAMBDA YP_NODE_LAMBDA_NODE
NODE_ARYPTN YP_NODE_ARRAY_PATTERN_NODE
NODE_HSHPTN YP_NODE_HASH_PATTERN_NODE
NODE_FNDPTN YP_NODE_FIND_PATTERN_NODE
NODE_ERROR YP_NODE_MISSING_NODE
NODE_LAST