kanayago 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/CHANGELOG.md +272 -0
 - data/README.md +1 -1
 - data/ext/kanayago/kanayago.c +32 -188
 - data/ext/kanayago/scope_node.c +2 -16
 - data/ext/kanayago/string_node.c +64 -23
 - data/ext/kanayago/variable_node.c +2 -1
 - data/lib/kanayago/call_node.rb +19 -0
 - data/lib/kanayago/constant_node.rb +15 -0
 - data/lib/kanayago/literal_node.rb +4 -0
 - data/lib/kanayago/scope_node.rb +14 -0
 - data/lib/kanayago/statement_node.rb +16 -0
 - data/lib/kanayago/variable_node.rb +4 -0
 - data/lib/kanayago/version.rb +1 -1
 - data/lib/kanayago.rb +3 -16
 - metadata +5 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: d25dec3b7633f7b58a2fe0ad33b1e6f05ef7e47bf5898d7b468a9bd60634c462
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: becaefd024bdf3b3a196c8971fac45211e69e13e2396d672d383795c98ca9038
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 3f7089b463e7a7a3024f6a249dec5902e8ca399826c996027f513b76e32ccb2f43c650f784c55354b2cb731c1cac00cd7c625a76e1c82b998e428872882ce0cd
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: bcaf717b512cff34f3b31e1cf08eaf23789a6c93469b55b0b466dacbd4227a8be372357b7f28926238fb8e1eab014b476f30b1bd32033222ed7f014c7793823f
         
     | 
    
        data/CHANGELOG.md
    ADDED
    
    | 
         @@ -0,0 +1,272 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Changelog
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            All notable changes to this project will be documented in this file.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
         
     | 
| 
      
 6 
     | 
    
         
            +
            and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            ## [Unreleased]
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            ## [0.4.1]
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            ### Fixed
         
     | 
| 
      
 13 
     | 
    
         
            +
            - Fix segmentation fault when parsing dynamic symbols in complex hash structures
         
     | 
| 
      
 14 
     | 
    
         
            +
            - Fix segmentation fault when parsing nested modules with outer constant references
         
     | 
| 
      
 15 
     | 
    
         
            +
            - Fix `module_node_new` to use `RNODE_MODULE` instead of incorrect `RNODE_CLASS` macro
         
     | 
| 
      
 16 
     | 
    
         
            +
            - Add NULL pointer checks in `dynamic_string_node_new`, `dynamic_symbol_node_new`, `dynamic_execute_string_node_new`, and `dynamic_regexp_node_new`
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            ### Changed
         
     | 
| 
      
 19 
     | 
    
         
            +
            - Remove incorrect `@super` field access from `ModuleNode` (modules do not have superclasses)
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            ## [0.4.0]
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            ### Added
         
     | 
| 
      
 24 
     | 
    
         
            +
            - Add Ruby class definitions for previously C-only AST nodes:
         
     | 
| 
      
 25 
     | 
    
         
            +
              - `ScopeNode` - Scope representation with args and body
         
     | 
| 
      
 26 
     | 
    
         
            +
              - `ClassNode` - Class definition with cpath, super, and body
         
     | 
| 
      
 27 
     | 
    
         
            +
              - `ModuleNode` - Module definition with cpath, super, and body
         
     | 
| 
      
 28 
     | 
    
         
            +
              - `DefinitionNode` - Method definition with mid and defn
         
     | 
| 
      
 29 
     | 
    
         
            +
              - `BeginNode` - Begin statement with body
         
     | 
| 
      
 30 
     | 
    
         
            +
              - `SelfNode` - Self reference with state
         
     | 
| 
      
 31 
     | 
    
         
            +
              - `ConstantNode` - Constant reference with vid
         
     | 
| 
      
 32 
     | 
    
         
            +
              - `OperatorCallNode` - Operator method call with recv, mid, and args
         
     | 
| 
      
 33 
     | 
    
         
            +
              - `CallNode` - Method call with recv, mid, and args
         
     | 
| 
      
 34 
     | 
    
         
            +
              - `FunctionCallNode` - Function call with mid and args
         
     | 
| 
      
 35 
     | 
    
         
            +
              - `VariableCallNode` - Variable call with mid
         
     | 
| 
      
 36 
     | 
    
         
            +
              - `ArgumentsNode` - Arguments information with ainfo hash
         
     | 
| 
      
 37 
     | 
    
         
            +
              - `BlockNode` - Block representation (inherits from Array)
         
     | 
| 
      
 38 
     | 
    
         
            +
              - `ConstantDeclarationNode` - Constant declaration with vid, else, and value
         
     | 
| 
      
 39 
     | 
    
         
            +
              - `Colon2Node` - Scoped constant resolution (::) with mid and head
         
     | 
| 
      
 40 
     | 
    
         
            +
              - `Colon3Node` - Top-level constant resolution (::) with mid
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            ### Changed
         
     | 
| 
      
 43 
     | 
    
         
            +
            - Use `rb_intern("@...")` instead of `symbol()` macro for instance variable access in C layer
         
     | 
| 
      
 44 
     | 
    
         
            +
            - Remove redundant getter methods from C layer (scope_node.c and kanayago.c)
         
     | 
| 
      
 45 
     | 
    
         
            +
            - Rely on Ruby's `attr_reader` for attribute access instead of C-defined methods
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            ### Fixed
         
     | 
| 
      
 48 
     | 
    
         
            +
            - Fix SEGV in args_ainfo_tohash function
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            ## [0.3.0] - 2025-10-25
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            ### Fixed
         
     | 
| 
      
 53 
     | 
    
         
            +
            - Fix gem install kanayago
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            ## [0.2.0] - 2025-10-25
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
            ### Added
         
     | 
| 
      
 58 
     | 
    
         
            +
            - Add sample for Kanayago usecase
         
     | 
| 
      
 59 
     | 
    
         
            +
            - Support NODE_FOR_MASGN, NODE_MASGN, NODE_DASGN, NODE_ONCE, NODE_ERRINFO, NODE_POSTEXE, and NODE_ERROR
         
     | 
| 
      
 60 
     | 
    
         
            +
            - Support NODE_ARGS_AUX, NODE_OPT_ARG, NODE_KW_ARG, NODE_POSTARG, NODE_ARGSCAT, and NODE_ARGSPUSH
         
     | 
| 
      
 61 
     | 
    
         
            +
            - Support NODE_SPLAT and NODE_BLOCK_PASS
         
     | 
| 
      
 62 
     | 
    
         
            +
            - Support NODE_YIELD and NODE_LAMBDA
         
     | 
| 
      
 63 
     | 
    
         
            +
            - Support NODE_OP_ASGN1, NODE_OP_ASGN2, NODE_OP_ASGN_AND, NODE_OP_ASGN_OR and NODE_OP_CDECL
         
     | 
| 
      
 64 
     | 
    
         
            +
            - Support NODE_NTH_REF and NODE_BACK_REF
         
     | 
| 
      
 65 
     | 
    
         
            +
            - Support NODE_DVAR
         
     | 
| 
      
 66 
     | 
    
         
            +
            - Support NODE_DSYM
         
     | 
| 
      
 67 
     | 
    
         
            +
            - Support NODE_BREAK and NODE_NEXT
         
     | 
| 
      
 68 
     | 
    
         
            +
            - Support NODE_REDO
         
     | 
| 
      
 69 
     | 
    
         
            +
            - Support NODE_DEFINED
         
     | 
| 
      
 70 
     | 
    
         
            +
            - Support NODE_ITER, NODE_RETRY, NODE_RESCUE, NODE_RESBODY and NODE_ENSURE
         
     | 
| 
      
 71 
     | 
    
         
            +
            - Support NODE_HASH, NODE_IN, NODE_ARYPTN, NODE_HSHPTN and NODE_FNDPTN
         
     | 
| 
      
 72 
     | 
    
         
            +
            - Support NODE_MATCH, NODE_MATCH2 and NODE_MATCH3
         
     | 
| 
      
 73 
     | 
    
         
            +
            - Support NODE_REGX and NODE_DREGX
         
     | 
| 
      
 74 
     | 
    
         
            +
            - Support NODE_XSTR and NODE_DXSTR
         
     | 
| 
      
 75 
     | 
    
         
            +
            - Support NODE_FLIP2 and NODE_FLIP3
         
     | 
| 
      
 76 
     | 
    
         
            +
            - Support NODE_DOT2 and NODE_DOT3
         
     | 
| 
      
 77 
     | 
    
         
            +
            - Support NODE_CASE, NODE_CASE2, NODE_CASE3 and NODE_WHEN
         
     | 
| 
      
 78 
     | 
    
         
            +
            - Support NODE_QCALL, NODE_SUPER and NODE_ZSUPER
         
     | 
| 
      
 79 
     | 
    
         
            +
            - Support NODE_DEFS, NODE_SCLASS and NODE_ATTRASGN
         
     | 
| 
      
 80 
     | 
    
         
            +
            - Support NODE_COLON3
         
     | 
| 
      
 81 
     | 
    
         
            +
            - Support NODE_VCALL
         
     | 
| 
      
 82 
     | 
    
         
            +
            - Support NODE_CVASGN
         
     | 
| 
      
 83 
     | 
    
         
            +
            - Support NODE_IASGN
         
     | 
| 
      
 84 
     | 
    
         
            +
            - Support NODE_DSTR and NODE_EVSTR
         
     | 
| 
      
 85 
     | 
    
         
            +
            - Support NODE_GASGN
         
     | 
| 
      
 86 
     | 
    
         
            +
            - Support NODE_RETURN
         
     | 
| 
      
 87 
     | 
    
         
            +
            - Support NODE_UNDEF
         
     | 
| 
      
 88 
     | 
    
         
            +
            - Support NODE_VALIAS
         
     | 
| 
      
 89 
     | 
    
         
            +
            - Support NODE_ALIAS
         
     | 
| 
      
 90 
     | 
    
         
            +
            - Support NODE_FOR
         
     | 
| 
      
 91 
     | 
    
         
            +
            - Support NODE_UNTIL
         
     | 
