Skip to content
  • ydah's avatar
    eae0fe37
    Implement CLASS NODE locations · eae0fe37
    ydah authored
    The following Location information has been added This is the information required for parse.y to be a universal parser:
    
    ```
    ❯ ruby --parser=prism --dump=parsetree -e "class A < B; end"
    @ ProgramNode (location: (1,0)-(1,16))
    +-- locals: []
    +-- statements:
        @ StatementsNode (location: (1,0)-(1,16))
        +-- body: (length: 1)
            +-- @ ClassNode (location: (1,0)-(1,16))
                +-- locals: []
                +-- class_keyword_loc: (1,0)-(1,5) = "class"
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                +-- constant_path:
                |   @ ConstantReadNode (location: (1,6)-(1,7))
                |   +-- name: :A
                +-- inheritance_operator_loc: (1,8)-(1,9) = "<"
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                +-- superclass:
                |   @ ConstantReadNode (location: (1,10)-(1,11))
                |   +-- name: :B
                +-- body: nil
                +-- end_keyword_loc: (1,13)-(1,16) = "end"
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                +-- name: :A
    ```
    eae0fe37
    Implement CLASS NODE locations
    ydah authored
    The following Location information has been added This is the information required for parse.y to be a universal parser:
    
    ```
    ❯ ruby --parser=prism --dump=parsetree -e "class A < B; end"
    @ ProgramNode (location: (1,0)-(1,16))
    +-- locals: []
    +-- statements:
        @ StatementsNode (location: (1,0)-(1,16))
        +-- body: (length: 1)
            +-- @ ClassNode (location: (1,0)-(1,16))
                +-- locals: []
                +-- class_keyword_loc: (1,0)-(1,5) = "class"
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                +-- constant_path:
                |   @ ConstantReadNode (location: (1,6)-(1,7))
                |   +-- name: :A
                +-- inheritance_operator_loc: (1,8)-(1,9) = "<"
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                +-- superclass:
                |   @ ConstantReadNode (location: (1,10)-(1,11))
                |   +-- name: :B
                +-- body: nil
                +-- end_keyword_loc: (1,13)-(1,16) = "end"
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                +-- name: :A
    ```
Loading