Jeremy Evans
89486c79bb
Make error messages clear blocks/keywords are disallowed in index assignment
...
Blocks and keywords are allowed in regular index.
Also update NEWS to make this more clear.
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2024-05-31 08:22:40 -07:00
nasa
af89465406
[ruby/prism] Document `ForNode` fields
...
(https://github.com/ruby/prism/pull/2845 )
* Add document
* fix
* fix fmt
* fix fmt
* Revert "fix fmt"
This reverts commit https://github.com/ruby/prism/commit/b23a05a94148 .
* add potition
* fix fmt
* reposition
* fix indent
* fix comment
* fix indent
https://github.com/ruby/prism/commit/0dd4c1bba1
2024-05-29 13:36:10 +00:00
Kevin Newton
7f18126882
[ruby/prism] Fix line continuation heredoc dedent calculation
...
https://github.com/ruby/prism/commit/63b596df07
2024-05-28 16:31:55 +00:00
Herwin
61e2916d1c
[ruby/prism] Typo fix: poitive => positive
...
https://github.com/ruby/prism/commit/d13a05252d
2024-05-28 15:28:02 +00:00
Kevin Newton
9f71393fe4
[ruby/prism] Fix up self-write order for lex
...
https://github.com/ruby/prism/commit/8f6da451b4
2024-05-24 17:37:51 +00:00
Kevin Newton
745a948b6d
[ruby/prism] Remove dynamic Debug module methods
...
https://github.com/ruby/prism/commit/b850794db9
2024-05-24 17:19:36 +00:00
Kevin Newton
79001c8b4a
[ruby/prism] Remove error formatting, put directly in CRuby
...
https://github.com/ruby/prism/commit/53b2866487
2024-05-24 17:19:36 +00:00
Kevin Newton
653652bcbe
[ruby/prism] Remove Debug#named_captures
...
https://github.com/ruby/prism/commit/5050dfbe70
2024-05-24 17:19:35 +00:00
Kevin Newton
e1041a8eda
[ruby/prism] Move profiling to prism module directly
...
https://github.com/ruby/prism/commit/75fabf7081
2024-05-24 17:19:35 +00:00
Kevin Newton
b04c959621
[ruby/prism] Remove various unused memsize infra
...
https://github.com/ruby/prism/commit/283938ed1f
2024-05-24 17:19:34 +00:00
Kevin Newton
b8681c2e37
[ruby/prism] Remove Debug::integer_parse
...
https://github.com/ruby/prism/commit/14e397598b
2024-05-24 17:19:33 +00:00
Kevin Newton
870350253e
[ruby/prism] Remove Debug::static_inspect
...
https://github.com/ruby/prism/commit/486c71c426
2024-05-24 17:19:33 +00:00
Kevin Newton
7021e15652
[ruby/prism] Update duplicated when error message
...
https://github.com/ruby/prism/commit/54316fd8a0
2024-05-24 12:36:54 -04:00
eileencodes
c96b5791ef
[ruby/prism] Raise `void value expression` in begin clauses
...
In some cases Prism was either not raising an appropriate `void value
expression` error, or raising that error when the syntax is considered
valid.
To fix this Prism needs to check whether we have other clauses on the
`begin` rather than just returning `cast->statements`.
* If the `cast->statements` are null and the `cast->ensure_clause` is
not null, set the code to `cast->ensure_clause`
* else
* If there is a `cast->rescue_clause`
* Check if `cast->statements` are null and `cast->rescue_clause->statements`
are null, and return `NULL`
* Check if there is an `else_clause`, and set the node to
`cast->else_clause`.
* Otherwise return `cast->statements` as the node
* return `cast->statements` as the node
See tests for test cases. Note I took these directly from CRuby so if
desired I can delete them since the test will now pass. This only fixes
one test in the `test_parse` file, taking failures from 14 to 13.
This fixes `TestParse#test_void_value_in_rhs` and is related to
issue #2791 .
https://github.com/ruby/prism/commit/398152b412
2024-05-23 19:30:03 +00:00
Kevin Newton
e5e079e70f
[ruby/prism] Only accept command call when specified for constant path
...
https://github.com/ruby/prism/commit/0ae908b6ee
2024-05-23 18:45:04 +00:00
Kevin Newton
7d89d52714
[ruby/prism] Disallow newlines in heredoc identifiers
...
https://github.com/ruby/prism/commit/737f2c2117
2024-05-23 15:51:27 +00:00
Kevin Newton
6d81ae3f01
[PRISM] Properly support 'it'
2024-05-22 16:34:04 -04:00
Kevin Newton
e575954887
[ruby/prism] Fix support for 'it' implicit local variable
...
https://github.com/ruby/prism/commit/53bbcfe513
2024-05-22 16:34:04 -04:00
Kevin Newton
89efb94fec
[ruby/prism] Reconfigure rationals
...
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-21 14:27:46 -04:00
Kevin Newton
ff43b4a28b
[ruby/prism] Add error for numbered parameter used in inner block
...
https://github.com/ruby/prism/commit/c386ba6d48
2024-05-21 15:46:45 +00:00
Kevin Newton
7c2c528d35
[ruby/prism] Fix up regexp escapes with control/meta
...
https://github.com/ruby/prism/commit/8a7afa6988
2024-05-20 19:39:21 +00:00
Kevin Newton
012b764f7c
[ruby/prism] Fix up regexp escapes with control/meta and x
...
https://github.com/ruby/prism/commit/1dbbbedf55
2024-05-20 19:39:21 +00:00
Kevin Newton
ca5b458044
[PRISM] Match CRuby line semantics for evstr
2024-05-20 11:28:53 -04:00
Kevin Newton
2e8ae13974
[ruby/prism] Fix invalid read at EOF
...
https://github.com/ruby/prism/commit/dddaf67c34
2024-05-20 14:42:58 +00:00
Kevin Newton
e90e8f8bd3
[ruby/prism] Implement ambiguous binary operator warning
...
https://github.com/ruby/prism/commit/6258c3695f
2024-05-20 14:01:05 +00:00
Kevin Newton
0649c1e3bc
[ruby/prism] Revert incorrect synthesized true node change
...
https://github.com/ruby/prism/commit/31ef81fd06
2024-05-17 14:47:18 +00:00
S-H-GAMELINKS
aed93ba19e
[ruby/prism] Replace and Use PM_LOCATION_NULL_VALUE macro
...
https://github.com/ruby/prism/commit/50e188b168
2024-05-17 14:45:42 +00:00
Kevin Newton
92af705498
[ruby/prism] Truncate source lines in errors messages when too long
...
https://github.com/ruby/prism/commit/72518f5716
2024-05-16 19:35:10 +00:00
Kevin Newton
98e1e610f6
[ruby/prism] Update more escape error messages to match CRuby
...
https://github.com/ruby/prism/commit/ab43b3ab66
2024-05-16 18:40:20 +00:00
Kevin Newton
286d3032a7
[ruby/prism] More mixed encoding errors
...
https://github.com/ruby/prism/commit/2a43b4f55c
2024-05-16 17:22:14 +00:00
Kevin Newton
d314d976d4
[ruby/prism] Match CRuby invalid escape character syntax error message
...
https://github.com/ruby/prism/commit/0ef5658dcc
2024-05-16 15:10:49 +00:00
Kevin Newton
0e11781f21
[ruby/prism] Match CRuby invalid character error message
...
https://github.com/ruby/prism/commit/8d4c5c2bca
2024-05-16 15:10:03 +00:00
Kevin Newton
910bb49230
[ruby/prism] Update error message for invalid % at EOF
...
https://github.com/ruby/prism/commit/178d4f66fd
2024-05-16 14:52:34 +00:00
Kevin Newton
7a4b9d1614
[ruby/prism] Match CRuby error message for unknown % string
...
https://github.com/ruby/prism/commit/863197629c
2024-05-16 14:23:36 +00:00
Kevin Newton
011668883c
[ruby/prism] Always go to string lex mode even if EOF
...
https://github.com/ruby/prism/commit/57d5c9be2c
2024-05-16 14:16:32 +00:00
Kevin Newton
477b13ba17
[ruby/prism] Update unterminated string error location
...
https://github.com/ruby/prism/commit/33d12afa60
2024-05-16 14:00:18 +00:00
Kevin Newton
cbd1553800
[ruby/prism] Extend the bounds of the invalid global variable name error
...
https://github.com/ruby/prism/commit/89d0d9851a
2024-05-15 15:53:24 +00:00
Kevin Newton
c4a5866798
[ruby/prism] Replace end of file with end-of-input
...
https://github.com/ruby/prism/commit/dd532ded95
2024-05-15 15:44:16 +00:00
Kevin Newton
e6340258f8
[ruby/prism] Autoload newlines and comment visitors
...
Having the @newline instance variable in every node adds up, and
since it is so rarely used, we only want to add it when necessary.
Moving this into an autoloaded file and moving the instance variable
out of the default initializers reduces allocated memory because the
nodes are now smaller and some fit into the compact list. On my
machine, I'm seeing about an 8% drop.
https://github.com/ruby/prism/commit/eea92c07d2
2024-05-13 15:34:47 +00:00
Kevin Newton
afdfff933f
[PRISM] Bump to version 0.29.0
2024-05-10 13:09:45 -04:00
Kevin Newton
83f481ebf0
[ruby/prism] Enhance parameter forwarding error messages
...
https://github.com/ruby/prism/commit/826657232e
2024-05-10 15:54:15 +00:00
Kevin Newton
2e44664547
[ruby/prism] operator rename
...
https://github.com/ruby/prism/commit/b5e47f5c42
2024-05-10 11:47:48 -04:00
Kevin Newton
346f7bf33e
[ruby/prism] Fix escaping control+x
...
https://github.com/ruby/prism/commit/0f0b4c1161
2024-05-10 00:54:31 -04:00
Kevin Newton
442e398e62
[ruby/prism] Ensure keyword parameters are not constants
...
https://github.com/ruby/prism/commit/fd210115c1
2024-05-08 18:56:14 +00:00
Kevin Newton
128c9a92dd
[ruby/prism] Enhance def params term error message
...
https://github.com/ruby/prism/commit/3af1acd5da
2024-05-08 17:58:46 +00:00
Kevin Newton
2d631cf428
[ruby/prism] Fix line number of unreachable statement warning
...
https://github.com/ruby/prism/commit/62f6b1f2e2
2024-05-08 17:30:18 +00:00
Kevin Newton
61829eec65
[ruby/prism] Ensure keyword parameters do not end in ! or ?
...
https://github.com/ruby/prism/commit/57d86a8545
2024-05-08 16:52:07 +00:00
Kevin Newton
84ba35e8c2
[ruby/prism] Invalid escape character syntax for nested unicode escapes
...
https://github.com/ruby/prism/commit/623a0bb995
2024-05-08 16:38:22 +00:00
Kevin Newton
7c1e11fe02
[ruby/prism] Validate Unicode escape sequences are not surrogates
...
https://github.com/ruby/prism/commit/64d2ce2622
2024-05-08 16:26:50 +00:00
Kevin Newton
548a72e537
[PRISM] Sync prism version bump
2024-05-08 10:20:48 -04:00
Kevin Newton
74d948a617
[ruby/prism] Better error message on missing hash value
...
https://github.com/ruby/prism/commit/b20e37e82e
2024-05-08 12:52:54 +00:00
Kevin Newton
21b94ae0d1
[ruby/prism] Extend error message for unterminated HEREDOC
...
https://github.com/ruby/prism/commit/c1b07ec11b
2024-05-07 18:03:03 +00:00
Kevin Newton
dcbe0edb83
[ruby/prism] Better error message for contents of hash pattern
...
https://github.com/ruby/prism/commit/60dbf60f48
2024-05-07 17:22:50 +00:00
Kevin Newton
5d44846815
[ruby/prism] Disallow implicit hash in array pattern
...
https://github.com/ruby/prism/commit/bdd509c6ac
2024-05-07 17:15:14 +00:00
Kevin Newton
8ec1c416f7
[ruby/prism] Specific error message for symbol literal with interpolation in hash patterns
...
https://github.com/ruby/prism/commit/31f0201bae
2024-05-07 16:31:05 +00:00
Kevin Newton
8cc733dff7
[ruby/prism] Add error for invalid implicit local writes
...
https://github.com/ruby/prism/commit/ab21882561
2024-05-07 16:31:05 +00:00
Kevin Newton
eb8efa42f0
[ruby/prism] shareable_constant_value line warnings
...
https://github.com/ruby/prism/commit/8c984b6922
2024-05-07 14:56:48 +00:00
Kevin Newton
d4fdc45953
[ruby/prism] Unexpected fractional component error messages
...
https://github.com/ruby/prism/commit/e893bc2230
2024-05-06 12:09:48 -04:00
Kevin Newton
f92d82ef06
[ruby/prism] More specific error for conflicting forwarding parameters
...
https://github.com/ruby/prism/commit/1c3b48fedb
2024-05-06 12:09:30 -04:00
Kevin Newton
5909186d02
[ruby/prism] Fix up error message for unexpected {
...
https://github.com/ruby/prism/commit/80dbe035ba
2024-05-06 15:09:20 +00:00
Kevin Newton
d4a6d0c177
[ruby/prism] Prism::Location#adjoin
...
https://github.com/ruby/prism/commit/a298db68e3
2024-05-03 19:14:03 +00:00
Kevin Newton
7a49edcf1f
[ruby/prism] Prism::Node#tunnel
...
https://github.com/ruby/prism/commit/0bf5d651da
2024-05-03 18:37:19 +00:00
Kevin Newton
1af2dead5a
[ruby/prism] Disallow *a&.x=0
...
https://github.com/ruby/prism/commit/624fdf74bd
2024-05-03 18:14:55 +00:00
Vinicius Stock
4fbb208185
[ruby/prism] Create specialized `ASCIISource` with asciionly optimizations
...
https://github.com/ruby/prism/commit/40993166a8
2024-05-03 18:10:21 +00:00
Kevin Newton
31361aeca3
[ruby/prism] Disallow safe navigation in a call target node
...
https://github.com/ruby/prism/commit/b1917adac7
2024-05-03 18:09:35 +00:00
Kevin Newton
2368dab1fa
[ruby/prism] Disallow **nil after keyword parameters
...
https://github.com/ruby/prism/commit/5beeae076f
2024-05-03 13:32:32 -04:00
Kevin Newton
7caeff2bae
[ruby/prism] Disallow keywords and blocks in index expressions
...
https://github.com/ruby/prism/commit/e950dc1e83
2024-05-03 13:01:40 -04:00
Kevin Newton
5758e45657
[ruby/prism] Change ConstantPathNode#child to ConstantPathNode#{name,name_loc}
...
This has been requested for a long time, and I'm finally doing it
now. Unfortunately this is a breaking change for all of the APIs.
I've added in a Ruby method for `#child` that is deprecated so that
existing usage doesn't break, but for everyone else this is going
to be a bit of a pain.
https://github.com/ruby/prism/commit/9cbe74464e
2024-05-03 11:11:57 -04:00
Kevin Newton
5409661fe6
Mark the first string element of a regexp as binary if US-ASCII
2024-05-02 22:46:09 -04:00
Kevin Newton
7c0cf71049
[ruby/prism] Node#script_lines and supporting infra
...
https://github.com/ruby/prism/commit/cb4a8ab772
2024-05-02 15:27:18 +00:00
Kevin Newton
de6e05da49
[PRISM] Consolidate handling heredoc terminators
2024-05-01 19:19:07 -04:00
Kevin Newton
8ea6daa86d
[PRISM] Enable passing tests in test_syntax.rb
2024-05-01 19:19:07 -04:00
Kevin Newton
b64fd2f5c5
[PRISM] Closer error messages on invalid unicode escapes in character literals
2024-05-01 19:19:07 -04:00
Kevin Newton
1be5ede766
[PRISM] Error message for unterminated heredoc identifier
2024-05-01 19:19:07 -04:00
Kevin Newton
62f8fb7f89
[PRISM] Fix unterminated regular expression error message
2024-05-01 19:19:07 -04:00
Kevin Newton
5d1e4cd249
[PRISM] Better error messages for unwriteable targets
2024-05-01 19:19:07 -04:00
Kevin Newton
4e8ae5d32a
[PRISM] Match unterminated error messages
2024-05-01 19:19:07 -04:00
Kevin Newton
8e1647c3aa
[ruby/prism] Support passing version 3.3.1
...
https://github.com/ruby/prism/commit/445a0f0d22
2024-05-01 23:03:25 +00:00
Kevin Newton
5cd0abdfb5
[PRISM] Simplify prism error highlighting
2024-05-01 16:57:29 -04:00
Kevin Newton
fc8fb581cf
[ruby/prism] CRuby error message for trailing underscore in number
...
https://github.com/ruby/prism/commit/4e34f236d3
2024-05-01 19:51:09 +00:00
Kevin Newton
efefe42dd1
[ruby/prism] Add more errors for dynamic constant writes in methods
...
https://github.com/ruby/prism/commit/486e4c0367
2024-05-01 19:02:18 +00:00
Kevin Newton
41f8ae1ffd
[ruby/prism] Mark errors for invalid symbols
...
https://github.com/ruby/prism/commit/661884c4a3
2024-05-01 16:43:05 +00:00
Kevin Newton
cfe7019ef5
[ruby/prism] Match CRuby interpolation semantics
...
If a single string that is a static literal is interpolated, it
does not impact whether or not the parent is a static literal. In
this way, if you have something like a regular expression that
interpolates a string literal, it's possible that you will end up
pushing just a single regexp onto the stack as opposed to calling
out to toregexp.
https://github.com/ruby/prism/commit/4f096c2257
2024-05-01 12:34:29 -04:00
Kevin Newton
3872e54039
[ruby/prism] Bump to v0.27.0
...
https://github.com/ruby/prism/commit/c9edeef91a
2024-04-26 17:01:03 -04:00
Kevin Newton
bb3dd5b808
[PRISM] Sync latest config.yml documentation updates
2024-04-26 17:01:03 -04:00
Kevin Newton
9688093124
[ruby/prism] Location#slice_lines, Node#slice_lines
...
https://github.com/ruby/prism/commit/9b61f6fdb3
2024-04-26 19:05:32 +00:00
Kevin Newton
0599184a18
[ruby/prism] Match CRuby error messages for invalid numerics
...
https://github.com/ruby/prism/commit/be21a1bd1d
2024-04-26 18:55:27 +00:00
Kevin Newton
6a296089c6
[ruby/prism] Add a flag on returns when they are redundant
...
https://github.com/ruby/prism/commit/450541d2c3
2024-04-26 18:10:42 +00:00
Kevin Newton
4c431744b7
[ruby/prism] Warn for nested hashes as well
...
https://github.com/ruby/prism/commit/76e802f59e
2024-04-24 19:39:42 +00:00
Kevin Newton
7d64fbda53
[ruby/prism] Remove static literals dependence on parser definition
...
https://github.com/ruby/prism/commit/b3e104e8a2
2024-04-24 19:39:41 +00:00
Kevin Newton
6d9ba1e014
[ruby/prism] Change inspect from recursive to a queue
...
We would previously cause a stack overflow if we parsed a file that
was too deeply nested when we were calling inspect. Instead, we now
use a queue of commands to do it linearly so we don't.
https://github.com/ruby/prism/commit/0f21f5bfe1
2024-04-24 14:16:42 -04:00
Kevin Newton
0defbc11a5
[ruby/prism] Fix recursive multiply when values are switched in karatsuba_multiply
...
https://github.com/ruby/prism/commit/4dc6ea960d
2024-04-23 18:17:29 +00:00
Kevin Newton
4f57262338
[ruby/prism] Use GC-able symbols for AST
...
https://github.com/ruby/prism/commit/801117e45a
2024-04-23 17:26:10 +00:00
Matheus Richard
99a46d7fe9
[ruby/prism] Document UnlessNode fields
...
https://github.com/ruby/prism/commit/eee8276ae6
2024-04-23 15:20:16 +00:00
Daniel Gollahon
b62ab952e3
[ruby/prism] Document `IfNode` fields
...
- Adds documentation for the fields of the `IfNode`. Also updates the overall description to mention ternary expressions.
- Part of #2123
https://github.com/ruby/prism/commit/fd17c0733d
2024-04-23 15:18:52 +00:00
Matheus Richard
b3350e3e6f
[ruby/prism] Document BreakNode fields
...
https://github.com/ruby/prism/commit/7a3ed22f14
2024-04-23 15:11:21 +00:00
Philip Mueller
f7d1699f67
[ruby/prism] Implement case equality on nodes
...
https://github.com/ruby/prism/commit/dc121e4fdf
2024-04-23 13:53:23 +00:00
Cory Hutchison
87b829aa94
[ruby/prism] Document the `AliasGlobalVariableNode` fields
...
https://github.com/ruby/prism/commit/35bc711069
2024-04-23 13:22:05 +00:00
Sanjay Karukamanna
5fd08b506c
[ruby/prism] Document `ArrayNode`, `SourceFileNode` fields
...
https://github.com/ruby/prism/commit/0bdc566f67
2024-04-23 13:13:29 +00:00
Kevin Newton
aa5b53d232
[ruby/prism] Consolidate integer fields into a single reflection class
...
https://github.com/ruby/prism/commit/0156057580
2024-04-22 14:17:45 +00:00
Kevin Newton
23be6599a2
[ruby/prism] Split parse result based on type
...
https://github.com/ruby/prism/commit/17194e096d
2024-04-19 19:25:32 +00:00
Kevin Newton
cb711df36f
[ruby/prism] Do not allow omitted hash keys with ! or ?
...
https://github.com/ruby/prism/commit/06d358aa8d
2024-04-19 18:20:31 +00:00
Kevin Newton
a51139230b
[ruby/prism] Bump to v0.26.0
...
https://github.com/ruby/prism/commit/eadb09ef36
2024-04-18 18:36:57 +00:00
Kevin Newton
d186eb36a4
[ruby/prism] Add a reflection API for determining the fields of a node
...
https://github.com/ruby/prism/commit/f3f9950a74
2024-04-17 13:54:29 -04:00
Kevin Newton
f72436f835
[ruby/prism] Inline pm_state_stack
2024-04-17 10:36:52 -04:00
Kevin Newton
f34409bf87
[ruby/prism] Fix up more clang-analyzer failures
...
https://github.com/ruby/prism/commit/f9a1abbc64
2024-04-17 01:15:21 +00:00
Kevin Newton
646a00892e
[ruby/prism] Fix up clang-analyzer violations
...
https://github.com/ruby/prism/commit/259aef2acd
2024-04-16 14:30:34 +00:00
Kevin Newton
982dfa0793
[ruby/prism] Better error recovery for unwritable nodes
...
https://github.com/ruby/prism/commit/4828e73263
2024-04-16 13:32:59 +00:00
Kevin Newton
3c0756752c
[ruby/prism] Better error message on statement inside argument list
...
https://github.com/ruby/prism/commit/3b1a99526a
2024-04-12 21:46:42 +00:00
Kevin Newton
1521af3259
[ruby/prism] Better error message on invalid def
...
https://github.com/ruby/prism/commit/d398e7d22c
2024-04-12 17:49:17 +00:00
Kevin Newton
52b862398d
[ruby/prism] Syntax error for block argument on yield
...
https://github.com/ruby/prism/commit/9feeafbc67
2024-04-12 17:30:37 +00:00
Kevin Newton
0424c1fa7b
[ruby/prism] Fix up embdoc lexing on EOF
...
https://github.com/ruby/prism/commit/8ee43be26d
2024-04-12 16:50:34 +00:00
Kevin Newton
c41ecf3f47
[ruby/prism] Create the warning for unreachable statements
...
https://github.com/ruby/prism/commit/e17c86b886
2024-04-12 14:58:03 +00:00
Kevin Newton
c553d34835
[ruby/prism] Warn void regardless of eval
...
https://github.com/ruby/prism/commit/48ba434fa4
2024-04-12 14:30:57 +00:00
Kevin Newton
8e514bedf9
[ruby/prism] Remove outdated comment
...
https://github.com/ruby/prism/commit/9adc88ddf8
2024-04-12 14:10:21 +00:00
Kevin Newton
4fc457e2b7
[ruby/prism] Implement the void statement warning
...
https://github.com/ruby/prism/commit/802ff71cd4
2024-04-12 14:10:20 +00:00
Kevin Newton
abd05c848f
Sync latest prism
2024-04-12 09:52:29 -04:00
Nobuyoshi Nakada
69823b97b5
[Bug #20423 ] Fix error message of prism
2024-04-12 17:02:46 +09:00
Nobuyoshi Nakada
e36988450e
[Bug #20423 ] Disallow anonymous block within argument forwarding
2024-04-12 16:07:49 +09:00
Kevin Newton
56f9ac8d31
[ruby/prism] More unreachables
...
https://github.com/ruby/prism/commit/735f3122c2
2024-04-11 12:12:34 +00:00
Kevin Newton
77d3996897
[ruby/prism] Put in an unreachable assert for rescues parsing
...
https://github.com/ruby/prism/commit/7a60b61368
2024-04-10 19:45:13 +00:00
Kevin Newton
0107954f25
[ruby/prism] Fix up invalid global variable error message
...
https://github.com/ruby/prism/commit/8ce9ae487f
2024-04-09 16:29:01 +00:00
Kevin Newton
d101ec65e9
[ruby/prism] Reduce locals variables per CRuby
...
https://github.com/ruby/prism/commit/3e6830c3a5
2024-04-09 15:55:57 +00:00
Kevin Newton
f2ac26d914
[ruby/prism] Bump to v0.25.0
...
https://github.com/ruby/prism/commit/4da514456f
2024-04-05 21:44:06 +00:00
Kevin Newton
fbeb8f2c78
[ruby/prism] Set up location correctly for hashed locals
...
https://github.com/ruby/prism/commit/0334140790
2024-04-05 19:24:04 +00:00
Kevin Newton
1953ead74e
[ruby/prism] Use a simpler and faster hash function for locals
...
https://github.com/ruby/prism/commit/5f56bf4464
2024-04-05 19:24:04 +00:00
Kevin Newton
a801889c58
[ruby/prism] Do not warn for locals that start with _
...
https://github.com/ruby/prism/commit/8b8d66e55d
2024-04-05 19:24:03 +00:00
Kevin Newton
37ba6927d1
[ruby/prism] Always calloc the locals resize
...
https://github.com/ruby/prism/commit/8bbd3fef6f
2024-04-05 19:24:03 +00:00
Kevin Newton
3b59addaf1
[ruby/prism] Provide documentation for the new local tables
...
https://github.com/ruby/prism/commit/7a47a1351f
2024-04-05 19:24:01 +00:00
Kevin Newton
413a151a6b
[ruby/prism] Explicitly cast from uint64_t to double for mid-square hash
...
https://github.com/ruby/prism/commit/06c6501044
2024-04-05 19:24:01 +00:00
Kevin Newton
5e93cf9250
[ruby/prism] Optimize pm_locals_order
...
https://github.com/ruby/prism/commit/13fe4e03c7
2024-04-05 19:24:01 +00:00
Kevin Newton
3638aeb4cb
[ruby/prism] Refactor around pm_parser_scope_find
...
https://github.com/ruby/prism/commit/79d83eb95e
2024-04-05 19:24:00 +00:00
Kevin Newton
dcec1e0dc6
[ruby/prism] Replace old circular parameter definition detection
...
https://github.com/ruby/prism/commit/c739f8e194
2024-04-05 19:24:00 +00:00
Kevin Newton
bf3a911d1b
[ruby/prism] Do not warn on unused parameters
...
https://github.com/ruby/prism/commit/c8d222640a
2024-04-05 19:23:59 +00:00
Kevin Newton
b5b4628991
[ruby/prism] Warn on unused local variables
...
https://github.com/ruby/prism/commit/de111935fb
2024-04-05 19:23:59 +00:00
Kevin Newton
e6aeacb099
[ruby/prism] Lazily hash locals
...
https://github.com/ruby/prism/commit/ef8ea4624a
2024-04-05 19:23:58 +00:00
Kevin Newton
f9c05a65c9
[ruby/prism] Track the number of reads for local variables
...
https://github.com/ruby/prism/commit/dce64f4640
2024-04-05 19:23:58 +00:00
Kevin Newton
540cc886b9
[ruby/prism] Make the locals set switch from list to hash dynamically
...
https://github.com/ruby/prism/commit/c977c4c98a
2024-04-05 19:23:57 +00:00
Kevin Newton
358aeb103b
[ruby/prism] Switch locals to use a hash
...
https://github.com/ruby/prism/commit/f38946021e
2024-04-05 19:23:57 +00:00
Kevin Newton
440c63df31
[ruby/prism] Change forwarding error messages to match CRuby
...
https://github.com/ruby/prism/commit/6a15e475c9
2024-04-04 20:59:08 +00:00
Kevin Newton
6bbb3e31fb
[ruby/prism] Allow retry in rescue modifier
...
https://github.com/ruby/prism/commit/debe19459a
2024-04-03 17:34:12 -04:00
Kevin Newton
e48fd40974
[ruby/prism] No invalid block exits in eval
...
https://github.com/ruby/prism/commit/85e045ce40
2024-04-03 17:34:12 -04:00
Kevin Newton
a64f1ab688
[ruby/prism] Fix up pm_node_list_grow
...
https://github.com/ruby/prism/commit/7784365d3f
2024-04-03 17:34:12 -04:00
Kevin Newton
a33f19f783
[ruby/prism] Allow yields in default values in method definitions
...
https://github.com/ruby/prism/commit/5bc4cc3413
2024-04-03 17:34:12 -04:00
Kevin Newton
bddd004ce9
[ruby/prism] Further delineate block types
...
https://github.com/ruby/prism/commit/750116e5dc
2024-04-03 17:34:12 -04:00
Kevin Newton
e19fccbfdb
[ruby/prism] Delineate rescue/else/ensure for more accurate exits
...
https://github.com/ruby/prism/commit/92868fad78
2024-04-03 17:34:12 -04:00
Kevin Newton
be48b733b6
[ruby/prism] Pass block exits up the tree
...
https://github.com/ruby/prism/commit/168f72b9fe
2024-04-03 17:34:12 -04:00
Kevin Newton
1fb11824f3
[ruby/prism] Introduce PM_NODE_LIST_FOREACH to make it easier to iterate over node lists
...
https://github.com/ruby/prism/commit/5d4da7c69c
2024-04-03 17:34:12 -04:00
Kevin Newton
198d197aeb
[ruby/prism] Allow block exits in defined? and fix modifier while/until
...
https://github.com/ruby/prism/commit/2752f0b8df
2024-04-03 17:34:12 -04:00
Kevin Newton
7ddf093588
[ruby/prism] Allow block exits from while/until/for
...
https://github.com/ruby/prism/commit/bc46306b9b
2024-04-03 17:34:12 -04:00
Kevin Newton
e454cf2202
[ruby/prism] Update fixtures to be all valid Ruby
...
https://github.com/ruby/prism/commit/a0b978d25b
2024-04-03 17:34:12 -04:00
Kevin Newton
7d9e5061aa
[ruby/prism] Correct errors for invalid retry
...
https://github.com/ruby/prism/commit/96ca6e51fc
2024-04-03 17:34:12 -04:00
Kevin Newton
a83736c27d
[ruby/prism] Log errors for invalid jumps
...
https://github.com/ruby/prism/commit/892d0f9310
2024-04-03 17:34:12 -04:00
Kevin Newton
08c841ff63
[ruby/prism] Use tilde for extended error lines
...
https://github.com/ruby/prism/commit/daaa386a4f
2024-04-03 17:34:12 -04:00
Kevin Newton
3147404d64
[ruby/prism] Match circular parameter error message
...
https://github.com/ruby/prism/commit/c0381b10e4
2024-04-03 17:34:12 -04:00
Kevin Newton
b25282e618
[ruby/prism] Replace . with decimal point for strtod
...
https://github.com/ruby/prism/commit/578a4f983e
2024-04-01 19:39:33 +00:00
Kevin Newton
d6c1cc5532
[ruby/prism] Fix up error messages for empty global variable
...
https://github.com/ruby/prism/commit/fa7559d40b
2024-04-01 19:28:05 +00:00
Kevin Newton
d898f00fe1
[ruby/prism] Match error messages for invalid instance/class variables
...
https://github.com/ruby/prism/commit/82fd0599ed
2024-04-01 19:28:05 +00:00
Kevin Newton
67bd5b33f9
[ruby/prism] Match error message for invalid class/module name
...
https://github.com/ruby/prism/commit/f00ae59070
2024-04-01 19:28:04 +00:00
Kevin Newton
05904c3b72
[ruby/prism] Match error message for invalid class/module definition
...
https://github.com/ruby/prism/commit/1879a9d22e
2024-04-01 19:28:04 +00:00
Kevin Newton
a885d597d5
[ruby/prism] Match error message for multiple blocks given
...
https://github.com/ruby/prism/commit/6b594d9d42
2024-04-01 19:28:04 +00:00
Kevin Newton
fee70c1ed7
[ruby/prism] Add better error messages for invalid block-locals
...
https://github.com/ruby/prism/commit/27ad452436
2024-04-01 19:28:03 +00:00
Kevin Newton
1e737ec977
[ruby/prism] Fix up error message for invalid numbered reference alias
...
https://github.com/ruby/prism/commit/74bff9e834
2024-04-01 19:28:03 +00:00
Kevin Newton
a9658b6409
[ruby/prism] Do not track locals starting with _
...
https://github.com/ruby/prism/commit/0d5a6d936a
2024-04-01 18:13:45 +00:00
Kevin Newton
c2735c48a1
[ruby/prism] Track duplicate hash keys for pattern matching
...
https://github.com/ruby/prism/commit/71ea82f299
2024-04-01 18:13:45 +00:00
Kevin Newton
f1e385aad9
[ruby/prism] Track captures in pattern matching for duplicates
...
https://github.com/ruby/prism/commit/aa2182f064
2024-04-01 18:13:44 +00:00
Kevin Newton
cdb8d208c9
[PRISM] Fix error message for duplicate parameter name
2024-03-29 19:32:23 -04:00
Kevin Newton
729a39685b
[ruby/prism] Fix calloc argument order
...
https://github.com/ruby/prism/commit/9947ab13c0
2024-03-29 15:44:02 +00:00
Kevin Newton
718c7d4a37
[ruby/prism] Handle NULL byte terminators for strings, regexps, and lists
...
https://github.com/ruby/prism/commit/79a75258a4
2024-03-29 15:43:55 +00:00
Kevin Newton
a8ec347ca2
[ruby/prism] Allow writing to keywords with named captures if they are already locals
...
https://github.com/ruby/prism/commit/418318e1c8
2024-03-28 20:39:03 +00:00
Kevin Newton
8780059c38
[ruby/prism] Reject invalid capture groups (keywords)
...
https://github.com/ruby/prism/commit/bb78d83e88
2024-03-28 19:30:38 +00:00
Kevin Newton
3e9c684236
[PRISM] Allow space before encoding comment
2024-03-28 13:02:06 -04:00
Kevin Newton
86e0d83a32
[PRISM] Simplify raising load errors
2024-03-28 12:04:35 -04:00
Kevin Newton
d583616f32
[ruby/prism] Ensure deserialization works with errors+warnings>256
...
https://github.com/ruby/prism/commit/f540e830b5
2024-03-28 12:04:35 -04:00
Kevin Newton
35ff302893
[ruby/prism] Various cleanup with new -x option
...
https://github.com/ruby/prism/commit/020756fb11
2024-03-28 12:04:35 -04:00
Kevin Newton
fcc06fa82a
[ruby/prism] CLI -x flag
...
https://github.com/ruby/prism/commit/2068e3c30a
2024-03-28 12:04:35 -04:00
Andrew Konchin
7055dcf915
[ruby/prism] Improve description for InterpolatedStringNodeFlags
...
https://github.com/ruby/prism/commit/caa576d63f
2024-03-28 14:48:20 +00:00
Kevin Newton
9b97f1f3e8
[ruby/prism] Compare duplicates keys/whens for __FILE__
...
https://github.com/ruby/prism/commit/85263ade63
2024-03-27 18:57:35 +00:00
Kevin Newton
4361727d28
[ruby/prism] Warn on static literal arrays in predicate writes
...
https://github.com/ruby/prism/commit/faadd05693
2024-03-27 18:28:58 +00:00
Kevin Newton
39606f36e3
[PRISM] Implicitly change encoding when a UTF-8 BOM is found
2024-03-27 14:19:58 -04:00
Kevin Newton
eb995a6410
[PRISM] Include file and line in error message
2024-03-27 14:19:58 -04:00
Kevin Newton
9b816e674a
[ruby/prism] Add option for inlining messages for error formatting
...
https://github.com/ruby/prism/commit/af0204a8ab
2024-03-27 13:03:11 -04:00
Kevin Newton
2505c27fdf
[PRISM] Fix up some error formatting edge cases
2024-03-27 08:48:32 -04:00
Koichi ITO
4a78d75213
[ruby/prism] Fix an incorrect range of `Prism::Location` when `PM_ERR_RETURN_INVALID`
...
This PR fixes the following incorrect range of `Prism::Location` when `PM_ERR_RETURN_INVALID`.
It may be hard to tell from the text, but this Ruby error highlights `return`:
```console
$ ruby -e 'class Foo return end'
-e:1: Invalid return in class/module body
class Foo return end
-e: compile error (SyntaxError)
```
Previously, the error's `Prism::Location` pointed to `end`:
```console
$ bundle exec ruby -Ilib -rprism -ve 'p Prism.parse("class Foo return end").errors'
ruby 3.3.0 (2023-12-25 revision 5124f9ac75
) [x86_64-darwin22]
[#<Prism::ParseError @type=:return_invalid @message="invalid `return` in a class or module body"
@location=#<Prism::Location @start_offset=17 @length=3 start_line=1> @level=:fatal>]
After this fix, it will indicate `return`.
```console
$ bundle exec ruby -Ilib -rprism -ve 'p Prism.parse("class Foo return end").errors'
ruby 3.3.0 (2023-12-25 revision 5124f9ac75
) [x86_64-darwin22]
[#<Prism::ParseError @type=:return_invalid @message="invalid `return` in a class or module body"
@location=#<Prism::Location @start_offset=10 @length=6 start_line=1> @level=:fatal>]
```
For reference, here are the before and after of `Prism::Translation::Parser`.
Before:
```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve 'p Prism::Translation::Parser33.parse("class Foo return end")'
ruby 3.3.0 (2023-12-25 revision 5124f9ac75
) [x86_64-darwin22]
(string):1:18: error: invalid `return` in a class or module body
(string):1: class Foo return end
(string):1: ^~~
/Users/koic/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/parser-3.3.0.5/lib/parser/diagnostic/engine.rb:72:in `process':
invalid `return` in a class or module body (Parser::SyntaxError)
from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser.rb:220:in `block in unwrap'
from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser.rb:218:in `each'
from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser.rb:218:in `unwrap'
from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser.rb:49:in `parse'
from /Users/koic/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/parser-3.3.0.5/lib/parser/base.rb:33:in `parse'
from -e:1:in `<main>'
```
After:
```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve 'p Prism::Translation::Parser33.parse("class Foo return end")'
ruby 3.3.0 (2023-12-25 revision 5124f9ac75
) [x86_64-darwin22]
(string):1:11: error: invalid `return` in a class or module body
(string):1: class Foo return end
(string):1: ^~~~~~
/Users/koic/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/parser-3.3.0.5/lib/parser/diagnostic/engine.rb:72:in `process':
invalid `return` in a class or module body (Parser::SyntaxError)
from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser.rb:220:in `block in unwrap'
from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser.rb:218:in `each'
from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser.rb:218:in `unwrap'
from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser.rb:49:in `parse'
from /Users/koic/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/parser-3.3.0.5/lib/parser/base.rb:33:in `parse'
from -e:1:in `<main>'
```
This PR ensures that the originally intended `return` is highlighted as it should be.
https://github.com/ruby/prism/commit/1f9af4d2ad
2024-03-26 14:41:27 -04:00
Kevin Newton
8ec7c3ce30
[ruby/prism] Properly handle freeing ephemeral node lists
...
https://github.com/ruby/prism/commit/f49261a9b9
2024-03-26 12:11:09 -04:00
Kevin Newton
2a3601d64e
[ruby/prism] Handle regexp split between heredocs
...
https://github.com/ruby/prism/commit/c1400d8aed
2024-03-26 12:11:09 -04:00
Kevin Newton
240fb3957b
[ruby/prism] Freeze internal parts, again
...
https://github.com/ruby/prism/commit/50372fee5c
2024-03-26 12:11:09 -04:00
Koichi ITO
52cf6ec46b
[ruby/prism] Fix typos
...
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-26 10:51:12 +00:00
Kevin Newton
453de8c2bc
[ruby/prism] Revert "Frozen parts"
...
https://github.com/ruby/prism/commit/48f2e8c169
2024-03-25 19:08:46 +00:00
Kevin Newton
ff8f98f5c2
[ruby/prism] Mark interpolated nodes as static literal
...
https://github.com/ruby/prism/commit/d00977a9bd
2024-03-25 17:36:13 +00:00
Kevin Newton
eef272f154
[ruby/prism] Mark inner parts of interpolated* nodes as frozen
...
https://github.com/ruby/prism/commit/58a127cd5d
2024-03-25 17:36:12 +00:00
Kevin Newton
a08954569f
[ruby/prism] Fix up minimal build setting
...
https://github.com/ruby/prism/commit/98c85c4acb
2024-03-25 11:54:20 -04:00
Kevin Newton
53cc272387
[ruby/prism] Handle CLRF in regexp
...
https://github.com/ruby/prism/commit/b96bada9ae
2024-03-25 11:52:13 -04:00
Kevin Newton
86077fbcde
[ruby/prism] Refactor regexp lexing to make it easier to support CLRF
...
https://github.com/ruby/prism/commit/60805d85ca
2024-03-25 11:52:12 -04:00
Kevin Newton
0bc764b729
[ruby/prism] Handle CLRF inside string contents
...
https://github.com/ruby/prism/commit/aac606301e
2024-03-25 11:52:10 -04:00
Kevin Newton
14ab698967
[ruby/prism] Handle CLRF inside heredoc contents
...
https://github.com/ruby/prism/commit/1fbac72485
2024-03-25 11:52:09 -04:00
Koichi ITO
65264b0dfb
[ruby/prism] Fix build error for C99 and C23 CI matrix
...
This PR fixes the following build error for C99 and C23 Ruby's CI matrix:
```console
../src/prism/prism.c:1241:19: error: initializing 'char *' with an expression of
type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
1241 | char *word = unknown_flags_length >= 2 ? "options" : "option";
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
assembling ../src/coroutine/amd64/Context.S
```
- c99 ... https://github.com/ruby/ruby/actions/runs/8419905079/job/23053543994#step:10:249
- c23 ... https://github.com/ruby/ruby/actions/runs/8419905079/job/23053544274#step:10:257
This is an incorrect code introduced in https://github.com/ruby/prism/pull/2618 .
https://github.com/ruby/prism/commit/4d9d73fcb9
2024-03-25 14:11:07 +00:00
Franck Trouillez
54428c2bf1
[ruby/prism] Add missing symbol in comment for binding powers for `||=`
...
This adds in the descriptive comment the `||=` operator corresponding to `PM_TOKEN_PIPE_PIPE_EQUAL` for pm_binding_powers[PM_TOKEN_MAXIMUM] in prism.c
https://github.com/ruby/prism/commit/315ca16e23
2024-03-25 12:16:46 +00:00
Franck Trouillez
d05135727f
[ruby/prism] Fix comment typos in prism.c
...
This fixes some comment typos in English in the prism.c file. It fixes some typos and follows the current conventions:
- Sentences in comments end with `.`
- Use infinitive instead of 3rd person present simple to describe functions
https://github.com/ruby/prism/commit/01324e89db
2024-03-25 12:16:45 +00:00
Koichi ITO
56a2fad2a4
[ruby/prism] Fix incorrect paring when using invalid regexp options
...
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-25 12:16:32 +00:00