summaryrefslogtreecommitdiff
path: root/prism/prism.h
AgeCommit message (Collapse)Author
2025-09-12Bump Prism version to 1.5.0Takashi Kokubun
2025-08-27When reading from stdin, put a wrapper around the IO objectAaron Patterson
The purpose of this commit is to fix Bug #21188. We need to detect when stdin has run in to an EOF case. Unfortunately we can't _call_ the eof function on IO because it will block. Here is a short script to demonstrate the issue: ```ruby x = STDIN.gets puts x puts x.eof? ``` If you run the script, then type some characters (but _NOT_ a newline), then hit Ctrl-D twice, it will print the input string. Unfortunately, calling `eof?` will try to read from STDIN again causing us to need a 3rd Ctrl-D to exit the program. Before introducing the EOF callback to Prism, the input loop looked kind of like this: ```ruby loop do str = STDIN.gets process(str) if str.nil? p :DONE end end ``` Which required 3 Ctrl-D to exit. If we naively changed it to something like this: ```ruby loop do str = STDIN.gets process(str) if STDIN.eof? p :DONE end end ``` It would still require 3 Ctrl-D because `eof?` would block. In this patch, we're wrapping the IO object, checking the buffer for a newline and length, and then using that to simulate a non-blocking eof? method. This commit wraps STDIN and emulates a non-blocking `eof` function. [Backport #21188]
2024-10-11[ruby/prism] Prism::StringQueryKevin Newton
Introduce StringQuery to provide methods to access some metadata about the Ruby lexer. https://github.com/ruby/prism/commit/d3f55b67b9
2024-05-24[ruby/prism] Remove error formatting, put directly in CRubyKevin Newton
https://github.com/ruby/prism/commit/53b2866487
2024-04-01[ruby/prism] Replace . with decimal point for strtodKevin Newton
https://github.com/ruby/prism/commit/578a4f983e
2024-03-27[ruby/prism] Add option for inlining messages for error formattingKevin Newton
https://github.com/ruby/prism/commit/af0204a8ab
2024-03-20[ruby/prism] Provide options for reducing sizeKevin Newton
https://github.com/ruby/prism/commit/592128de4d
2024-03-07[ruby/prism] Remove restrict to fix windows 2015Kevin Newton
https://github.com/ruby/prism/commit/f0a2ce1c0e
2024-03-07[ruby/prism] Support parsing streamsKevin Newton
https://github.com/ruby/prism/commit/efdc2b7222
2024-02-23[ruby/prism] Duplicated hash keysKevin Newton
https://github.com/ruby/prism/commit/3e10c46c14
2024-02-22[ruby/prism] Parse float valuesKevin Newton
https://github.com/ruby/prism/commit/9137226a52
2024-02-22[ruby/prism] Regenerate snapshots using integer valuesKevin Newton
2024-02-22[ruby/prism] Parse numeric valuesKevin Newton
https://github.com/ruby/prism/commit/a6a552411c
2024-02-17[ruby/prism] Provide the ability to dump AST to JSON from CKevin Newton
https://github.com/ruby/prism/commit/d3a149efc5
2024-02-16[ruby/prism] BuiltinsKevin Newton
https://github.com/ruby/prism/commit/851f2571ff
2024-01-30[ruby/prism] Better error messages for unexpected tokens in prefixKevin Newton
https://github.com/ruby/prism/commit/a35b8e45ee
2024-01-11[ruby/prism] Provide ability to format errorsKevin Newton
https://github.com/ruby/prism/commit/27985b0e7e
2024-01-02Sync to latest prismKevin Newton
2023-12-13[ruby/prism] fix typo in docsAlex Koval
https://github.com/ruby/prism/commit/d7fbc09345
2023-12-06[ruby/prism] Provide flags for changing encodingsKevin Newton
https://github.com/ruby/prism/commit/e838eaff6f
2023-12-06Revert "allow enabling Prism via flag or env var"HParker
This reverts commit 9b76c7fc89460ed8e9be40e4037c1d68395c0f6d.
2023-12-05allow enabling Prism via flag or env varHParker
Enable Prism using either --prism ruby --prism test.rb or via env var RUBY_PRISM=1 ruby test.rb
2023-12-01[ruby/prism] Prism.parse_success?(source)Kevin Newton
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://github.com/ruby/prism/commit/7014740118
2023-11-30[ruby/prism] Remove ability to decode other encodingsKevin Newton
https://github.com/ruby/prism/commit/98e218d989
2023-11-03[ruby/prism] Fix up lintKevin Newton
https://github.com/ruby/prism/commit/4f3a3e3ec1
2023-11-03[ruby/prism] Wire up options through the Java parserKevin Newton
https://github.com/ruby/prism/commit/13fa262669
2023-11-03[ruby/prism] Rename serialization APIs for consistencyKevin Newton
https://github.com/ruby/prism/commit/5a2252e3ac
2023-11-03[ruby/prism] Wire up options through the FFI APIKevin Newton
https://github.com/ruby/prism/commit/f0aa8ad93b
2023-11-03[ruby/prism] Create an options struct for passing all of the possible optionsKevin Newton
https://github.com/ruby/prism/commit/99e81619de
2023-11-01[ruby/prism] Fix up lintKevin Newton
https://github.com/ruby/prism/commit/77d4056766
2023-11-01[ruby/prism] Last remaining missing C commentsKevin Newton
https://github.com/ruby/prism/commit/e327449db6
2023-11-01[ruby/prism] Even more C file documentationKevin Newton
https://github.com/ruby/prism/commit/9c648ce615
2023-11-01[ruby/prism] Documentation for pm_strncasecmpKevin Newton
https://github.com/ruby/prism/commit/26934263b7
2023-10-30[ruby/prism] parse_inline_comments -> parse_commentsKevin Newton
https://github.com/ruby/prism/commit/bd4d248fd6
2023-10-27[ruby/prism] Prism.parse_inline_commentsKevin Newton
https://github.com/ruby/prism/commit/5b72f84480
2023-10-26[ruby/prism] Match existing Ruby prettyprintKevin Newton
https://github.com/ruby/prism/commit/6d8358c083
2023-10-25[PRISM] Move pm_scope_node_init to prism_compile.cJemma Issroff
pm_scope_node_init is only used for CRuby, so should not live in the ruby/prism repo. We will merge the changes here first so they're not breaking, and will then remove from ruby/prism
2023-10-18Revert "Revert "[ruby/prism] Change ScopeNode to point to previous ScopeNode""Jemma Issroff
This reverts commit fd87372a7482cbf7672c44ef95bc1dc3b00bab7c.
2023-10-16Revert "[ruby/prism] Change ScopeNode to point to previous ScopeNode"Jemma Issroff
This reverts commit 67a987f82bc8a2b7ec15581306873530821fcf9e.
2023-10-16[ruby/prism] Change ScopeNode to point to previous ScopeNodeJemma Issroff
Amend ScopeNode to point to previous ScopeNode, and to have void* pointers to constants and index_lookup_table https://github.com/ruby/prism/commit/0534324312
2023-10-13Remove old unescaping codeKevin Newton
2023-09-27Sync to prism rename commitsKevin Newton
2023-09-27Rename YARP filepaths to prism filepathsKevin Newton