summaryrefslogtreecommitdiff
path: root/prism/util
AgeCommit message (Collapse)Author
2025-12-08Bump Prism to v1.5.2Takashi Kokubun
[Backport #21187]
2025-09-12Bump Prism version to 1.5.0Takashi Kokubun
2025-03-03[ruby/prism] Use a locale-insensitive version of tolowerJean Boussier
[Bug #21161] The `tolower` function provided by the libc is locale dependent and can behave in ways you wouldn't expect for some value of `LC_CTYPE`. https://github.com/ruby/prism/commit/e3488256b4 Co-Authored-By: Nobuyoshi Nakada <nobu@ruby-lang.org>
2024-11-28[ruby/prism] Fix a possible leak of a file descriptorYusuke Endoh
When mmap fails for any reason, the fd must be closed. Coverity Scan found this issue. https://github.com/ruby/prism/commit/c06e9c400f
2024-10-28[ruby/prism] Only read from buffer if `size` is greater than 0Aaron Patterson
It looks like we can possibly do an out of bounds read if size is equal to 0. This commit adds a conditional to ensure size is actually greater than 0 before looking backwards in the buffer https://github.com/ruby/prism/commit/2031b626e6
2024-09-13[ruby/prism] Stat file first to check directoryKevin Newton
https://github.com/ruby/prism/commit/4ed7de537b
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-09-11[ruby/prism] Parse tempfileKevin Newton
https://github.com/ruby/prism/commit/31154a389a
2024-08-26Shrink `pm_integer_t` (32 bytes → 24)Alexander Momchilov
2024-07-26[ruby/prism] Add explicit check for PRISM_HAS_NO_FILESYSTEMYuta Saito
https://github.com/ruby/prism/commit/89c22f0e6c
2024-07-26[ruby/prism] Fallback to pm_string_file_init on platforms without ↵Yuta Saito
memory-mapped files > ..., and on other POSIX systems we'll use `read`. As `pm_string_mapped_init`'s doc comment says, it should fall back to `read(2)`-based implementation on platforms without memory-mapped files like WASI, but it didn't. This commit fixes it by calling `pm_string_file_init` in the fallback case. Also `defined(_POSIX_MAPPED_FILES)` check for `read(2)`-based path is unnecessary, and it prevents the fallback from being executed, so this change removes it. https://github.com/ruby/prism/commit/b3d9064b71
2024-07-18[PRISM] Ensure not opening directoriesKevin Newton
Notes: Merged: https://github.com/ruby/ruby/pull/11196
2024-07-11[PRISM] Use node ids for error highlightKevin Newton
2024-06-05[ruby/prism] Remove unused string list structKevin Newton
https://github.com/ruby/prism/commit/36c6851c85
2024-05-28[ruby/prism] Typo fix: poitive => positiveHerwin
https://github.com/ruby/prism/commit/d13a05252d
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-21[ruby/prism] Reconfigure rationalsKevin Newton
This eliminates the subnode on RationalNode and replaces it with two integer fields, which represent the ratio for the rational. It also reduces those two integers if they both fit into 32 bits. Importantly, this PR does not implement bignum reduction. That's something I'd like to consider for the future, but it's simple enough for now to leave them unreduced, which makes it more useful than it used to be. https://github.com/ruby/prism/commit/86e06c7068
2024-05-16[ruby/prism] More mixed encoding errorsKevin Newton
https://github.com/ruby/prism/commit/2a43b4f55c
2024-04-23[ruby/prism] Fix recursive multiply when values are switched in ↵Kevin Newton
karatsuba_multiply https://github.com/ruby/prism/commit/4dc6ea960d
2024-04-17[ruby/prism] Inline pm_state_stackKevin Newton
2024-04-17[ruby/prism] Fix up more clang-analyzer failuresKevin Newton
https://github.com/ruby/prism/commit/f9a1abbc64
2024-04-16[ruby/prism] Fix up clang-analyzer violationsKevin Newton
https://github.com/ruby/prism/commit/259aef2acd
2024-04-05[ruby/prism] Make the locals set switch from list to hash dynamicallyKevin Newton
https://github.com/ruby/prism/commit/c977c4c98a
2024-04-05[ruby/prism] Switch locals to use a hashKevin Newton
https://github.com/ruby/prism/commit/f38946021e
2024-03-28[ruby/prism] Various cleanup with new -x optionKevin Newton
https://github.com/ruby/prism/commit/020756fb11
2024-03-28[ruby/prism] CLI -x flagKevin Newton
https://github.com/ruby/prism/commit/2068e3c30a
2024-03-25[ruby/prism] Fix incorrect paring when using invalid regexp optionsKoichi ITO
Fixes https://github.com/ruby/prism/pull/2617. There was an issue with the lexer as follows. The following are valid regexp options: ```console $ bundle exec ruby -Ilib -rprism -ve 'p Prism.lex("/x/io").value.map {|token| token[0].type }' ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22] [:REGEXP_BEGIN, :STRING_CONTENT, :REGEXP_END, :EOF] ``` The following are invalid regexp options. Unnecessary the `IDENTIFIER` token is appearing: ```console $ bundle exec ruby -Ilib -rprism -ve 'p Prism.lex("/x/az").value.map {|token| token[0].type }' ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22] [:REGEXP_BEGIN, :STRING_CONTENT, :REGEXP_END, :IDENTIFIER, :EOF] ``` As a behavior of Ruby, when given `A` to `Z` and `a` to `z`, they act as invalid regexp options. e.g., ```console $ ruby -e '/regexp/az' -e:1: unknown regexp options - az /regexp/az -e: compile error (SyntaxError) ``` Thus, it should probably not be construed as `IDENTIFIER` token. Therefore, `pm_byte_table` has been adapted to accept those invalid regexp option values. Whether it is a valid regexp option or not is checked by `pm_regular_expression_flags_create`. For invalid regexp options, `PM_ERR_REGEXP_UNKNOWN_OPTIONS` is added to diagnostics. https://github.com/ruby/prism/commit/d2a6096fcf
2024-03-13[PRISM] Remove ssize_t definition from prismKevin Newton
2024-03-13[ruby/prism] Remove ssize_t usageKevin Newton
https://github.com/ruby/prism/commit/64c4f1268b
2024-03-12Define `ssize_t` on mswin buildNobuyoshi Nakada
2024-03-12[ruby/prism] Static literals inspectKevin Newton
https://github.com/ruby/prism/commit/4913d112da
2024-03-11[ruby/prism] Provide more documentation for pm_integer_parse_digit_valuesKevin Newton
https://github.com/ruby/prism/commit/c3fcb5031f
2024-03-11[ruby/prism] Stop crashing on invalid integersKevin Newton
https://github.com/ruby/prism/commit/afac2d6646
2024-03-07[ruby/prism] Shared integer parsing logicKevin Newton
https://github.com/ruby/prism/commit/a2594a23c1
2024-03-07[ruby/prism] Style and allocation functionsKevin Newton
https://github.com/ruby/prism/commit/97f838c323
2024-03-07[ruby/prism] Change pm_integer_t structuretompng
https://github.com/ruby/prism/commit/588acf823f
2024-03-07[ruby/prism] Faster pm_integer_parse pm_integer_string using karatsuba algorithmtompng
https://github.com/ruby/prism/commit/ae4fb6b988
2024-03-06[ruby/prism] Parse files from Ruby API using fread, not mmapKevin Newton
https://github.com/ruby/prism/commit/62d4376a53
2024-03-05[DOC] fix some commentscui fliter
Signed-off-by: cui fliter <imcusg@gmail.com>
2024-03-04[ruby/prism] Additional fix of adding `x` prefix after rebase with main branchHASUMI Hitoshi
https://github.com/ruby/prism/commit/08733438bd
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-23[ruby/prism] Convert pm_integer_t to stringsKevin Newton
https://github.com/ruby/prism/commit/fa9a30ad91
2024-02-23[ruby/prism] Factor in sign to integer comparisonKevin Newton
https://github.com/ruby/prism/commit/377666a5df
2024-02-23[ruby/prism] Duplicated when clausesKevin Newton
https://github.com/ruby/prism/commit/865b0d5fbe
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