Skip to content

Commit

Permalink
[GR-18163] Use a more portable way to check if code is parseable in t…
Browse files Browse the repository at this point in the history
…he `rdoc` default gem

PullRequest: truffleruby/3917
  • Loading branch information
andrykonchin committed Jul 26, 2023
2 parents 069a9ef + d87bfbd commit 099ae3f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/mri/rdoc/markup/to_html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,10 @@ def list_end_for(list_type)

def parseable? text
verbose, $VERBOSE = $VERBOSE, nil
eval("BEGIN {return true}\n#{text}")
catch(:valid) do
eval("BEGIN { throw :valid, true }\n#{text}")
false
end
rescue SyntaxError
false
ensure
Expand Down

0 comments on commit 099ae3f

Please sign in to comment.