# File lib/rbreadline.rb, line 2147 def parser_if(args) # Push parser state. @if_stack << @_rl_parsing_conditionalized_out # If parsing is turned off, then nothing can turn it back on except # for finding the matching endif. In that case, return right now. if @_rl_parsing_conditionalized_out return 0 end args.downcase! # Handle "$if term=foo" and "$if mode=emacs" constructs. If this # isn't term=foo, or mode=emacs, then check to see if the first # word in ARGS is the same as the value stored in rl_readline_name. if (@rl_terminal_name && args =~ /^term=/) # Terminals like "aaa-60" are equivalent to "aaa". tname = @rl_terminal_name.downcase.gsub(/-.*$/,'') # Test the `long' and `short' forms of the terminal name so that #if someone has a `sun-cmd' and does not want to have bindings #that will be executed if the terminal is a `sun', they can put #`$if term=sun-cmd' into their .inputrc. @_rl_parsing_conditionalized_out = (args[5..-1] != tname && args[5..-1] != @rl_terminal_name.downcase) elsif args =~ /^mode=/ if args[5..-1] == "emacs" mode = @emacs_mode elsif args[5..-1] == "vi" mode = @vi_mode else mode = @no_mode end @_rl_parsing_conditionalized_out = (mode != @rl_editing_mode) # Check to see if the first word in ARGS is the same as the # value stored in rl_readline_name. elsif (args == @rl_readline_name) @_rl_parsing_conditionalized_out = false else @_rl_parsing_conditionalized_out = true end return 0 end