diff --git a/lib/prism/ffi.rb b/lib/prism/ffi.rb index 931e277ef5..96102201b3 100644 --- a/lib/prism/ffi.rb +++ b/lib/prism/ffi.rb @@ -299,7 +299,7 @@ module Prism values << (options.fetch(:frozen_string_literal, false) ? 1 : 0) template << "C" - values << (options.fetch(:suppress_warnings, false) ? 1 : 0) + values << (options[:verbose] ? 0 : 1) template << "L" if (scopes = options[:scopes]) diff --git a/prism/extension.c b/prism/extension.c index 1f6e199d2f..0cc365132a 100644 --- a/prism/extension.c +++ b/prism/extension.c @@ -22,7 +22,7 @@ ID rb_option_id_filepath; ID rb_option_id_encoding; ID rb_option_id_line; ID rb_option_id_frozen_string_literal; -ID rb_option_id_suppress_warnings; +ID rb_option_id_verbose; ID rb_option_id_scopes; /******************************************************************************/ @@ -130,8 +130,8 @@ build_options_i(VALUE key, VALUE value, VALUE argument) { if (!NIL_P(value)) pm_options_line_set(options, NUM2UINT(value)); } else if (key_id == rb_option_id_frozen_string_literal) { if (!NIL_P(value)) pm_options_frozen_string_literal_set(options, value == Qtrue); - } else if (key_id == rb_option_id_suppress_warnings) { - if (!NIL_P(value)) pm_options_suppress_warnings_set(options, value == Qtrue); + } else if (key_id == rb_option_id_verbose) { + pm_options_suppress_warnings_set(options, value != Qtrue); } else if (key_id == rb_option_id_scopes) { if (!NIL_P(value)) build_options_scopes(options, value); } else { @@ -626,8 +626,8 @@ parse_input(pm_string_t *input, const pm_options_t *options) { * integer or nil. Note that this is 1-indexed. * * `frozen_string_literal` - whether or not the frozen string literal pragma * has been set. This should be a boolean or nil. - * * `suppress_warnings` - whether or not warnings should be suppressed. This - * should be a boolean or nil. + * * `verbose` - the current level of verbosity. This controls whether or not + * the parser emits warnings. This should be a boolean or nil. * * `scopes` - the locals that are in scope surrounding the code that is being * parsed. This should be an array of arrays of symbols or nil. */ @@ -947,7 +947,7 @@ Init_prism(void) { rb_option_id_encoding = rb_intern_const("encoding"); rb_option_id_line = rb_intern_const("line"); rb_option_id_frozen_string_literal = rb_intern_const("frozen_string_literal"); - rb_option_id_suppress_warnings = rb_intern_const("suppress_warnings"); + rb_option_id_verbose = rb_intern_const("verbose"); rb_option_id_scopes = rb_intern_const("scopes"); /**