summaryrefslogtreecommitdiff
path: root/ext/ripper/tools
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-09-17 15:22:11 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-09-17 16:22:01 +0900
commit69d7871b02fedf24de381c2bc514394eed9afd32 (patch)
tree1bcf52b915fd2db11307e1ba19de1526fd3499e5 /ext/ripper/tools
parentdf316be4016b0cce7aac4ccec52445d48606bf92 (diff)
ripper: Preprocess ripper-dispatchable types only
Keep the other types, which not having setter macros for ripper.
Diffstat (limited to 'ext/ripper/tools')
-rw-r--r--ext/ripper/tools/preproc.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/ripper/tools/preproc.rb b/ext/ripper/tools/preproc.rb
index 07ef627cf3..a98a60e319 100644
--- a/ext/ripper/tools/preproc.rb
+++ b/ext/ripper/tools/preproc.rb
@@ -59,10 +59,9 @@ def prelude(f, out)
when /\A%%/
out << "%%\n"
return
- when /\A%token/, /\A} <node>/
- out << line.sub(/<\w+>/, '<val>')
- when /\A%type/
- out << line.sub(/<\w+>/, '<val>')
+ when /\A%token/, /\A%type/, /\A} <node>/
+ # types in %union which have corresponding set_yylval_* macro.
+ out << line.sub(/<(?:node|num|id)>/, '<val>')
when /^enum lex_state_(?:bits|e) \{/
lex_state_def = true
out << line