diff options
Diffstat (limited to 'tool')
-rw-r--r-- | tool/mk_builtin_loader.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tool/mk_builtin_loader.rb b/tool/mk_builtin_loader.rb index 6740ec5c17..02941735f7 100644 --- a/tool/mk_builtin_loader.rb +++ b/tool/mk_builtin_loader.rb @@ -100,6 +100,7 @@ def collect_builtin base, tree, name, bs, inlines, locals = nil when :call, :command_call # CALL _, recv, sep, mid, (_, args) = tree end + if mid raise "unknown sexp: #{mid.inspect}" unless %i[@ident @const].include?(mid.first) _, mid, (lineno,) = mid @@ -126,7 +127,7 @@ def collect_builtin base, tree, name, bs, inlines, locals = nil args.pop unless (args ||= []).last argc = args.size - if /(.+)\!\z/ =~ func_name + if /(.+)[\!\?]\z/ =~ func_name case $1 when 'attr' text = inline_text(argc, args.first) @@ -156,6 +157,8 @@ def collect_builtin base, tree, name, bs, inlines, locals = nil func_name = nil # required inlines[inlines.size] = [lineno, text, nil, nil] argc -= 1 + when 'mandatory_only' + func_name = nil when 'arg' argc == 1 or raise "unexpected argument number #{argc}" (arg = args.first)[0] == :symbol_literal or raise "symbol literal expected #{args}" |