| 
      
 92 
     | 
    
         
            +
            - Add NODE_WHILE test
         
     | 
| 
      
 93 
     | 
    
         
            +
            - Support NODE_WHILE
         
     | 
| 
      
 94 
     | 
    
         
            +
            - Support NODE_CVAR
         
     | 
| 
      
 95 
     | 
    
         
            +
            - Introduce debug.gem
         
     | 
| 
      
 96 
     | 
    
         
            +
            - Support NODE_MODULE
         
     | 
| 
      
 97 
     | 
    
         
            +
            - Support NODE_SELF
         
     | 
| 
      
 98 
     | 
    
         
            +
            - Support NODE_GVAR
         
     | 
| 
      
 99 
     | 
    
         
            +
            - Support NODE_AND
         
     | 
| 
      
 100 
     | 
    
         
            +
            - Support NODE_OR
         
     | 
| 
      
 101 
     | 
    
         
            +
            - Support NODE_FALSE
         
     | 
| 
      
 102 
     | 
    
         
            +
            - Support NODE_TRUE
         
     | 
| 
      
 103 
     | 
    
         
            +
            - Support NODE_NIL
         
     | 
| 
      
 104 
     | 
    
         
            +
            - Support NODE_ENCODING
         
     | 
| 
      
 105 
     | 
    
         
            +
            - Add typeprof.conf.json
         
     | 
| 
      
 106 
     | 
    
         
            +
            - Support NODE_ZLIST
         
     | 
| 
      
 107 
     | 
    
         
            +
            - Introduce TypeProf for development
         
     | 
| 
      
 108 
     | 
    
         
            +
            - Support __LINE__ literal node
         
     | 
| 
      
 109 
     | 
    
         
            +
            - Support __FILE__ literal node
         
     | 
| 
      
 110 
     | 
    
         
            +
            - Support Ruby 3.4
         
     | 
| 
      
 111 
     | 
    
         
            +
            - Introduce Kanayago gem build and install CI
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
            ### Changed
         
     | 
| 
      
 114 
     | 
    
         
            +
            - Update RuboCop
         
     | 
| 
      
 115 
     | 
    
         
            +
            - Split kanayago.patch file to more easier maintain multi Ruby Parser
         
     | 
| 
      
 116 
     | 
    
         
            +
            - Update bin/setup
         
     | 
| 
      
 117 
     | 
    
         
            +
            - Use Node class attr_reader to access Node values
         
     | 
| 
      
 118 
     | 
    
         
            +
            - Split Literal Node code
         
     | 
| 
      
 119 
     | 
    
         
            +
            - Split Kanayago::ScopeNode code
         
     | 
| 
      
 120 
     | 
    
         
            +
            - Update README.md
         
     | 
| 
      
 121 
     | 
    
         
            +
            - Update test CI
         
     | 
| 
      
 122 
     | 
    
         
            +
            - Update kanayago.patch
         
     | 
| 
      
 123 
     | 
    
         
            +
            - Improve import Ruby Parser file's
         
     | 
| 
      
 124 
     | 
    
         
            +
            - Update RuboCop setting
         
     | 
| 
      
 125 
     | 
    
         
            +
            - Migrate to Kanayago parsed AST hash to Instance
         
     | 
| 
      
 126 
     | 
    
         
            +
            - Update kanayago.patch for Ruby head build
         
     | 
| 
      
 127 
     | 
    
         
            +
            - Update CI flow
         
     | 
| 
      
 128 
     | 
    
         
            +
            - Update Kanayago build flow
         
     | 
| 
      
 129 
     | 
    
         
            +
            - Update Ruby Parser's file
         
     | 
| 
      
 130 
     | 
    
         
            +
            - Update lrama
         
     | 
| 
      
 131 
     | 
    
         
            +
            - Split file for Variable Node's
         
     | 
| 
      
 132 
     | 
    
         
            +
            - Move Statement Node class definition
         
     | 
| 
      
 133 
     | 
    
         
            +
            - Rename LeftAssignNode to LocalAssignmentNode
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
            ### Fixed
         
     | 
| 
      
 136 
     | 
    
         
            +
            - Fix RuboCop Lint error
         
     | 
| 
      
 137 
     | 
    
         
            +
            - Fix NODE_IF attributes access
         
     | 
| 
      
 138 
     | 
    
         
            +
            - Fix Kanayago::ListNode holds data
         
     | 
| 
      
 139 
     | 
    
         
            +
            - Fix NODE_FOR loop
         
     | 
| 
      
 140 
     | 
    
         
            +
            - Fix Ruby head build failure
         
     | 
| 
      
 141 
     | 
    
         
            +
            - Add internal/namespace.h for Ruby head Parser dependency
         
     | 
| 
      
 142 
     | 
    
         
            +
            - Fix RuboCop SEGV in Ruby head
         
     | 
| 
      
 143 
     | 
    
         
            +
            - Apply auto correct
         
     | 
| 
      
 144 
     | 
    
         
            +
            - Update json
         
     | 
| 
      
 145 
     | 
    
         
            +
            - Update zlib
         
     | 
| 
      
 146 
     | 
    
         
            +
            - Fix CI failures
         
     | 
| 
      
 147 
     | 
    
         
            +
            - Add ext/kanayago/probes.h
         
     | 
| 
      
 148 
     | 
    
         
            +
            - Fix Ruby 3.4 dependency
         
     | 
| 
      
 149 
     | 
    
         
            +
            - Fix Ruby 3.4 build
         
     | 
| 
      
 150 
     | 
    
         
            +
            - Fix file copy error handling
         
     | 
| 
      
 151 
     | 
    
         
            +
            - Fix build gem
         
     | 
| 
      
 152 
     | 
    
         
            +
            - Add dependency for Universal Parser
         
     | 
| 
      
 153 
     | 
    
         
            +
            - Fix code lint
         
     | 
| 
      
 154 
     | 
    
         
            +
             
     | 
| 
      
 155 
     | 
    
         
            +
            ### Removed
         
     | 
| 
      
 156 
     | 
    
         
            +
            - Remove unneeded comment
         
     | 
| 
      
 157 
     | 
    
         
            +
            - Remove Lrama that unneeded any more
         
     | 
| 
      
 158 
     | 
    
         
            +
             
     | 
| 
      
 159 
     | 
    
         
            +
            ### CI
         
     | 
| 
      
 160 
     | 
    
         
            +
            - Add fail-fast: false
         
     | 
| 
      
 161 
     | 
    
         
            +
            - Suppress already initialized constant warning
         
     | 
| 
      
 162 
     | 
    
         
            +
             
     | 
| 
      
 163 
     | 
    
         
            +
            ## [0.1.1] - 2024-09-06
         
     | 
| 
      
 164 
     | 
    
         
            +
             
     | 
| 
      
 165 
     | 
    
         
            +
            ### Changed
         
     | 
| 
      
 166 
     | 
    
         
            +
            - Bump up v0.1.1
         
     | 
| 
      
 167 
     | 
    
         
            +
             
     | 
| 
      
 168 
     | 
    
         
            +
            ## [0.1.0] - 2024-09-06
         
     | 
| 
      
 169 
     | 
    
         
            +
             
     | 
| 
      
 170 
     | 
    
         
            +
            ### Added
         
     | 
| 
      
 171 
     | 
    
         
            +
            - Support NODE_UNLESS
         
     | 
| 
      
 172 
     | 
    
         
            +
            - Add class description
         
     | 
| 
      
 173 
     | 
    
         
            +
            - Add rubocop check in CI
         
     | 
| 
      
 174 
     | 
    
         
            +
            - Add rubocop-on-rbs
         
     | 
| 
      
 175 
     | 
    
         
            +
            - Add rubocop-rake
         
     | 
| 
      
 176 
     | 
    
         
            +
            - Add rubocop and rubocop-minitest for development
         
     | 
| 
      
 177 
     | 
    
         
            +
            - Add refine_tree_parse module function
         
     | 
| 
      
 178 
     | 
    
         
            +
            - Support NODE_IVAR
         
     | 
| 
      
 179 
     | 
    
         
            +
            - Add Referenced implementations link
         
     | 
| 
      
 180 
     | 
    
         
            +
            - Support NODE_SYM
         
     | 
| 
      
 181 
     | 
    
         
            +
            - Support method definition
         
     | 
| 
      
 182 
     | 
    
         
            +
            - Add NODE_CONST test
         
     | 
| 
      
 183 
     | 
    
         
            +
            - Support NODE_CDECL
         
     | 
| 
      
 184 
     | 
    
         
            +
            - Support NODE_CONST
         
     | 
| 
      
 185 
     | 
    
         
            +
            - Support NODE_IF
         
     | 
| 
      
 186 
     | 
    
         
            +
            - Support NODE_LVAR
         
     | 
| 
      
 187 
     | 
    
         
            +
            - Add gdb rake task
         
     | 
| 
      
 188 
     | 
    
         
            +
            - Support NODE_FCALL
         
     | 
| 
      
 189 
     | 
    
         
            +
            - Introduce literal_node_to_hash function for get literal node value
         
     | 
| 
      
 190 
     | 
    
         
            +
            - Support NODE_LASGN
         
     | 
| 
      
 191 
     | 
    
         
            +
            - Add NODE_STR parse test
         
     | 
| 
      
 192 
     | 
    
         
            +
            - Add NODE_IMAGINARY parse test
         
     | 
| 
      
 193 
     | 
    
         
            +
            - Add NODE_RATIONAL parse test
         
     | 
| 
      
 194 
     | 
    
         
            +
            - Add NODE_FLOAT parse test
         
     | 
| 
      
 195 
     | 
    
         
            +
            - Add parse NODE_INTEGER test
         
     | 
| 
      
 196 
     | 
    
         
            +
            - Add GitHub Actions for test
         
     | 
| 
      
 197 
     | 
    
         
            +
            - Add Ruby's Parser files
         
     | 
| 
      
 198 
     | 
    
         
            +
            - Add run task for running test.rb
         
     | 
| 
      
 199 
     | 
    
         
            +
            - Add test for NODE_INTEGER
         
     | 
| 
      
 200 
     | 
    
         
            +
            - Support NODE_CALL
         
     | 
