mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Implement CLASS NODE locations
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 ```
This commit is contained in:
parent
98790faae3
commit
eae0fe37c0
5 changed files with 33 additions and 6 deletions
|
@ -891,6 +891,9 @@ typedef struct RNode_CLASS {
|
|||
struct RNode *nd_cpath;
|
||||
struct RNode *nd_body;
|
||||
struct RNode *nd_super;
|
||||
rb_code_location_t class_keyword_loc;
|
||||
rb_code_location_t inheritance_operator_loc;
|
||||
rb_code_location_t end_keyword_loc;
|
||||
} rb_node_class_t;
|
||||
|
||||
typedef struct RNode_MODULE {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue