Skip to content

Commit

Permalink
[ruby/prism] Finish keyword hash node flag refactor by renaming flag
Browse files Browse the repository at this point in the history
  • Loading branch information
paracycle authored and matzbot committed Dec 15, 2023
1 parent b418e5a commit 0a31cb1
Show file tree
Hide file tree
Showing 31 changed files with 66 additions and 72 deletions.
4 changes: 2 additions & 2 deletions prism/config.yml
Expand Up @@ -368,8 +368,8 @@ flags:
comment: Flags for integer nodes that correspond to the base of the integer.
- name: KeywordHashNodeFlags
values:
- name: STATIC_KEYS
comment: "a keyword hash which only has `AssocNode` elements all with static literal keys, which means the elements can be treated as keyword arguments"
- name: SYMBOL_KEYS
comment: "a keyword hash which only has `AssocNode` elements all with symbol keys, which means the elements can be treated as keyword arguments"
comment: Flags for keyword hash nodes.
- name: LoopFlags
values:
Expand Down
6 changes: 0 additions & 6 deletions prism/parser.h
Expand Up @@ -17,12 +17,6 @@

#include <stdbool.h>

// TODO: remove this by renaming the original flag
/**
* Temporary alias for the PM_NODE_FLAG_STATIC_KEYS flag.
*/
#define PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS PM_KEYWORD_HASH_NODE_FLAGS_STATIC_KEYS

/**
* This enum provides various bits that represent different kinds of states that
* the lexer can track. This is used to determine which kind of token to return
Expand Down
2 changes: 1 addition & 1 deletion test/prism/snapshots/arrays.txt
Expand Up @@ -79,7 +79,7 @@
│ ├── flags: ∅
│ ├── elements: (length: 1)
│ │ └── @ KeywordHashNode (location: (5,1)-(5,12))
│ │ ├── flags: static_keys
│ │ ├── flags: symbol_keys
│ │ └── elements: (length: 1)
│ │ └── @ AssocNode (location: (5,1)-(5,12))
│ │ ├── key:
Expand Down
2 changes: 1 addition & 1 deletion test/prism/snapshots/if.txt
Expand Up @@ -250,7 +250,7 @@
│ │ │ ├── flags: ∅
│ │ │ └── arguments: (length: 1)
│ │ │ └── @ KeywordHashNode (location: (25,4)-(25,6))
│ │ │ ├── flags: static_keys
│ │ │ ├── flags: symbol_keys
│ │ │ └── elements: (length: 1)
│ │ │ └── @ AssocNode (location: (25,4)-(25,6))
│ │ │ ├── key:
Expand Down
20 changes: 10 additions & 10 deletions test/prism/snapshots/method_calls.txt
Expand Up @@ -782,7 +782,7 @@
│ │ │ ├── closing_loc: ∅
│ │ │ └── unescaped: "a"
│ │ └── @ KeywordHashNode (location: (60,8)-(60,32))
│ │ ├── flags: static_keys
│ │ ├── flags: symbol_keys
│ │ └── elements: (length: 2)
│ │ ├── @ AssocNode (location: (60,8)-(60,22))
│ │ │ ├── key:
Expand Down Expand Up @@ -914,7 +914,7 @@
│ │ │ ├── closing_loc: ∅
│ │ │ └── unescaped: "a"
│ │ └── @ KeywordHashNode (location: (64,8)-(64,15))
│ │ ├── flags: static_keys
│ │ ├── flags: symbol_keys
│ │ └── elements: (length: 1)
│ │ └── @ AssocNode (location: (64,8)-(64,15))
│ │ ├── key:
Expand Down Expand Up @@ -983,7 +983,7 @@
│ │ ├── flags: ∅
│ │ └── arguments: (length: 1)
│ │ └── @ KeywordHashNode (location: (66,3)-(66,17))
│ │ ├── flags: static_keys
│ │ ├── flags: symbol_keys
│ │ └── elements: (length: 1)
│ │ └── @ AssocNode (location: (66,3)-(66,17))
│ │ ├── key:
Expand Down Expand Up @@ -1173,7 +1173,7 @@
│ │ ├── flags: ∅
│ │ └── arguments: (length: 1)
│ │ └── @ KeywordHashNode (location: (74,3)-(74,20))
│ │ ├── flags: static_keys
│ │ ├── flags: symbol_keys
│ │ └── elements: (length: 1)
│ │ └── @ AssocNode (location: (74,3)-(74,20))
│ │ ├── key:
Expand Down Expand Up @@ -1236,7 +1236,7 @@
│ │ │ ├── closing_loc: ∅
│ │ │ └── unescaped: "a"
│ │ └── @ KeywordHashNode (location: (82,0)-(82,5))
│ │ ├── flags: static_keys
│ │ ├── flags: symbol_keys
│ │ └── elements: (length: 1)
│ │ └── @ AssocNode (location: (82,0)-(82,5))
│ │ ├── key:
Expand Down Expand Up @@ -1287,7 +1287,7 @@
│ │ ├── flags: ∅
│ │ └── arguments: (length: 1)
│ │ └── @ KeywordHashNode (location: (87,4)-(87,21))
│ │ ├── flags: static_keys
│ │ ├── flags: symbol_keys
│ │ └── elements: (length: 2)
│ │ ├── @ AssocNode (location: (87,4)-(87,11))
│ │ │ ├── key:
Expand Down Expand Up @@ -1336,7 +1336,7 @@
│ │ ├── @ IntegerNode (location: (89,10)-(89,11))
│ │ │ └── flags: decimal
│ │ └── @ KeywordHashNode (location: (89,13)-(89,21))
│ │ ├── flags: static_keys
│ │ ├── flags: symbol_keys
│ │ └── elements: (length: 1)
│ │ └── @ AssocNode (location: (89,13)-(89,21))
│ │ ├── key:
Expand Down Expand Up @@ -1527,7 +1527,7 @@
│ │ ├── flags: ∅
│ │ └── arguments: (length: 1)
│ │ └── @ KeywordHashNode (location: (103,4)-(103,11))
│ │ ├── flags: static_keys
│ │ ├── flags: symbol_keys
│ │ └── elements: (length: 1)
│ │ └── @ AssocNode (location: (103,4)-(103,11))
│ │ ├── key:
Expand Down Expand Up @@ -1555,7 +1555,7 @@
│ │ ├── flags: ∅
│ │ └── arguments: (length: 1)
│ │ └── @ KeywordHashNode (location: (105,4)-(105,28))
│ │ ├── flags: static_keys
│ │ ├── flags: symbol_keys
│ │ └── elements: (length: 1)
│ │ └── @ AssocNode (location: (105,4)-(105,28))
│ │ ├── key:
Expand Down Expand Up @@ -1612,7 +1612,7 @@
│ │ ├── flags: ∅
│ │ └── arguments: (length: 1)
│ │ └── @ KeywordHashNode (location: (107,4)-(107,24))
│ │ ├── flags: static_keys
│ │ ├── flags: symbol_keys
│ │ └── elements: (length: 1)
│ │ └── @ AssocNode (location: (107,4)-(107,24))
│ │ ├── key:
Expand Down
2 changes: 1 addition & 1 deletion test/prism/snapshots/rescue.txt
Expand Up @@ -343,7 +343,7 @@
│ │ │ ├── flags: ∅
│ │ │ └── arguments: (length: 1)
│ │ │ └── @ KeywordHashNode (location: (29,4)-(29,6))
│ │ │ ├── flags: static_keys
│ │ │ ├── flags: symbol_keys
│ │ │ └── elements: (length: 1)
│ │ │ └── @ AssocNode (location: (29,4)-(29,6))
│ │ │ ├── key:
Expand Down
2 changes: 1 addition & 1 deletion test/prism/snapshots/seattlerb/assoc_label.txt
Expand Up @@ -15,7 +15,7 @@
│ ├── flags: ∅
│ └── arguments: (length: 1)
│ └── @ KeywordHashNode (location: (1,2)-(1,5))
│ ├── flags: static_keys
│ ├── flags: symbol_keys
│ └── elements: (length: 1)
│ └── @ AssocNode (location: (1,2)-(1,5))
│ ├── key:
Expand Down
2 changes: 1 addition & 1 deletion test/prism/snapshots/seattlerb/bug_249.txt
Expand Up @@ -66,7 +66,7 @@
│ │ ├── closing_loc: ∅
│ │ └── block: ∅
│ └── @ KeywordHashNode (location: (4,11)-(4,28))
│ ├── flags: static_keys
│ ├── flags: symbol_keys
│ └── elements: (length: 1)
│ └── @ AssocNode (location: (4,11)-(4,28))
│ ├── key:
Expand Down
2 changes: 1 addition & 1 deletion test/prism/snapshots/seattlerb/bug_hash_args.txt
Expand Up @@ -21,7 +21,7 @@
│ │ ├── closing_loc: ∅
│ │ └── unescaped: "bar"
│ └── @ KeywordHashNode (location: (1,10)-(1,18))
│ ├── flags: static_keys
│ ├── flags: symbol_keys
│ └── elements: (length: 1)
│ └── @ AssocNode (location: (1,10)-(1,18))
│ ├── key:
Expand Down
Expand Up @@ -21,7 +21,7 @@
│ │ ├── closing_loc: ∅
│ │ └── unescaped: "bar"
│ └── @ KeywordHashNode (location: (1,10)-(1,18))
│ ├── flags: static_keys
│ ├── flags: symbol_keys
│ └── elements: (length: 1)
│ └── @ AssocNode (location: (1,10)-(1,18))
│ ├── key:
Expand Down
4 changes: 2 additions & 2 deletions test/prism/snapshots/seattlerb/call_args_assoc_quoted.txt
Expand Up @@ -57,7 +57,7 @@
│ │ ├── flags: ∅
│ │ └── arguments: (length: 1)
│ │ └── @ KeywordHashNode (location: (3,2)-(3,8))
│ │ ├── flags: static_keys
│ │ ├── flags: symbol_keys
│ │ └── elements: (length: 1)
│ │ └── @ AssocNode (location: (3,2)-(3,8))
│ │ ├── key:
Expand Down Expand Up @@ -85,7 +85,7 @@
│ ├── flags: ∅
│ └── arguments: (length: 1)
│ └── @ KeywordHashNode (location: (5,2)-(5,8))
│ ├── flags: static_keys
│ ├── flags: symbol_keys
│ └── elements: (length: 1)
│ └── @ AssocNode (location: (5,2)-(5,8))
│ ├── key:
Expand Down
Expand Up @@ -24,7 +24,7 @@
│ │ │ ├── closing_loc: ∅
│ │ │ └── unescaped: "b"
│ │ └── @ KeywordHashNode (location: (1,7)-(1,14))
│ │ ├── flags: static_keys
│ │ ├── flags: symbol_keys
│ │ └── elements: (length: 1)
│ │ └── @ AssocNode (location: (1,7)-(1,14))
│ │ ├── key:
Expand Down
2 changes: 1 addition & 1 deletion test/prism/snapshots/seattlerb/call_assoc_new.txt
Expand Up @@ -15,7 +15,7 @@
│ ├── flags: ∅
│ └── arguments: (length: 1)
│ └── @ KeywordHashNode (location: (1,2)-(1,5))
│ ├── flags: static_keys
│ ├── flags: symbol_keys
│ └── elements: (length: 1)
│ └── @ AssocNode (location: (1,2)-(1,5))
│ ├── key:
Expand Down
Expand Up @@ -15,7 +15,7 @@
│ ├── flags: ∅
│ └── arguments: (length: 1)
│ └── @ KeywordHashNode (location: (1,2)-(5,3))
│ ├── flags: static_keys
│ ├── flags: symbol_keys
│ └── elements: (length: 1)
│ └── @ AssocNode (location: (1,2)-(5,3))
│ ├── key:
Expand Down
2 changes: 1 addition & 1 deletion test/prism/snapshots/seattlerb/difficult2_.txt
Expand Up @@ -53,7 +53,7 @@
│ ├── flags: ∅
│ └── arguments: (length: 1)
│ └── @ KeywordHashNode (location: (2,2)-(2,6))
│ ├── flags: static_keys
│ ├── flags: symbol_keys
│ └── elements: (length: 1)
│ └── @ AssocNode (location: (2,2)-(2,6))
│ ├── key:
Expand Down
6 changes: 3 additions & 3 deletions test/prism/snapshots/seattlerb/multiline_hash_declaration.txt
Expand Up @@ -15,7 +15,7 @@
│ │ ├── flags: ∅
│ │ └── arguments: (length: 1)
│ │ └── @ KeywordHashNode (location: (1,2)-(3,1))
│ │ ├── flags: static_keys
│ │ ├── flags: symbol_keys
│ │ └── elements: (length: 1)
│ │ └── @ AssocNode (location: (1,2)-(3,1))
│ │ ├── key:
Expand Down Expand Up @@ -45,7 +45,7 @@
│ │ ├── flags: ∅
│ │ └── arguments: (length: 1)
│ │ └── @ KeywordHashNode (location: (5,2)-(6,1))
│ │ ├── flags: static_keys
│ │ ├── flags: symbol_keys
│ │ └── elements: (length: 1)
│ │ └── @ AssocNode (location: (5,2)-(6,1))
│ │ ├── key:
Expand Down Expand Up @@ -75,7 +75,7 @@
│ ├── flags: ∅
│ └── arguments: (length: 1)
│ └── @ KeywordHashNode (location: (8,2)-(8,11))
│ ├── flags: static_keys
│ ├── flags: symbol_keys
│ └── elements: (length: 1)
│ └── @ AssocNode (location: (8,2)-(8,11))
│ ├── key:
Expand Down
2 changes: 1 addition & 1 deletion test/prism/snapshots/seattlerb/quoted_symbol_hash_arg.txt
Expand Up @@ -15,7 +15,7 @@
│ ├── flags: ∅
│ └── arguments: (length: 1)
│ └── @ KeywordHashNode (location: (1,5)-(1,12))
│ ├── flags: static_keys
│ ├── flags: symbol_keys
│ └── elements: (length: 1)
│ └── @ AssocNode (location: (1,5)-(1,12))
│ ├── key:
Expand Down
10 changes: 5 additions & 5 deletions test/prism/snapshots/seattlerb/return_call_assocs.txt
Expand Up @@ -12,7 +12,7 @@
│ ├── @ IntegerNode (location: (1,7)-(1,8))
│ │ └── flags: decimal
│ └── @ KeywordHashNode (location: (1,10)-(1,17))
│ ├── flags: static_keys
│ ├── flags: symbol_keys
│ └── elements: (length: 1)
│ └── @ AssocNode (location: (1,10)-(1,17))
│ ├── key:
Expand All @@ -35,7 +35,7 @@
│ ├── @ IntegerNode (location: (3,7)-(3,8))
│ │ └── flags: decimal
│ └── @ KeywordHashNode (location: (3,10)-(3,26))
│ ├── flags: static_keys
│ ├── flags: symbol_keys
│ └── elements: (length: 2)
│ ├── @ AssocNode (location: (3,10)-(3,17))
│ │ ├── key:
Expand Down Expand Up @@ -79,7 +79,7 @@
│ │ ├── flags: ∅
│ │ └── arguments: (length: 1)
│ │ └── @ KeywordHashNode (location: (5,9)-(5,14))
│ │ ├── flags: static_keys
│ │ ├── flags: symbol_keys
│ │ └── elements: (length: 1)
│ │ └── @ AssocNode (location: (5,9)-(5,14))
│ │ ├── key:
Expand Down Expand Up @@ -113,7 +113,7 @@
│ │ ├── flags: ∅
│ │ └── arguments: (length: 1)
│ │ └── @ KeywordHashNode (location: (7,9)-(7,12))
│ │ ├── flags: static_keys
│ │ ├── flags: symbol_keys
│ │ └── elements: (length: 1)
│ │ └── @ AssocNode (location: (7,9)-(7,12))
│ │ ├── key:
Expand Down Expand Up @@ -147,7 +147,7 @@
│ │ ├── flags: ∅
│ │ └── arguments: (length: 1)
│ │ └── @ KeywordHashNode (location: (9,9)-(9,12))
│ │ ├── flags: static_keys
│ │ ├── flags: symbol_keys
│ │ └── elements: (length: 1)
│ │ └── @ AssocNode (location: (9,9)-(9,12))
│ │ ├── key:
Expand Down

0 comments on commit 0a31cb1

Please sign in to comment.