<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/lib/prism/ffi.rb, branch v3_4_9</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Bump Prism version to 1.5.0</title>
<updated>2025-09-12T21:30:16+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2025-09-12T20:09:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=52b3f006cb31672c45b26f6a44a609fd1b8e2ee5'/>
<id>52b3f006cb31672c45b26f6a44a609fd1b8e2ee5</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>When reading from stdin, put a wrapper around the IO object</title>
<updated>2025-08-27T16:07:32+00:00</updated>
<author>
<name>Aaron Patterson</name>
<email>tenderlove@ruby-lang.org</email>
</author>
<published>2025-07-17T22:20:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=1f421d092bb8c290df5cfc9e95a01e279ebadc42'/>
<id>1f421d092bb8c290df5cfc9e95a01e279ebadc42</id>
<content type='text'>
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]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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]
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Use RbConfig to locate libprism and headers when it is a default gem</title>
<updated>2024-11-12T14:20:39+00:00</updated>
<author>
<name>Benoit Daloze</name>
<email>eregontp@gmail.com</email>
</author>
<published>2024-11-10T14:00:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=6c123649cd9631342395096cf735835820c208b6'/>
<id>6c123649cd9631342395096cf735835820c208b6</id>
<content type='text'>
* This is notably necessary on TruffleRuby, which is updating to Ruby 3.3 which introduces Prism as a default gem.
* Using the existing path is not an option as it would end up in truffleruby/lib/build/libprism.so and
  "truffleruby/lib/include/#{header}" which are not good places for such files.

https://github.com/ruby/prism/commit/5d16473e69
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* This is notably necessary on TruffleRuby, which is updating to Ruby 3.3 which introduces Prism as a default gem.
* Using the existing path is not an option as it would end up in truffleruby/lib/build/libprism.so and
  "truffleruby/lib/include/#{header}" which are not good places for such files.

https://github.com/ruby/prism/commit/5d16473e69
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Prism::StringQuery</title>
<updated>2024-10-11T19:34:57+00:00</updated>
<author>
<name>Kevin Newton</name>
<email>kddnewton@gmail.com</email>
</author>
<published>2024-10-11T18:43:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5f62522d5b8bd162ddf657680b8532eadeaae21f'/>
<id>5f62522d5b8bd162ddf657680b8532eadeaae21f</id>
<content type='text'>
Introduce StringQuery to provide methods to access some metadata
about the Ruby lexer.

https://github.com/ruby/prism/commit/d3f55b67b9
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Introduce StringQuery to provide methods to access some metadata
about the Ruby lexer.

https://github.com/ruby/prism/commit/d3f55b67b9
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Accept version shorthand like 3.4</title>
<updated>2024-09-24T13:21:36+00:00</updated>
<author>
<name>Kevin Newton</name>
<email>kddnewton@gmail.com</email>
</author>
<published>2024-09-24T12:41:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=414a848cc6697067a988e056a787a0a7689c344b'/>
<id>414a848cc6697067a988e056a787a0a7689c344b</id>
<content type='text'>
https://github.com/ruby/prism/commit/098f1c4607
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/prism/commit/098f1c4607
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Accept all 3.3.x and 3.4.x Ruby versions for Prism.parse</title>
<updated>2024-09-24T12:24:19+00:00</updated>
<author>
<name>Benoit Daloze</name>
<email>eregontp@gmail.com</email>
</author>
<published>2024-09-17T20:44:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ed4a55fc4d7dc5f9f95983f4713cbd0c733601a3'/>
<id>ed4a55fc4d7dc5f9f95983f4713cbd0c733601a3</id>
<content type='text'>
https://github.com/ruby/prism/commit/a4fcd5339a
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/prism/commit/a4fcd5339a
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Introduce partial_script option</title>
<updated>2024-09-20T15:42:12+00:00</updated>
<author>
<name>Kevin Newton</name>
<email>kddnewton@gmail.com</email>
</author>
<published>2024-09-20T15:20:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f515a1ab4b04ae79e02194e1f25a400b9f3f8f66'/>
<id>f515a1ab4b04ae79e02194e1f25a400b9f3f8f66</id>
<content type='text'>
https://github.com/ruby/prism/commit/b28877fa4f
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/prism/commit/b28877fa4f
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Expose main_script in serialization API</title>
<updated>2024-09-13T19:13:21+00:00</updated>
<author>
<name>Kevin Newton</name>
<email>kddnewton@gmail.com</email>
</author>
<published>2024-09-13T19:00:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f85efc9748b193bceaefd2e94293927404ac951f'/>
<id>f85efc9748b193bceaefd2e94293927404ac951f</id>
<content type='text'>
https://github.com/ruby/prism/commit/0b527ca93f
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/prism/commit/0b527ca93f
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Check errno for parsing directory</title>
<updated>2024-09-12T17:43:04+00:00</updated>
<author>
<name>Kevin Newton</name>
<email>kddnewton@gmail.com</email>
</author>
<published>2024-09-11T20:49:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=38ba15beed5eb9f3a4923f9a215473965f31a7bc'/>
<id>38ba15beed5eb9f3a4923f9a215473965f31a7bc</id>
<content type='text'>
https://github.com/ruby/prism/commit/d68ea29d04
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/prism/commit/d68ea29d04
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Provide ability to lock encoding while parsing</title>
<updated>2024-06-10T21:21:32+00:00</updated>
<author>
<name>Kevin Newton</name>
<email>kddnewton@gmail.com</email>
</author>
<published>2024-06-10T17:39:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d827d3252786a5e1153f4e8bfa30f40a2aaafb95'/>
<id>d827d3252786a5e1153f4e8bfa30f40a2aaafb95</id>
<content type='text'>
https://github.com/ruby/prism/commit/f7faedfb3f
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/prism/commit/f7faedfb3f
</pre>
</div>
</content>
</entry>
</feed>