| 
      
 201 
     | 
    
         
            +
            - Support NODE_STR
         
     | 
| 
      
 202 
     | 
    
         
            +
            - Support NODE_IMAGINARY
         
     | 
| 
      
 203 
     | 
    
         
            +
            - Support NODE_BLOCK
         
     | 
| 
      
 204 
     | 
    
         
            +
            - Support NODE_RATIONAL
         
     | 
| 
      
 205 
     | 
    
         
            +
            - Support NODE_FLOAT
         
     | 
| 
      
 206 
     | 
    
         
            +
            - Support NODE_OPCALL and NODE_LIST
         
     | 
| 
      
 207 
     | 
    
         
            +
            - Parse Ruby code and return Hash
         
     | 
| 
      
 208 
     | 
    
         
            +
            - Build Mjollnir with Ruby Parser
         
     | 
| 
      
 209 
     | 
    
         
            +
            - Build ruby-parser for Mjollnir
         
     | 
| 
      
 210 
     | 
    
         
            +
            - Add ruby_parser:build task
         
     | 
| 
      
 211 
     | 
    
         
            +
            - Add lex.c generation for ruby_parser:import task
         
     | 
| 
      
 212 
     | 
    
         
            +
            - Add ruby_parser:clean task
         
     | 
| 
      
 213 
     | 
    
         
            +
            - Add Mjollnir.parse method
         
     | 
| 
      
 214 
     | 
    
         
            +
            - Import ruby parser
         
     | 
| 
      
 215 
     | 
    
         
            +
            - Add lrama
         
     | 
| 
      
 216 
     | 
    
         
            +
            - Add 金屋子 for README.md
         
     | 
| 
      
 217 
     | 
    
         
            +
             
     | 
| 
      
 218 
     | 
    
         
            +
            ### Changed
         
     | 
| 
      
 219 
     | 
    
         
            +
            - Rename parse to kanayago_parse
         
     | 
| 
      
 220 
     | 
    
         
            +
            - Using test-queue
         
     | 
| 
      
 221 
     | 
    
         
            +
            - Auto correct to Gemfile
         
     | 
| 
      
 222 
     | 
    
         
            +
            - Auto correct Hash
         
     | 
| 
      
 223 
     | 
    
         
            +
            - Fix required_ruby_version to > 3.3.0
         
     | 
| 
      
 224 
     | 
    
         
            +
            - Rename to Kanayago
         
     | 
| 
      
 225 
     | 
    
         
            +
            - Ignore refine_tree.gemspec in Metrics/BlockLength
         
     | 
| 
      
 226 
     | 
    
         
            +
            - Format Rakefile
         
     | 
| 
      
 227 
     | 
    
         
            +
            - Rename sig/refine_tree.rb to sig/refine_tree.rbs
         
     | 
| 
      
 228 
     | 
    
         
            +
            - require rubocop-minitest and rubocop-rake
         
     | 
| 
      
 229 
     | 
    
         
            +
            - Generate .rubocop.yml and .rubocop_todo.yml
         
     | 
| 
      
 230 
     | 
    
         
            +
            - Move minitest to test group in Gemfile
         
     | 
| 
      
 231 
     | 
    
         
            +
            - Change to key type from String to Symbol
         
     | 
| 
      
 232 
     | 
    
         
            +
            - Fix require path for test
         
     | 
| 
      
 233 
     | 
    
         
            +
            - Fix install gem name
         
     | 
| 
      
 234 
     | 
    
         
            +
            - Rename to RefineTree
         
     | 
| 
      
 235 
     | 
    
         
            +
            - Fix GitHub Actions
         
     | 
| 
      
 236 
     | 
    
         
            +
            - Add PATH for GitHub Actions
         
     | 
| 
      
 237 
     | 
    
         
            +
            - Add install check for GitHub Actions
         
     | 
| 
      
 238 
     | 
    
         
            +
            - Add depend task for rake build and rake install
         
     | 
| 
      
 239 
     | 
    
         
            +
            - Fix Mjollnir.parse sample in README.md
         
     | 
| 
      
 240 
     | 
    
         
            +
            - Fix username in README.md
         
     | 
| 
      
 241 
     | 
    
         
            +
            - Merge Ruby's Parser struct and enum definition for Mjollnir
         
     | 
| 
      
 242 
     | 
    
         
            +
            - Fix Mjollnir gem summary and description
         
     | 
| 
      
 243 
     | 
    
         
            +
            - Fix gem's description
         
     | 
| 
      
 244 
     | 
    
         
            +
            - Fix README.md
         
     | 
| 
      
 245 
     | 
    
         
            +
            - Fix Mjollnir gem build and install
         
     | 
| 
      
 246 
     | 
    
         
            +
            - Apply RuboCop auto correct to Gemfile
         
     | 
| 
      
 247 
     | 
    
         
            +
            - Apply RuboCop auto correct for test helper
         
     | 
| 
      
 248 
     | 
    
         
            +
            - Apply RuboCop auto correct
         
     | 
| 
      
 249 
     | 
    
         
            +
            - Fix Mjollnir build
         
     | 
| 
      
 250 
     | 
    
         
            +
            - Update TODO's
         
     | 
| 
      
 251 
     | 
    
         
            +
             
     | 
| 
      
 252 
     | 
    
         
            +
            ### Fixed
         
     | 
| 
      
 253 
     | 
    
         
            +
            - Fix SEGV
         
     | 
| 
      
 254 
     | 
    
         
            +
            - Fix NODE_BLOCK support
         
     | 
| 
      
 255 
     | 
    
         
            +
            - Remove allowed_push_host
         
     | 
| 
      
 256 
     | 
    
         
            +
            - Remove parse.c and parse.h
         
     | 
| 
      
 257 
     | 
    
         
            +
            - Ignore parse.c and parse.h
         
     | 
| 
      
 258 
     | 
    
         
            +
            - Fix gem name in GitHub Action
         
     | 
| 
      
 259 
     | 
    
         
            +
             
     | 
| 
      
 260 
     | 
    
         
            +
            ### Removed
         
     | 
| 
      
 261 
     | 
    
         
            +
            - Remove uneeded file
         
     | 
| 
      
 262 
     | 
    
         
            +
            - Remove unnecessary include header
         
     | 
| 
      
 263 
     | 
    
         
            +
            - Remove unnecessary code in Rakefile
         
     | 
| 
      
 264 
     | 
    
         
            +
            - Remove ext/mjollnir/ruby-parser directory
         
     | 
| 
      
 265 
     | 
    
         
            +
            - Remove uneeded headers
         
     | 
| 
      
 266 
     | 
    
         
            +
            - Remove gem build for CI
         
     | 
| 
      
 267 
     | 
    
         
            +
             
     | 
| 
      
 268 
     | 
    
         
            +
            ### Internal
         
     | 
| 
      
 269 
     | 
    
         
            +
            - Suppress warning
         
     | 
| 
      
 270 
     | 
    
         
            +
            - Add newline
         
     | 
| 
      
 271 
     | 
    
         
            +
            - Some refactor for mjollnir.c
         
     | 
| 
      
 272 
     | 
    
         
            +
            - Using rb_ruby_ast_data_get function
         
     | 
    
        data/README.md
    CHANGED
    
    
    
        data/ext/kanayago/kanayago.c
    CHANGED
    
    | 
         @@ -33,84 +33,36 @@ operator_call_node_new(const NODE *node) 
     | 
|
| 
       33 
33 
     | 
    
         
             
            {
         
     | 
| 
       34 
34 
     | 
    
         
             
                VALUE obj = rb_class_new_instance(0, 0, rb_cOperatorCallNode);
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
                rb_ivar_set(obj,  
     | 
| 
       37 
     | 
    
         
            -
                rb_ivar_set(obj,  
     | 
| 
       38 
     | 
    
         
            -
                rb_ivar_set(obj,  
     | 
| 
      
 36 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@recv"), ast_to_node_instance(RNODE_OPCALL(node)->nd_recv));
         
     | 
| 
      
 37 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@mid"), ID2SYM(RNODE_OPCALL(node)->nd_mid));
         
     | 
| 
      
 38 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@args"), ast_to_node_instance(RNODE_OPCALL(node)->nd_args));
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
40 
     | 
    
         
             
                return obj;
         
     | 
| 
       41 
41 
     | 
    
         
             
            }
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       44 
     | 
    
         
            -
            operator_call_node_recv_get(VALUE self)
         
     | 
| 
       45 
     | 
    
         
            -
            {
         
     | 
| 
       46 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("recv"));
         
     | 
| 
       47 
     | 
    
         
            -
            }
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       50 
     | 
    
         
            -
            operator_call_node_mid_get(VALUE self)
         
     | 
| 
       51 
     | 
    
         
            -
            {
         
     | 
| 
       52 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("mid"));
         
     | 
| 
       53 
     | 
    
         
            -
            }
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       56 
     | 
    
         
            -
            operator_call_node_args_get(VALUE self)
         
     | 
| 
       57 
     | 
    
         
            -
            {
         
     | 
| 
       58 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("args"));
         
     | 
| 
       59 
     | 
    
         
            -
            }
         
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
43 
     | 
    
         
             
            static VALUE
         
     | 
| 
       62 
44 
     | 
    
         
             
            call_node_new(const NODE *node)
         
     | 
| 
       63 
