summaryrefslogtreecommitdiff
path: root/prism/extension.c
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]
2025-04-14merge revision(s) f27ed98effff9891d28edc7119d45811bcedd510: [Backport #21183]Takashi Kokubun
[ruby/prism] Freeze `Prism::VERSION` Closes https://github.com/ruby/prism/pull/3422 https://github.com/ruby/prism/commit/b488a84253
2024-10-13[ruby/prism] Supress string_query function warningS-H-GAMELINKS
https://github.com/ruby/prism/commit/0635814327
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-09-24[ruby/prism] Accept all 3.3.x and 3.4.x Ruby versions for Prism.parseBenoit Daloze
https://github.com/ruby/prism/commit/a4fcd5339a
2024-09-24[ruby/prism] check_string() should always return a valid C stringBenoit Daloze
* Otherwise it is invalid e.g. to call strlen() to the result, or to assume the argument was a string. * All callers are already checking for nil before. https://github.com/ruby/prism/commit/8197be883e
2024-09-20[ruby/prism] Introduce partial_script optionKevin Newton
https://github.com/ruby/prism/commit/b28877fa4f
2024-09-13[ruby/prism] Expose main_script in serialization APIKevin Newton
https://github.com/ruby/prism/commit/0b527ca93f
2024-09-13[PRISM] Only parse shebang on main scriptKevin Newton
Fixes [Bug #20730] Notes: Merged: https://github.com/ruby/ruby/pull/11617
2024-09-12[ruby/prism] Check errno for parsing directoryKevin Newton
https://github.com/ruby/prism/commit/d68ea29d04 Notes: Merged: https://github.com/ruby/ruby/pull/11497
2024-09-11[ruby/prism] UTF-8 characters in file nameKevin Newton
https://github.com/ruby/prism/commit/487f0ffe78
2024-08-27Optimize Array allocationsAlexander Momchilov
… by allocating them with the correct capacity.
2024-08-15[ruby/prism] Fix up lex result constantsKevin Newton
https://github.com/ruby/prism/commit/084baca463
2024-08-10[ruby/prism] [Doc] Tweak the docs for lex APIsKoichi ITO
`Prism.lex` and `Prism.lex_file` return `ParseLexResult` instead of `Array`. `Prism::parse_lex` and `Prism::parse_lex_file` return `ParseLexResult` instead of `ParseResult`. This PR updates the documentation to reflect these return values. https://github.com/ruby/prism/commit/ee331941c0
2024-07-17[ruby/prism] Have parse_stream handle NUL bytesKevin Newton
https://github.com/ruby/prism/commit/4a41d298c8
2024-06-19[ruby/prism] Make sure Init_prism is visible for extensionKevin Newton
https://github.com/ruby/prism/commit/4601d3adfd
2024-06-10[ruby/prism] Provide ability to lock encoding while parsingKevin Newton
https://github.com/ruby/prism/commit/f7faedfb3f
2024-06-09Use `PRISM_EXPORTED_FUNCTION` consistently with the headerNobuyoshi Nakada
2024-05-24[ruby/prism] Remove dynamic Debug module methodsKevin Newton
https://github.com/ruby/prism/commit/b850794db9
2024-05-24[ruby/prism] Remove error formatting, put directly in CRubyKevin Newton
https://github.com/ruby/prism/commit/53b2866487
2024-05-24[ruby/prism] Remove Debug#named_capturesKevin Newton
https://github.com/ruby/prism/commit/5050dfbe70
2024-05-24[ruby/prism] Move profiling to prism module directlyKevin Newton
https://github.com/ruby/prism/commit/75fabf7081
2024-05-24[ruby/prism] Remove various unused memsize infraKevin Newton
https://github.com/ruby/prism/commit/283938ed1f
2024-05-24[ruby/prism] Remove Debug::integer_parseKevin Newton
https://github.com/ruby/prism/commit/14e397598b
2024-05-24[ruby/prism] Remove Debug::static_inspectKevin Newton
https://github.com/ruby/prism/commit/486c71c426
2024-05-03[ruby/prism] Create specialized `ASCIISource` with asciionly optimizationsVinicius Stock
https://github.com/ruby/prism/commit/40993166a8
2024-04-24[ruby/prism] Remove static literals dependence on parser definitionKevin Newton
https://github.com/ruby/prism/commit/b3e104e8a2
2024-04-19[ruby/prism] Split parse result based on typeKevin Newton
https://github.com/ruby/prism/commit/17194e096d
2024-04-17[ruby/prism] Add a reflection API for determining the fields of a nodeKevin Newton
https://github.com/ruby/prism/commit/f3f9950a74
2024-03-28[ruby/prism] Ensure deserialization works with errors+warnings>256Kevin Newton
https://github.com/ruby/prism/commit/f540e830b5
2024-03-28[ruby/prism] CLI -x flagKevin Newton
https://github.com/ruby/prism/commit/2068e3c30a
2024-03-27[ruby/prism] Add option for inlining messages for error formattingKevin Newton
https://github.com/ruby/prism/commit/af0204a8ab
2024-03-26[ruby/prism] Fix typosKoichi ITO
After finding the "if if" typo, some additional typos identified by running `codespell` are also being corrected: https://github.com/codespell-project/codespell https://github.com/ruby/prism/commit/e6a34cfeeb
2024-03-25[ruby/prism] Fix up minimal build settingKevin Newton
https://github.com/ruby/prism/commit/98c85c4acb
2024-03-20[ruby/prism] Provide options for reducing sizeKevin Newton
https://github.com/ruby/prism/commit/592128de4d
2024-03-13[ruby/prism] Change `frozen_string_literal` to be a tri-stateJean Boussier
An explicit `false` is not equivalent to the comment being missing, because the default can be switched with a runtime flag: ```bash $ ruby --enable-frozen-string-literal -e 'p "foo".frozen?' true ``` https://github.com/ruby/prism/commit/4660f58775
2024-03-12[ruby/prism] Static literals inspectKevin Newton
https://github.com/ruby/prism/commit/4913d112da
2024-03-11[ruby/prism] Support offsetKevin Newton
https://github.com/ruby/prism/commit/665f533373
2024-03-07[ruby/prism] Shared integer parsing logicKevin Newton
https://github.com/ruby/prism/commit/a2594a23c1
2024-03-07[ruby/prism] Change pm_integer_t structuretompng
https://github.com/ruby/prism/commit/588acf823f
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-03-06[ruby/prism] Expose types on diagnosticsKevin Newton
https://github.com/ruby/prism/commit/a735c2262f
2024-03-06[ruby/prism] Parse files from Ruby API using fread, not mmapKevin Newton
https://github.com/ruby/prism/commit/62d4376a53
2024-03-04[ruby/prism] Make alloc interface replaceableHASUMI Hitoshi
- Add `x` prefix to malloc, calloc, realloc, and free (eg: malloc -> xmalloc) - By default, they are replaced with stdlib's functions at build - You can use custom functions by defining `PRISM_CUSTOM_ALLOCATOR` macro https://github.com/ruby/prism/commit/7a878af619
2024-02-29[ruby/prism] Command line options as a bitsetKevin Newton
https://github.com/ruby/prism/commit/369ffbd57e
2024-02-29[ruby/prism] Resync RBI and test it in CIKevin Newton
https://github.com/ruby/prism/commit/4ef4032774
2024-02-27[ruby/prism] Support -p, -n, -a, and -l command line optionsKevin Newton
https://github.com/ruby/prism/commit/959eb506ca
2024-02-23[ruby/prism] Convert pm_integer_t to stringsKevin Newton
https://github.com/ruby/prism/commit/fa9a30ad91