Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a more portable way to check if code is parseable #1032

Merged
merged 2 commits into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ permissions: # added using https://github.com/step-security/secure-workflows
jobs:
ruby-versions:
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
with:
engine: cruby-jruby
versions: '["truffleruby"]'

test:
needs: ruby-versions
strategy:
Expand All @@ -20,6 +18,8 @@ jobs:
exclude:
- os: windows-latest
ruby: truffleruby
- os: windows-latest
ruby: truffleruby-head
- os: windows-latest
ruby: jruby
- os: windows-latest
Expand Down
4 changes: 3 additions & 1 deletion lib/rdoc/markup/to_html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,9 @@ 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}")
end
rescue SyntaxError
false
ensure
Expand Down