45 
     | 
    
         
             
            {
         
     | 
| 
       64 
46 
     | 
    
         
             
                VALUE result = rb_class_new_instance(0, 0, rb_cCallNode);
         
     | 
| 
       65 
47 
     | 
    
         | 
| 
       66 
     | 
    
         
            -
                rb_ivar_set(result,  
     | 
| 
       67 
     | 
    
         
            -
                rb_ivar_set(result,  
     | 
| 
       68 
     | 
    
         
            -
                rb_ivar_set(result,  
     | 
| 
      
 48 
     | 
    
         
            +
                rb_ivar_set(result, rb_intern("@recv"), ast_to_node_instance(RNODE_OPCALL(node)->nd_recv));
         
     | 
| 
      
 49 
     | 
    
         
            +
                rb_ivar_set(result, rb_intern("@mid"), ID2SYM(RNODE_CALL(node)->nd_mid));
         
     | 
| 
      
 50 
     | 
    
         
            +
                rb_ivar_set(result, rb_intern("@args"), ast_to_node_instance(RNODE_CALL(node)->nd_args));
         
     | 
| 
       69 
51 
     | 
    
         | 
| 
       70 
52 
     | 
    
         
             
                return result;
         
     | 
| 
       71 
53 
     | 
    
         
             
            }
         
     | 
| 
       72 
54 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       74 
     | 
    
         
            -
            call_node_recv_get(VALUE self)
         
     | 
| 
       75 
     | 
    
         
            -
            {
         
     | 
| 
       76 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("recv"));
         
     | 
| 
       77 
     | 
    
         
            -
            }
         
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       80 
     | 
    
         
            -
            call_node_mid_get(VALUE self)
         
     | 
| 
       81 
     | 
    
         
            -
            {
         
     | 
| 
       82 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("mid"));
         
     | 
| 
       83 
     | 
    
         
            -
            }
         
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       86 
     | 
    
         
            -
            call_node_args_get(VALUE self)
         
     | 
| 
       87 
     | 
    
         
            -
            {
         
     | 
| 
       88 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("args"));
         
     | 
| 
       89 
     | 
    
         
            -
            }
         
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
55 
     | 
    
         
             
            static VALUE
         
     | 
| 
       92 
56 
     | 
    
         
             
            function_call_node_new(const NODE *node)
         
     | 
| 
       93 
57 
     | 
    
         
             
            {
         
     | 
| 
       94 
58 
     | 
    
         
             
                VALUE obj = rb_class_new_instance(0, 0, rb_cFunctionCallNode);
         
     | 
| 
       95 
59 
     | 
    
         | 
| 
       96 
     | 
    
         
            -
                rb_ivar_set(obj,  
     | 
| 
       97 
     | 
    
         
            -
                rb_ivar_set(obj,  
     | 
| 
      
 60 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@mid"), ID2SYM(RNODE_FCALL(node)->nd_mid));
         
     | 
| 
      
 61 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@args"), ast_to_node_instance(RNODE_FCALL(node)->nd_args));
         
     | 
| 
       98 
62 
     | 
    
         | 
| 
       99 
63 
     | 
    
         
             
                return obj;
         
     | 
| 
       100 
64 
     | 
    
         
             
            }
         
     | 
| 
       101 
65 
     | 
    
         | 
| 
       102 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       103 
     | 
    
         
            -
            function_call_node_mid_get(VALUE self)
         
     | 
| 
       104 
     | 
    
         
            -
            {
         
     | 
| 
       105 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("mid"));
         
     | 
| 
       106 
     | 
    
         
            -
            }
         
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       109 
     | 
    
         
            -
            function_call_node_args_get(VALUE self)
         
     | 
| 
       110 
     | 
    
         
            -
            {
         
     | 
| 
       111 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("args"));
         
     | 
| 
       112 
     | 
    
         
            -
            }
         
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
66 
     | 
    
         
             
            static VALUE
         
     | 
| 
       115 
67 
     | 
    
         
             
            variable_call_node_new(const NODE *node)
         
     | 
| 
       116 
68 
     | 
    
         
             
            {
         
     | 
| 
         @@ -121,12 +73,6 @@ variable_call_node_new(const NODE *node) 
     | 
|
| 
       121 
73 
     | 
    
         
             
                return obj;
         
     | 
| 
       122 
74 
     | 
    
         
             
            }
         
     | 
| 
       123 
75 
     | 
    
         | 
| 
       124 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       125 
     | 
    
         
            -
            variable_call_node_mid_get(VALUE self)
         
     | 
| 
       126 
     | 
    
         
            -
            {
         
     | 
| 
       127 
     | 
    
         
            -
                return rb_ivar_get(self, rb_intern("@mid"));
         
     | 
| 
       128 
     | 
    
         
            -
            }
         
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
       130 
76 
     | 
    
         
             
            static VALUE
         
     | 
| 
       131 
77 
     | 
    
         
             
            list_node_new(const NODE *node)
         
     | 
| 
       132 
