summaryrefslogtreecommitdiff
path: root/lib/prism/ffi.rb
diff options
context:
space:
mode:
authorKevin Newton <[email protected]>2023-12-01 12:22:01 -0500
committergit <[email protected]>2023-12-01 20:53:34 +0000
commit492c82cb417a92d1941f10b52e77ec0c4b2cc8a6 ()
tree3358d814456f46c6adb80921e968d1fb5258ce04 /lib/prism/ffi.rb
parentb77551adee831302f22dc7d9fdccd597923511c4 (diff)
[ruby/prism] Prism.parse_success?(source)
A lot of tools use Ripper/RubyVM::AbstractSyntaxTree to determine if a source is valid. These tools both create an AST instead of providing an API that will return a boolean only. This new API only creates the C structs, but doesn't bother reifying them into Ruby/the serialization API. Instead it only returns true/false, which is significantly more efficient. https://.com/ruby/prism/commit/7014740118
-rw-r--r--lib/prism/ffi.rb15
1 files changed, 14 insertions, 1 deletions
@@ -72,7 +72,8 @@ module Prism
"pm_serialize_parse",
"pm_serialize_parse_comments",
"pm_serialize_lex",
- "pm_serialize_parse_lex"
)
load_exported_functions_from(
@@ -268,6 +269,18 @@ module Prism
end
end
private
# Convert the given options into a serialized options string.