From de89407e414325c83d75824d50b53d8089d1a2c1 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Tue, 18 Jan 2022 22:29:29 +0100 Subject: [PATCH] allow leading and closing empty lines and spaces before delimiters in string and programs --- lib/core/program.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/program.rb b/lib/core/program.rb index 47d6da2..34596ca 100644 --- a/lib/core/program.rb +++ b/lib/core/program.rb @@ -11,8 +11,8 @@ module Rpl # we trim enclosing characters if necessary preparsed_input = args[0][:value] + preparsed_input = preparsed_input.gsub( '\n', ' ' ).strip if %i[string program].include?( args[0][:type] ) preparsed_input = preparsed_input[1..-2] if %i[string name program].include?( args[0][:type] ) - preparsed_input.gsub!( '\n', ' ' ) if %i[string program].include?( args[0][:type] ) parsed_input = Rpl::Lang::Parser.new.parse_input( preparsed_input.to_s ) stack, dictionary = Rpl::Lang::Runner.new.run_input( parsed_input,