lib/delorean/engine.rb in delorean_lang-2.4.2 vs lib/delorean/engine.rb in delorean_lang-2.5.0
- old
+ new
@@ -218,10 +218,20 @@
def parser
@@parser ||= DeloreanParser.new
end
+ def closing_bracket?(line)
+ stripped = line.strip
+
+ return true if stripped == ']'
+ return true if stripped == ')'
+ return true if stripped == '}'
+
+ false
+ end
+
def generate(t)
t.check(self)
begin
# generate ruby code
@@ -266,10 +276,10 @@
next if line.empty?
if multi_line
# if line starts with >4 spaces, assume it's a multline
# continuation.
- if /\A {5}/.match?(line)
+ if /\A {5}/.match?(line) || closing_bracket?(line)
multi_line += line
next
else
t = parser.parse(multi_line)
err(ParseError, 'syntax error') unless t