78 
     | 
    
         
             
            {
         
     | 
| 
         @@ -151,24 +97,12 @@ definition_node_new(const NODE *node) 
     | 
|
| 
       151 
97 
     | 
    
         
             
            {
         
     | 
| 
       152 
98 
     | 
    
         
             
                VALUE obj = rb_class_new_instance(0, 0, rb_cDefinitionNode);
         
     | 
| 
       153 
99 
     | 
    
         | 
| 
       154 
     | 
    
         
            -
                rb_ivar_set(obj,  
     | 
| 
       155 
     | 
    
         
            -
                rb_ivar_set(obj,  
     | 
| 
      
 100 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@mid"), ID2SYM(RNODE_DEFN(node)->nd_mid));
         
     | 
| 
      
 101 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@defn"), ast_to_node_instance(RNODE_DEFN(node)->nd_defn));
         
     | 
| 
       156 
102 
     | 
    
         | 
| 
       157 
103 
     | 
    
         
             
                return obj;
         
     | 
| 
       158 
104 
     | 
    
         
             
            }
         
     | 
| 
       159 
105 
     | 
    
         | 
| 
       160 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       161 
     | 
    
         
            -
            definition_node_mid_get(VALUE self)
         
     | 
| 
       162 
     | 
    
         
            -
            {
         
     | 
| 
       163 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("mid"));
         
     | 
| 
       164 
     | 
    
         
            -
            }
         
     | 
| 
       165 
     | 
    
         
            -
             
     | 
| 
       166 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       167 
     | 
    
         
            -
            definition_node_defn_get(VALUE self)
         
     | 
| 
       168 
     | 
    
         
            -
            {
         
     | 
| 
       169 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("defn"));
         
     | 
| 
       170 
     | 
    
         
            -
            }
         
     | 
| 
       171 
     | 
    
         
            -
             
     | 
| 
       172 
106 
     | 
    
         
             
            static VALUE
         
     | 
| 
       173 
107 
     | 
    
         
             
            block_node_new(const NODE *node)
         
     | 
| 
       174 
108 
     | 
    
         
             
            {
         
     | 
| 
         @@ -188,47 +122,23 @@ constant_node_new(const NODE *node) 
     | 
|
| 
       188 
122 
     | 
    
         
             
            {
         
     | 
| 
       189 
123 
     | 
    
         
             
                VALUE obj = rb_class_new_instance(0, 0, rb_cConstantNode);
         
     | 
| 
       190 
124 
     | 
    
         | 
| 
       191 
     | 
    
         
            -
                rb_ivar_set(obj,  
     | 
| 
      
 125 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@vid"), ID2SYM(RNODE_CONST(node)->nd_vid));
         
     | 
| 
       192 
126 
     | 
    
         | 
| 
       193 
127 
     | 
    
         
             
                return obj;
         
     | 
| 
       194 
128 
     | 
    
         
             
            }
         
     | 
| 
       195 
129 
     | 
    
         | 
| 
       196 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       197 
     | 
    
         
            -
            constant_node_vid_get(VALUE self)
         
     | 
| 
       198 
     | 
    
         
            -
            {
         
     | 
| 
       199 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("vid"));
         
     | 
| 
       200 
     | 
    
         
            -
            }
         
     | 
| 
       201 
     | 
    
         
            -
             
     | 
| 
       202 
130 
     | 
    
         
             
            static VALUE
         
     | 
| 
       203 
131 
     | 
    
         
             
            constant_declaration_node_new(const NODE *node)
         
     | 
| 
       204 
132 
     | 
    
         
             
            {
         
     | 
| 
       205 
133 
     | 
    
         
             
                VALUE obj = rb_class_new_instance(0, 0, rb_cConstantDeclarationNode);
         
     | 
| 
       206 
134 
     | 
    
         | 
| 
       207 
     | 
    
         
            -
                rb_ivar_set(obj,  
     | 
| 
       208 
     | 
    
         
            -
                rb_ivar_set(obj,  
     | 
| 
       209 
     | 
    
         
            -
                rb_ivar_set(obj,  
     | 
| 
      
 135 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@vid"), ID2SYM(RNODE_CDECL(node)->nd_vid));
         
     | 
| 
      
 136 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@else"), ast_to_node_instance(RNODE_CDECL(node)->nd_else));
         
     | 
| 
      
 137 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@value"), ast_to_node_instance(RNODE_CDECL(node)->nd_value));
         
     | 
| 
       210 
138 
     | 
    
         | 
| 
       211 
139 
     | 
    
         
             
                return obj;
         
     | 
| 
       212 
140 
     | 
    
         
             
            }
         
     | 
| 
       213 
141 
     | 
    
         | 
| 
       214 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       215 
     | 
    
         
            -
            constant_declaration_node_vid_get(VALUE self)
         
     | 
| 
       216 
     | 
    
         
            -
            {
         
     | 
| 
       217 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("vid"));
         
     | 
| 
       218 
     | 
    
         
            -
            }
         
     | 
| 
       219 
     | 
    
         
            -
             
     | 
| 
       220 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       221 
     | 
    
         
            -
            constant_declaration_node_else_get(VALUE self)
         
     | 
| 
       222 
     | 
    
         
            -
            {
         
     | 
| 
       223 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("else"));
         
     | 
| 
       224 
     | 
    
         
            -
            }
         
     | 
| 
       225 
     | 
    
         
            -
             
     | 
| 
       226 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       227 
     | 
    
         
            -
            constant_declaration_node_value_get(VALUE self)
         
     | 
| 
       228 
     | 
    
         
            -
            {
         
     | 
| 
       229 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("value"));
         
     | 
| 
       230 
     | 
    
         
            -
            }
         
     | 
| 
       231 
     | 
    
         
            -
             
     | 
| 
       232 
142 
     | 
    
         
             
            static VALUE
         
     | 
| 
       233 
143 
     | 
    
         
             
            node_literal_to_hash(const NODE *node)
         
     | 
| 
       234 
144 
     | 
    
         
             
            {
         
     | 
| 
         @@ -271,39 +181,20 @@ class_node_new(const NODE *node) 
     | 
|
| 
       271 
181 
     | 
    
         
             
            {
         
     | 
| 
       272 
182 
     | 
    
         
             
                VALUE obj = rb_class_new_instance(0, 0, rb_cClassNode);
         
     | 
| 
       273 
183 
     | 
    
         | 
| 
       274 
     | 
    
         
            -
                rb_ivar_set(obj,  
     | 
| 
       275 
     | 
    
         
            -
                rb_ivar_set(obj,  
     | 
| 
       276 
     | 
    
         
            -
                rb_ivar_set(obj,  
     | 
| 
      
 184 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@cpath"), ast_to_node_instance(RNODE_CLASS(node)->nd_cpath));
         
     | 
| 
      
 185 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@super"), ast_to_node_instance(RNODE_CLASS(node)->nd_super));
         
     | 
| 
      
 186 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@body"), ast_to_node_instance(RNODE_CLASS(node)->nd_body));
         
     | 
| 
       277 
187 
     | 
    
         | 
| 
       278 
188 
     | 
    
         
             
                return obj;
         
     | 
| 
       279 
189 
     | 
    
         
             
            }
         
     | 
| 
       280 
190 
     | 
    
         | 
| 
       281 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       282 
     | 
    
         
            -
            class_node_cpath_get(VALUE self)
         
     | 
| 
       283 
     | 
    
         
            -
            {
         
     | 
| 
       284 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("cpath"));
         
     | 
| 
       285 
     | 
    
         
            -
            }
         
     | 
| 
       286 
     | 
    
         
            -
             
     | 
| 
       287 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       288 
     | 
    
         
            -
            class_node_super_get(VALUE self)
         
     | 
| 
       289 
     | 
    
         
            -
            {
         
     | 
| 
       290 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("super"));
         
     | 
| 
       291 
     | 
    
         
            -
            }
         
     | 
| 
       292 
     | 
    
         
            -
             
     | 
| 
       293 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       294 
     | 
    
         
            -
            class_node_body_get(VALUE self)
         
     | 
| 
       295 
     | 
    
         
            -
            {
         
     | 
| 
       296 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("body"));
         
     | 
| 
       297 
     | 
    
         
            -
            }
         
     | 
| 
       298 
     | 
    
         
            -
             
     | 
| 
       299 
191 
     | 
    
         
             
            static VALUE
         
     | 
| 
       300 
192 
     | 
    
         
             
            module_node_new(const NODE *node)
         
     | 
| 
       301 
193 
     | 
    
         
             
            {
         
     | 
| 
       302 
194 
     | 
    
         
             
                VALUE obj = rb_class_new_instance(0, 0, rb_cModuleNode);
         
     | 
| 
       303 
195 
     | 
    
         | 
| 
       304 
     | 
    
         
            -
                rb_ivar_set(obj, rb_intern("@cpath"), ast_to_node_instance( 
     | 
| 
       305 
     | 
    
         
            -
                rb_ivar_set(obj, rb_intern("@ 
     | 
| 
       306 
     | 
    
         
            -
                rb_ivar_set(obj, rb_intern("@body"), ast_to_node_instance(RNODE_CLASS(node)->nd_body));
         
     | 
| 
      
 196 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@cpath"), ast_to_node_instance(RNODE_MODULE(node)->nd_cpath));
         
     | 
| 
      
 197 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@body"), ast_to_node_instance(RNODE_MODULE(node)->nd_body));
         
     | 
| 
       307 
198 
     | 
    
         | 
| 
       308 
199 
     | 
    
         
             
                return obj;
         
     | 
| 
       309 
200 
     | 
    
         
             
            }
         
     | 
| 
         @@ -313,24 +204,12 @@ colon2_node_new(const NODE *node) 
     | 
|
| 
       313 
204 
     | 
    
         
             
            {
         
     | 
| 
       314 
205 
     | 
    
         
             
                VALUE obj = rb_class_new_instance(0, 0, rb_cColon2Node);
         
     | 
| 
       315 
206 
     | 
    
         | 
| 
       316 
     | 
    
         
            -
                rb_ivar_set(obj,  
     | 
| 
       317 
     | 
    
         
            -
                rb_ivar_set(obj,  
     | 
| 
      
 207 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@mid"), ID2SYM(RNODE_COLON2(node)->nd_mid));
         
     | 
| 
      
 208 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@head"), ast_to_node_instance(RNODE_COLON2(node)->nd_head));
         
     | 
| 
       318 
209 
     | 
    
         | 
| 
       319 
210 
     | 
    
         
             
                return obj;
         
     | 
| 
       320 
211 
     | 
    
         
             
            }
         
     | 
| 
       321 
212 
     | 
    
         | 
| 
       322 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       323 
     | 
    
         
            -
            colon2_node_mid_get(VALUE self)
         
     | 
| 
       324 
     | 
    
         
            -
            {
         
     | 
| 
       325 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("mid"));
         
     | 
| 
       326 
     | 
    
         
            -
            }
         
     | 
| 
       327 
     | 
    
         
            -
             
     | 
| 
       328 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       329 
     | 
    
         
            -
            colon2_node_head_get(VALUE self)
         
     | 
| 
       330 
     | 
    
         
            -
            {
         
     | 
| 
       331 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("head"));
         
     | 
| 
       332 
     | 
    
         
            -
            }
         
     | 
| 
       333 
     | 
    
         
            -
             
     | 
| 
       334 
213 
     | 
    
         
             
            static VALUE
         
     | 
| 
       335 
214 
     | 
    
         
             
            colon3_node_new(const NODE *node)
         
     | 
| 
       336 
215 
     | 
    
         
             
            {
         
     | 
| 
         @@ -341,28 +220,16 @@ colon3_node_new(const NODE *node) 
     | 
|
| 
       341 
220 
     | 
    
         
             
                return obj;
         
     | 
| 
       342 
221 
     | 
    
         
             
            }
         
     | 
| 
       343 
222 
     | 
    
         | 
| 
       344 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       345 
     | 
    
         
            -
            colon3_node_mid_get(VALUE self)
         
     | 
| 
       346 
     | 
    
         
            -
            {
         
     | 
| 
       347 
     | 
    
         
            -
                return rb_ivar_get(self, rb_intern("@mid"));
         
     | 
| 
       348 
     | 
    
         
            -
            }
         
     | 
| 
       349 
     | 
    
         
            -
             
     | 
| 
       350 
223 
     | 
    
         
             
            static VALUE
         
     | 
| 
       351 
224 
     | 
    
         
             
            begin_node_new(const NODE *node)
         
     | 
| 
       352 
225 
     | 
    
         
             
            {
         
     | 
| 
       353 
226 
     | 
    
         
             
                VALUE obj = rb_class_new_instance(0, 0, rb_cBeginNode);
         
     | 
| 
       354 
227 
     | 
    
         | 
| 
       355 
     | 
    
         
            -
                rb_ivar_set(obj,  
     | 
| 
      
 228 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@body"), ast_to_node_instance(RNODE_BEGIN(node)->nd_body));
         
     | 
| 
       356 
229 
     | 
    
         | 
| 
       357 
230 
     | 
    
         
             
                return obj;
         
     | 
| 
       358 
231 
     | 
    
         
             
            }
         
     | 
| 
       359 
232 
     | 
    
         | 
| 
       360 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       361 
     | 
    
         
            -
            begin_node_body_get(VALUE self)
         
     | 
| 
       362 
     | 
    
         
            -
            {
         
     | 
| 
       363 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("body"));
         
     | 
| 
       364 
     | 
    
         
            -
            }
         
     | 
| 
       365 
     | 
    
         
            -
             
     | 
| 
       366 
233 
     | 
    
         
             
            static VALUE
         
     | 
| 
       367 
234 
     | 
    
         
             
            args_ainfo_to_hash(const struct rb_args_info ainfo)
         
     | 
| 
       368 
235 
     | 
    
         
             
            {
         
     | 
| 
         @@ -373,9 +240,11 @@ args_ainfo_to_hash(const struct rb_args_info ainfo) 
     | 
|
| 
       373 
240 
     | 
    
         
             
                rb_hash_aset(result, symbol("pre_init"), ast_to_node_instance(ainfo.pre_init));
         
     | 
| 
       374 
241 
     | 
    
         
             
                rb_hash_aset(result, symbol("post_args_num"), INT2NUM(ainfo.post_args_num));
         
     | 
| 
       375 
242 
     | 
    
         
             
                rb_hash_aset(result, symbol("post_init"), ast_to_node_instance(ainfo.post_init));
         
     | 
| 
       376 
     | 
    
         
            -
             
     | 
| 
       377 
     | 
    
         
            -
                rb_hash_aset(result, symbol(" 
     | 
| 
       378 
     | 
    
         
            -
                rb_hash_aset(result, symbol(" 
     | 
| 
      
 243 
     | 
    
         
            +
             
     | 
| 
      
 244 
     | 
    
         
            +
                rb_hash_aset(result, symbol("first_post_arg"), ainfo.first_post_arg ? ID2SYM(ainfo.first_post_arg) : Qnil);
         
     | 
| 
      
 245 
     | 
    
         
            +
                rb_hash_aset(result, symbol("rest_arg"), ainfo.rest_arg ? ID2SYM(ainfo.rest_arg) : Qnil);
         
     | 
| 
      
 246 
     | 
    
         
            +
                rb_hash_aset(result, symbol("block_arg"), ainfo.block_arg ? ID2SYM(ainfo.block_arg) : Qnil);
         
     | 
| 
      
 247 
     | 
    
         
            +
             
     | 
| 
       379 
248 
     | 
    
         
             
                rb_hash_aset(result, symbol("opt_args"), ast_to_node_instance((const NODE *)(ainfo.opt_args)));
         
     | 
| 
       380 
249 
     | 
    
         
             
                rb_hash_aset(result, symbol("kw_args"), ast_to_node_instance((const NODE *)(ainfo.kw_args)));
         
     | 
| 
       381 
250 
     | 
    
         
             
                rb_hash_aset(result, symbol("kw_rest_arg"), ast_to_node_instance(ainfo.kw_rest_arg));
         
     | 
| 
         @@ -389,17 +258,11 @@ arguments_node_new(const NODE *node) 
     | 
|
| 
       389 
258 
     | 
    
         
             
                VALUE obj = rb_class_new_instance(0, 0, rb_cArgumentsNode);
         
     | 
| 
       390 
259 
     | 
    
         
             
                VALUE ainfo_hash = args_ainfo_to_hash(RNODE_ARGS(node)->nd_ainfo);
         
     | 
| 
       391 
260 
     | 
    
         | 
| 
       392 
     | 
    
         
            -
                rb_ivar_set(obj,  
     | 
| 
      
 261 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@ainfo"), ainfo_hash);
         
     | 
| 
       393 
262 
     | 
    
         | 
| 
       394 
263 
     | 
    
         
             
                return obj;
         
     | 
| 
       395 
264 
     | 
    
         
             
            }
         
     | 
| 
       396 
265 
     | 
    
         | 
| 
       397 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       398 
     | 
    
         
            -
            arguments_node_ainfo_get(VALUE self)
         
     | 
| 
       399 
     | 
    
         
            -
            {
         
     | 
| 
       400 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("ainfo"));
         
     | 
| 
       401 
     | 
    
         
            -
            }
         
     | 
| 
       402 
     | 
    
         
            -
             
     | 
| 
       403 
266 
     | 
    
         
             
            static VALUE
         
     | 
| 
       404 
267 
     | 
    
         
             
            self_node_new(const NODE *node)
         
     | 
| 
       405 
268 
     | 
    
         
             
            {
         
     | 
| 
         @@ -419,6 +282,10 @@ ast_to_node_instance(const NODE *node) 
     | 
|
| 
       419 
282 
     | 
    
         
             
                    return Qnil;
         
     | 
| 
       420 
283 
     | 
    
         
             
                }
         
     | 
| 
       421 
284 
     | 
    
         | 
| 
      
 285 
     | 
    
         
            +
                if (node == (NODE *)-1) {
         
     | 
| 
      
 286 
     | 
    
         
            +
                    return Qnil;
         
     | 
| 
      
 287 
     | 
    
         
            +
                }
         
     | 
| 
      
 288 
     | 
    
         
            +
             
     | 
| 
       422 
289 
     | 
    
         
             
                type = nd_type(node);
         
     | 
| 
       423 
290 
     | 
    
         | 
| 
       424 
291 
     | 
    
         
             
                switch (type) {
         
     | 
| 
         @@ -674,38 +541,22 @@ Init_kanayago(void) 
     | 
|
| 
       674 
541 
     | 
    
         
             
                Init_StringNode(rb_mKanayago);
         
     | 
| 
       675 
542 
     | 
    
         | 
| 
       676 
543 
     | 
    
         
             
                rb_cConstantNode = rb_define_class_under(rb_mKanayago, "ConstantNode", rb_cObject);
         
     | 
| 
       677 
     | 
    
         
            -
                rb_define_method(rb_cConstantNode, "vid", constant_node_vid_get, 0);
         
     | 
| 
       678 
544 
     | 
    
         | 
| 
       679 
545 
     | 
    
         
             
                rb_cConstantDeclarationNode = rb_define_class_under(rb_mKanayago, "ConstantDeclarationNode", rb_cObject);
         
     | 
| 
       680 
     | 
    
         
            -
                rb_define_method(rb_cConstantDeclarationNode, "vid", constant_declaration_node_vid_get, 0);
         
     | 
| 
       681 
     | 
    
         
            -
                rb_define_method(rb_cConstantDeclarationNode, "else", constant_declaration_node_else_get, 0);
         
     | 
| 
       682 
     | 
    
         
            -
                rb_define_method(rb_cConstantDeclarationNode, "value", constant_declaration_node_value_get, 0);
         
     | 
| 
       683 
546 
     | 
    
         | 
| 
       684 
547 
     | 
    
         
             
                rb_cDefinitionNode = rb_define_class_under(rb_mKanayago, "DefinitionNode", rb_cObject);
         
     | 
| 
       685 
     | 
    
         
            -
                rb_define_method(rb_cDefinitionNode, "mid", definition_node_mid_get, 0);
         
     | 
| 
       686 
     | 
    
         
            -
                rb_define_method(rb_cDefinitionNode, "defn", definition_node_defn_get, 0);
         
     | 
| 
       687 
548 
     | 
    
         | 
| 
       688 
549 
     | 
    
         
             
                rb_cOperatorCallNode = rb_define_class_under(rb_mKanayago, "OperatorCallNode", rb_cObject);
         
     | 
| 
       689 
     | 
    
         
            -
                rb_define_method(rb_cOperatorCallNode, "recv", operator_call_node_recv_get, 0);
         
     | 
| 
       690 
     | 
    
         
            -
                rb_define_method(rb_cOperatorCallNode, "mid", operator_call_node_mid_get, 0);
         
     | 
| 
       691 
     | 
    
         
            -
                rb_define_method(rb_cOperatorCallNode, "args", operator_call_node_args_get, 0);
         
     | 
| 
       692 
550 
     | 
    
         | 
| 
       693 
551 
     | 
    
         
             
                rb_cListNode = rb_define_class_under(rb_mKanayago, "ListNode", rb_cObject);
         
     | 
| 
       694 
552 
     | 
    
         | 
| 
       695 
553 
     | 
    
         
             
                rb_cArgumentsNode = rb_define_class_under(rb_mKanayago, "ArgumentsNode", rb_cObject);
         
     | 
| 
       696 
     | 
    
         
            -
                rb_define_method(rb_cArgumentsNode, "ainfo", arguments_node_ainfo_get, 0);
         
     | 
| 
       697 
554 
     | 
    
         | 
| 
       698 
555 
     | 
    
         
             
                rb_cCallNode = rb_define_class_under(rb_mKanayago, "CallNode", rb_cObject);
         
     | 
| 
       699 
     | 
    
         
            -
                rb_define_method(rb_cCallNode, "recv", call_node_recv_get, 0);
         
     | 
| 
       700 
     | 
    
         
            -
                rb_define_method(rb_cCallNode, "mid", call_node_mid_get, 0);
         
     | 
| 
       701 
     | 
    
         
            -
                rb_define_method(rb_cCallNode, "args", call_node_args_get, 0);
         
     | 
| 
       702 
556 
     | 
    
         | 
| 
       703 
557 
     | 
    
         
             
                rb_cFunctionCallNode = rb_define_class_under(rb_mKanayago, "FunctionCallNode", rb_cObject);
         
     | 
| 
       704 
     | 
    
         
            -
                rb_define_method(rb_cFunctionCallNode, "mid", function_call_node_mid_get, 0);
         
     | 
| 
       705 
     | 
    
         
            -
                rb_define_method(rb_cFunctionCallNode, "args", function_call_node_args_get, 0);
         
     | 
| 
       706 
558 
     | 
    
         | 
| 
       707 
559 
     | 
    
         
             
                rb_cVariableCallNode = rb_define_class_under(rb_mKanayago, "VariableCallNode", rb_cObject);
         
     | 
| 
       708 
     | 
    
         
            -
                rb_define_method(rb_cVariableCallNode, "mid", variable_call_node_mid_get, 0);
         
     | 
| 
       709 
560 
     | 
    
         | 
| 
       710 
561 
     | 
    
         
             
                // For Statement Node(e.g. Kanayago::IfStatementNode)
         
     | 
| 
       711 
562 
     | 
    
         
             
                Init_StatementNode(rb_mKanayago);
         
     | 
| 
         @@ -713,21 +564,14 @@ Init_kanayago(void) 
     | 
|
| 
       713 
564 
     | 
    
         
             
                rb_cBlockNode = rb_define_class_under(rb_mKanayago, "BlockNode", rb_cArray);
         
     | 
| 
       714 
565 
     | 
    
         | 
| 
       715 
566 
     | 
    
         
             
                rb_cBeginNode = rb_define_class_under(rb_mKanayago, "BeginNode", rb_cObject);
         
     | 
| 
       716 
     | 
    
         
            -
                rb_define_method(rb_cBeginNode, "body", begin_node_body_get, 0);
         
     | 
| 
       717 
567 
     | 
    
         | 
| 
       718 
568 
     | 
    
         
             
                rb_cClassNode = rb_define_class_under(rb_mKanayago, "ClassNode", rb_cObject);
         
     | 
| 
       719 
     | 
    
         
            -
                rb_define_method(rb_cClassNode, "cpath", class_node_cpath_get, 0);
         
     | 
| 
       720 
     | 
    
         
            -
                rb_define_method(rb_cClassNode, "super", class_node_super_get, 0);
         
     | 
| 
       721 
     | 
    
         
            -
                rb_define_method(rb_cClassNode, "body", class_node_body_get, 0);
         
     | 
| 
       722 
569 
     | 
    
         | 
| 
       723 
570 
     | 
    
         
             
                rb_cModuleNode = rb_define_class_under(rb_mKanayago, "ModuleNode", rb_cObject);
         
     | 
| 
       724 
571 
     | 
    
         | 
| 
       725 
572 
     | 
    
         
             
                rb_cColon2Node = rb_define_class_under(rb_mKanayago, "Colon2Node", rb_cObject);
         
     | 
| 
       726 
     | 
    
         
            -
                rb_define_method(rb_cColon2Node, "mid", colon2_node_mid_get, 0);
         
     | 
| 
       727 
     | 
    
         
            -
                rb_define_method(rb_cColon2Node, "head", colon2_node_head_get, 0);
         
     | 
| 
       728 
573 
     | 
    
         | 
| 
       729 
574 
     | 
    
         
             
                rb_cColon3Node = rb_define_class_under(rb_mKanayago, "Colon3Node", rb_cObject);
         
     | 
| 
       730 
     | 
    
         
            -
                rb_define_method(rb_cColon3Node, "mid", colon3_node_mid_get, 0);
         
     | 
| 
       731 
575 
     | 
    
         | 
| 
       732 
576 
     | 
    
         
             
                // For Variable Node(e.g. Kanayago::LocalVariableNode)
         
     | 
| 
       733 
577 
     | 
    
         
             
                Init_VariableNode(rb_mKanayago);
         
     | 
    
        data/ext/kanayago/scope_node.c
    CHANGED
    
    | 
         @@ -7,28 +7,14 @@ scope_node_new(const NODE *node) 
     | 
|
| 
       7 
7 
     | 
    
         
             
            {
         
     | 
| 
       8 
8 
     | 
    
         
             
                VALUE result = rb_class_new_instance(0, 0, rb_cScopeNode);
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
                rb_ivar_set(result,  
     | 
| 
       11 
     | 
    
         
            -
                rb_ivar_set(result,  
     | 
| 
      
 10 
     | 
    
         
            +
                rb_ivar_set(result, rb_intern("@args"), ast_to_node_instance((const NODE *)(RNODE_SCOPE(node)->nd_args)));
         
     | 
| 
      
 11 
     | 
    
         
            +
                rb_ivar_set(result, rb_intern("@body"), ast_to_node_instance(RNODE_SCOPE(node)->nd_body));
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
                return result;
         
     | 
| 
       14 
14 
     | 
    
         
             
            }
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       17 
     | 
    
         
            -
            scope_node_args_get(VALUE self)
         
     | 
| 
       18 
     | 
    
         
            -
            {
         
     | 
| 
       19 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("args"));
         
     | 
| 
       20 
     | 
    
         
            -
            }
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       23 
     | 
    
         
            -
            scope_node_body_get(VALUE self)
         
     | 
| 
       24 
     | 
    
         
            -
            {
         
     | 
| 
       25 
     | 
    
         
            -
                return rb_ivar_get(self, symbol("body"));
         
     | 
| 
       26 
     | 
    
         
            -
            }
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
16 
     | 
    
         
             
            void
         
     | 
| 
       29 
17 
     | 
    
         
             
            Init_ScopeNode(VALUE module)
         
     | 
| 
       30 
18 
     | 
    
         
             
            {
         
     | 
| 
       31 
19 
     | 
    
         
             
                rb_cScopeNode = rb_define_class_under(module, "ScopeNode", rb_cObject);
         
     | 
| 
       32 
     | 
    
         
            -
                rb_define_method(rb_cScopeNode, "args", scope_node_args_get, 0);
         
     | 
| 
       33 
     | 
    
         
            -
                rb_define_method(rb_cScopeNode, "body", scope_node_body_get, 0);
         
     | 
| 
       34 
20 
     | 
    
         
             
            }
         
     | 
    
        data/ext/kanayago/string_node.c
    CHANGED
    
    | 
         @@ -19,12 +19,22 @@ dynamic_string_node_new(const NODE *node) 
     | 
|
| 
       19 
19 
     | 
    
         
             
            {
         
     | 
| 
       20 
20 
     | 
    
         
             
                VALUE obj = rb_class_new_instance(0, 0, rb_cDynamicStringNode);
         
     | 
| 
       21 
21 
     | 
    
         
             
                rb_parser_string_t *str = RNODE_DSTR(node)->string;
         
     | 
| 
       22 
     | 
    
         
            -
                 
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                 
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
      
 22 
     | 
    
         
            +
                const NODE *nd_next = (const NODE *)RNODE_DSTR(node)->nd_next;
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                if (str) {
         
     | 
| 
      
 25 
     | 
    
         
            +
                    rb_encoding *enc = str->enc;
         
     | 
| 
      
 26 
     | 
    
         
            +
                    char *ptr = str->ptr;
         
     | 
| 
      
 27 
     | 
    
         
            +
                    long len = str->len;
         
     | 
| 
      
 28 
     | 
    
         
            +
                    rb_ivar_set(obj, rb_intern("@string"), rb_enc_str_new(ptr, len, enc));
         
     | 
| 
      
 29 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 30 
     | 
    
         
            +
                    rb_ivar_set(obj, rb_intern("@string"), rb_str_new("", 0));
         
     | 
| 
      
 31 
     | 
    
         
            +
                }
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                if (nd_next && nd_next != (NODE *)-1) {
         
     | 
| 
      
 34 
     | 
    
         
            +
                    rb_ivar_set(obj, rb_intern("@next_nodes"), ast_to_node_instance(nd_next));
         
     | 
| 
      
 35 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 36 
     | 
    
         
            +
                    rb_ivar_set(obj, rb_intern("@next_nodes"), Qnil);
         
     | 
| 
      
 37 
     | 
    
         
            +
                }
         
     | 
| 
       28 
38 
     | 
    
         | 
| 
       29 
39 
     | 
    
         
             
                return obj;
         
     | 
| 
       30 
40 
     | 
    
         
             
            }
         
     | 
| 
         @@ -34,12 +44,22 @@ dynamic_symbol_node_new(const NODE *node) 
     | 
|
| 
       34 
44 
     | 
    
         
             
            {
         
     | 
| 
       35 
45 
     | 
    
         
             
                VALUE obj = rb_class_new_instance(0, 0, rb_cDynamicSymbolNode);
         
     | 
| 
       36 
46 
     | 
    
         
             
                rb_parser_string_t *str = RNODE_DSYM(node)->string;
         
     | 
| 
       37 
     | 
    
         
            -
                 
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
                 
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
      
 47 
     | 
    
         
            +
                const NODE *nd_next = (const NODE *)RNODE_DSYM(node)->nd_next;
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                if (str) {
         
     | 
| 
      
 50 
     | 
    
         
            +
                    rb_encoding *enc = str->enc;
         
     | 
| 
      
 51 
     | 
    
         
            +
                    char *ptr = str->ptr;
         
     | 
| 
      
 52 
     | 
    
         
            +
                    long len = str->len;
         
     | 
| 
      
 53 
     | 
    
         
            +
                    rb_ivar_set(obj, rb_intern("@string"), rb_enc_str_new(ptr, len, enc));
         
     | 
| 
      
 54 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 55 
     | 
    
         
            +
                    rb_ivar_set(obj, rb_intern("@string"), rb_str_new("", 0));
         
     | 
| 
      
 56 
     | 
    
         
            +
                }
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                if (nd_next && nd_next != (NODE *)-1) {
         
     | 
| 
      
 59 
     | 
    
         
            +
                    rb_ivar_set(obj, rb_intern("@next_nodes"), ast_to_node_instance(nd_next));
         
     | 
| 
      
 60 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 61 
     | 
    
         
            +
                    rb_ivar_set(obj, rb_intern("@next_nodes"), Qnil);
         
     | 
| 
      
 62 
     | 
    
         
            +
                }
         
     | 
| 
       43 
63 
     | 
    
         | 
| 
       44 
64 
     | 
    
         
             
                return obj;
         
     | 
| 
       45 
65 
     | 
    
         
             
            }
         
     | 
| 
         @@ -77,12 +97,22 @@ dynamic_execute_string_node_new(const NODE *node) 
     | 
|
| 
       77 
97 
     | 
    
         
             
            {
         
     | 
| 
       78 
98 
     | 
    
         
             
                VALUE obj = rb_class_new_instance(0, 0, rb_cDynamicExecuteStringNode);
         
     | 
| 
       79 
99 
     | 
    
         
             
                rb_parser_string_t *str = RNODE_DXSTR(node)->string;
         
     | 
| 
       80 
     | 
    
         
            -
                 
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
                 
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
      
 100 
     | 
    
         
            +
                const NODE *nd_next = (const NODE *)RNODE_DXSTR(node)->nd_next;
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
                if (str) {
         
     | 
| 
      
 103 
     | 
    
         
            +
                    rb_encoding *enc = str->enc;
         
     | 
| 
      
 104 
     | 
    
         
            +
                    char *ptr = str->ptr;
         
     | 
| 
      
 105 
     | 
    
         
            +
                    long len = str->len;
         
     | 
| 
      
 106 
     | 
    
         
            +
                    rb_ivar_set(obj, rb_intern("@string"), rb_enc_str_new(ptr, len, enc));
         
     | 
| 
      
 107 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 108 
     | 
    
         
            +
                    rb_ivar_set(obj, rb_intern("@string"), rb_str_new("", 0));
         
     | 
| 
      
 109 
     | 
    
         
            +
                }
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
                if (nd_next && nd_next != (NODE *)-1) {
         
     | 
| 
      
 112 
     | 
    
         
            +
                    rb_ivar_set(obj, rb_intern("@next_nodes"), ast_to_node_instance(nd_next));
         
     | 
| 
      
 113 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 114 
     | 
    
         
            +
                    rb_ivar_set(obj, rb_intern("@next_nodes"), Qnil);
         
     | 
| 
      
 115 
     | 
    
         
            +
                }
         
     | 
| 
       86 
116 
     | 
    
         | 
| 
       87 
117 
     | 
    
         
             
                return obj;
         
     | 
| 
       88 
118 
     | 
    
         
             
            }
         
     | 
| 
         @@ -112,13 +142,24 @@ dynamic_regexp_node_new(const NODE *node) 
     | 
|
| 
       112 
142 
     | 
    
         
             
            {
         
     | 
| 
       113 
143 
     | 
    
         
             
                VALUE obj = rb_class_new_instance(0, 0, rb_cDynamicRegexpNode);
         
     | 
| 
       114 
144 
     | 
    
         
             
                rb_parser_string_t *str = RNODE_DREGX(node)->string;
         
     | 
| 
       115 
     | 
    
         
            -
                rb_encoding *enc = str->enc;
         
     | 
| 
       116 
     | 
    
         
            -
                char *ptr = str->ptr;
         
     | 
| 
       117 
     | 
    
         
            -
                long len = str->len;
         
     | 
| 
       118 
145 
     | 
    
         
             
                long options = RNODE_DREGX(node)->as.nd_cflag;
         
     | 
| 
      
 146 
     | 
    
         
            +
                const NODE *nd_next = (const NODE *)RNODE_DREGX(node)->nd_next;
         
     | 
| 
      
 147 
     | 
    
         
            +
             
     | 
| 
      
 148 
     | 
    
         
            +
                if (str) {
         
     | 
| 
      
 149 
     | 
    
         
            +
                    rb_encoding *enc = str->enc;
         
     | 
| 
      
 150 
     | 
    
         
            +
                    char *ptr = str->ptr;
         
     | 
| 
      
 151 
     | 
    
         
            +
                    long len = str->len;
         
     | 
| 
      
 152 
     | 
    
         
            +
                    rb_ivar_set(obj, rb_intern("@string"), rb_enc_str_new(ptr, len, enc));
         
     | 
| 
      
 153 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 154 
     | 
    
         
            +
                    rb_ivar_set(obj, rb_intern("@string"), rb_str_new("", 0));
         
     | 
| 
      
 155 
     | 
    
         
            +
                }
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
                if (nd_next && nd_next != (NODE *)-1) {
         
     | 
| 
      
 158 
     | 
    
         
            +
                    rb_ivar_set(obj, rb_intern("@next_nodes"), ast_to_node_instance(nd_next));
         
     | 
| 
      
 159 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 160 
     | 
    
         
            +
                    rb_ivar_set(obj, rb_intern("@next_nodes"), Qnil);
         
     | 
| 
      
 161 
     | 
    
         
            +
                }
         
     | 
| 
       119 
162 
     | 
    
         | 
| 
       120 
     | 
    
         
            -
                rb_ivar_set(obj, rb_intern("@string"), rb_enc_str_new(ptr, len, enc));
         
     | 
| 
       121 
     | 
    
         
            -
                rb_ivar_set(obj, rb_intern("@next_nodes"), ast_to_node_instance((const NODE *)RNODE_DREGX(node)->nd_next));
         
     | 
| 
       122 
163 
     | 
    
         
             
                rb_ivar_set(obj, rb_intern("@options"), LONG2FIX(options));
         
     | 
| 
       123 
164 
     | 
    
         | 
| 
       124 
165 
     | 
    
         
             
                return obj;
         
     | 
| 
         @@ -21,8 +21,9 @@ VALUE 
     | 
|
| 
       21 
21 
     | 
    
         
             
            dynamic_variable_node_new(const NODE *node)
         
     | 
| 
       22 
22 
     | 
    
         
             
            {
         
     | 
| 
       23 
23 
     | 
    
         
             
                VALUE obj = rb_class_new_instance(0, 0, rb_cDynamicVariableNode);
         
     | 
| 
      
 24 
     | 
    
         
            +
                ID vid = RNODE_DVAR(node)->nd_vid;
         
     | 
| 
       24 
25 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                rb_ivar_set(obj, rb_intern("@vid"), ID2SYM( 
     | 
| 
      
 26 
     | 
    
         
            +
                rb_ivar_set(obj, rb_intern("@vid"), vid ? ID2SYM(vid) : Qnil);
         
     | 
| 
       26 
27 
     | 
    
         | 
| 
       27 
28 
     | 
    
         
             
                return obj;
         
     | 
| 
       28 
29 
     | 
    
         
             
            }
         
     | 
| 
         @@ -0,0 +1,19 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Kanayago
         
     | 
| 
      
 4 
     | 
    
         
            +
              class OperatorCallNode
         
     | 
| 
      
 5 
     | 
    
         
            +
                attr_reader :recv, :mid, :args
         
     | 
| 
      
 6 
     | 
    
         
            +
              end
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              class CallNode
         
     | 
| 
      
 9 
     | 
    
         
            +
                attr_reader :recv, :mid, :args
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              class FunctionCallNode
         
     | 
| 
      
 13 
     | 
    
         
            +
                attr_reader :mid, :args
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              class VariableCallNode
         
     | 
| 
      
 17 
     | 
    
         
            +
                attr_reader :mid
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -61,10 +61,22 @@ module Kanayago 
     | 
|
| 
       61 
61 
     | 
    
         
             
                attr_reader :id, :value
         
     | 
| 
       62 
62 
     | 
    
         
             
              end
         
     | 
| 
       63 
63 
     | 
    
         | 
| 
      
 64 
     | 
    
         
            +
              class DefinitionNode
         
     | 
| 
      
 65 
     | 
    
         
            +
                attr_reader :mid, :defn
         
     | 
| 
      
 66 
     | 
    
         
            +
              end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
       64 
68 
     | 
    
         
             
              class SingletonDefinitionNode
         
     | 
| 
       65 
69 
     | 
    
         
             
                attr_reader :recv, :mid, :defn
         
     | 
| 
       66 
70 
     | 
    
         
             
              end
         
     | 
| 
       67 
71 
     | 
    
         | 
| 
      
 72 
     | 
    
         
            +
              class ClassNode
         
     | 
| 
      
 73 
     | 
    
         
            +
                attr_reader :cpath, :super, :body
         
     | 
| 
      
 74 
     | 
    
         
            +
              end
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
              class ModuleNode
         
     | 
| 
      
 77 
     | 
    
         
            +
                attr_reader :cpath, :body
         
     | 
| 
      
 78 
     | 
    
         
            +
              end
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
       68 
80 
     | 
    
         
             
              class SingletonClassNode
         
     | 
| 
       69 
81 
     | 
    
         
             
                attr_reader :recv, :body
         
     | 
| 
       70 
82 
     | 
    
         
             
              end
         
     | 
| 
         @@ -122,6 +134,10 @@ module Kanayago 
     | 
|
| 
       122 
134 
     | 
    
         
             
                attr_reader :body, :iter
         
     | 
| 
       123 
135 
     | 
    
         
             
              end
         
     | 
| 
       124 
136 
     | 
    
         | 
| 
      
 137 
     | 
    
         
            +
              class BeginNode
         
     | 
| 
      
 138 
     | 
    
         
            +
                attr_reader :body
         
     | 
| 
      
 139 
     | 
    
         
            +
              end
         
     | 
| 
      
 140 
     | 
    
         
            +
             
     | 
| 
       125 
141 
     | 
    
         
             
              class EnsureNode
         
     | 
| 
       126 
142 
     | 
    
         
             
                attr_reader :head, :ensr
         
     | 
| 
       127 
143 
     | 
    
         
             
              end
         
     | 
    
        data/lib/kanayago/version.rb
    CHANGED
    
    
    
        data/lib/kanayago.rb
    CHANGED
    
    | 
         @@ -8,26 +8,13 @@ require_relative 'kanayago/string_node' 
     | 
|
| 
       8 
8 
     | 
    
         
             
            require_relative 'kanayago/statement_node'
         
     | 
| 
       9 
9 
     | 
    
         
             
            require_relative 'kanayago/variable_node'
         
     | 
| 
       10 
10 
     | 
    
         
             
            require_relative 'kanayago/pattern_node'
         
     | 
| 
      
 11 
     | 
    
         
            +
            require_relative 'kanayago/call_node'
         
     | 
| 
      
 12 
     | 
    
         
            +
            require_relative 'kanayago/scope_node'
         
     | 
| 
      
 13 
     | 
    
         
            +
            require_relative 'kanayago/constant_node'
         
     | 
| 
       11 
14 
     | 
    
         | 
| 
       12 
15 
     | 
    
         
             
            # Parse Ruby code with Ruby's Parser(Universal Parser)
         
     | 
| 
       13 
16 
     | 
    
         
             
            module Kanayago
         
     | 
| 
       14 
17 
     | 
    
         
             
              def self.parse(source)
         
     | 
| 
       15 
18 
     | 
    
         
             
                kanayago_parse(source)
         
     | 
| 
       16 
19 
     | 
    
         
             
              end
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
              class SelfNode
         
     | 
| 
       19 
     | 
    
         
            -
                attr_reader :state
         
     | 
| 
       20 
     | 
    
         
            -
              end
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
              class ModuleNode
         
     | 
| 
       23 
     | 
    
         
            -
                attr_reader :cpath, :body
         
     | 
| 
       24 
     | 
    
         
            -
              end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
              class VariableCallNode
         
     | 
| 
       27 
     | 
    
         
            -
                attr_reader :mid
         
     | 
| 
       28 
     | 
    
         
            -
              end
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
              class Colon3Node
         
     | 
| 
       31 
     | 
    
         
            -
                attr_reader :mid
         
     | 
| 
       32 
     | 
    
         
            -
              end
         
     | 
| 
       33 
20 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: kanayago
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - S-H-GAMELINKS
         
     | 
| 
         @@ -20,6 +20,7 @@ files: 
     | 
|
| 
       20 
20 
     | 
    
         
             
            - ".rubocop.yml"
         
     | 
| 
       21 
21 
     | 
    
         
             
            - ".rubocop_todo.yml"
         
     | 
| 
       22 
22 
     | 
    
         
             
            - ".ruby-version"
         
     | 
| 
      
 23 
     | 
    
         
            +
            - CHANGELOG.md
         
     | 
| 
       23 
24 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
       24 
25 
     | 
    
         
             
            - README.md
         
     | 
| 
       25 
26 
     | 
    
         
             
            - Rakefile
         
     | 
| 
         @@ -39,8 +40,11 @@ files: 
     | 
|
| 
       39 
40 
     | 
    
         
             
            - ext/kanayago/variable_node.c
         
     | 
| 
       40 
41 
     | 
    
         
             
            - ext/kanayago/variable_node.h
         
     | 
| 
       41 
42 
     | 
    
         
             
            - lib/kanayago.rb
         
     | 
| 
      
 43 
     | 
    
         
            +
            - lib/kanayago/call_node.rb
         
     | 
| 
      
 44 
     | 
    
         
            +
            - lib/kanayago/constant_node.rb
         
     | 
| 
       42 
45 
     | 
    
         
             
            - lib/kanayago/literal_node.rb
         
     | 
| 
       43 
46 
     | 
    
         
             
            - lib/kanayago/pattern_node.rb
         
     | 
| 
      
 47 
     | 
    
         
            +
            - lib/kanayago/scope_node.rb
         
     | 
| 
       44 
48 
     | 
    
         
             
            - lib/kanayago/statement_node.rb
         
     | 
| 
       45 
49 
     | 
    
         
             
            - lib/kanayago/string_node.rb
         
     | 
| 
       46 
50 
     | 
    
         
             
            - lib/kanayago/variable_node.rb
         
     |