| Age | Commit message (Collapse) | Author |
|
|
|
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]
|
|
[ruby/prism] Freeze `Prism::VERSION`
Closes https://github.com/ruby/prism/pull/3422
https://github.com/ruby/prism/commit/b488a84253
|
|
https://github.com/ruby/prism/commit/0635814327
|
|
Introduce StringQuery to provide methods to access some metadata
about the Ruby lexer.
https://github.com/ruby/prism/commit/d3f55b67b9
|
|
https://github.com/ruby/prism/commit/a4fcd5339a
|
|
* 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
|
|
https://github.com/ruby/prism/commit/b28877fa4f
|
|
https://github.com/ruby/prism/commit/0b527ca93f
|
|
Fixes [Bug #20730]
Notes:
Merged: https://github.com/ruby/ruby/pull/11617
|
|
https://github.com/ruby/prism/commit/d68ea29d04
Notes:
Merged: https://github.com/ruby/ruby/pull/11497
|
|
https://github.com/ruby/prism/commit/487f0ffe78
|
|
… by allocating them with the correct capacity.
|
|
https://github.com/ruby/prism/commit/084baca463
|
|
`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
|
|
https://github.com/ruby/prism/commit/4a41d298c8
|
|
https://github.com/ruby/prism/commit/4601d3adfd
|
|
https://github.com/ruby/prism/commit/f7faedfb3f
|
|
|
|
https://github.com/ruby/prism/commit/b850794db9
|
|
https://github.com/ruby/prism/commit/53b2866487
|
|
https://github.com/ruby/prism/commit/5050dfbe70
|
|
https://github.com/ruby/prism/commit/75fabf7081
|
|
https://github.com/ruby/prism/commit/283938ed1f
|
|
https://github.com/ruby/prism/commit/14e397598b
|
|
https://github.com/ruby/prism/commit/486c71c426
|
|
https://github.com/ruby/prism/commit/40993166a8
|
|
https://github.com/ruby/prism/commit/b3e104e8a2
|
|
https://github.com/ruby/prism/commit/17194e096d
|
|
https://github.com/ruby/prism/commit/f3f9950a74
|
|
https://github.com/ruby/prism/commit/f540e830b5
|
|
https://github.com/ruby/prism/commit/2068e3c30a
|
|
https://github.com/ruby/prism/commit/af0204a8ab
|
|
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
|
|
https://github.com/ruby/prism/commit/98c85c4acb
|
|
https://github.com/ruby/prism/commit/592128de4d
|
|
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
|
|
https://github.com/ruby/prism/commit/4913d112da
|
|
https://github.com/ruby/prism/commit/665f533373
|
|
https://github.com/ruby/prism/commit/a2594a23c1
|
|
https://github.com/ruby/prism/commit/588acf823f
|
|
https://github.com/ruby/prism/commit/f0a2ce1c0e
|
|
https://github.com/ruby/prism/commit/efdc2b7222
|
|
https://github.com/ruby/prism/commit/a735c2262f
|
|
https://github.com/ruby/prism/commit/62d4376a53
|
|
- 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
|
|
https://github.com/ruby/prism/commit/369ffbd57e
|
|
https://github.com/ruby/prism/commit/4ef4032774
|
|
https://github.com/ruby/prism/commit/959eb506ca
|
|
https://github.com/ruby/prism/commit/fa9a30ad91
|