summaryrefslogtreecommitdiff
path: root/test/yarp/errors_test.rb
AgeCommit message (Collapse)Author
2023-09-27Rename YARP filepaths to prism filepathsKevin Newton
2023-09-26[ruby/yarp] Check predicate of while and untilHaldun Bayhantopcu
https://github.com/ruby/yarp/commit/f57a6066b5
2023-09-22[ruby/yarp] Check class name to be a constant path node or a constant read nodeHaldun Bayhantopcu
https://github.com/ruby/yarp/commit/fd7c44f13f
2023-09-22Resync yarp (#8498)Jemma Issroff
* [YARP] Reject numbered parameters in block parameters * [YARP] Do not allow BEGIN except the toplevel --------- Co-authored-by: Haldun Bayhantopcu <haldun@github.com>
2023-09-22[ruby/yarp] Introduce YP_TOKEN_METHOD_NAMEHaldun Bayhantopcu
https://github.com/ruby/yarp/commit/e855bf415c
2023-09-20[ruby/yarp] Check whether the conditional predicate is closedHaldun Bayhantopcu
https://github.com/ruby/yarp/commit/5022b51db2
2023-09-19[ruby/yarp] Consistently place block arguments on block slot for callKevin Newton
https://github.com/ruby/yarp/commit/fe208302e5
2023-09-15[ruby/yarp] Handle missing clauses in case statementKevin Newton
https://github.com/ruby/yarp/commit/1ad7fba5ef
2023-09-15[ruby/yarp] Ensure multi targets are only in valid locationsKevin Newton
https://github.com/ruby/yarp/commit/8bffb8a762
2023-09-15[ruby/yarp] Alnum cannot be %-literal delimitersKevin Newton
https://github.com/ruby/yarp/commit/4ba6d5ca70
2023-09-15[ruby/yarp] Properly handle invalid underscores in number literalsKevin Newton
https://github.com/ruby/yarp/commit/35da3d1a4c
2023-09-15[ruby/yarp] Handle unterminated interpolated symbolKevin Newton
https://github.com/ruby/yarp/commit/9222faa1c6
2023-09-15[ruby/yarp] Handle missing terminators in parenthesized expressionKevin Newton
https://github.com/ruby/yarp/commit/a8b54e8ed0
2023-09-15[ruby/yarp] Fix string delimiter with "@" confused for embeddedJemma Issroff
variable (https://github.com/ruby/yarp/pull/1521) https://github.com/ruby/yarp/commit/3ec0699622
2023-09-15[ruby/yarp] Disallow numbered parameters in multiple scopesKevin Newton
https://github.com/ruby/yarp/commit/5fd4d3b89a
2023-09-15[ruby/yarp] Error when numbered parameters are writtenKevin Newton
https://github.com/ruby/yarp/commit/65b536ba12
2023-09-15[ruby/yarp] Properly handle missing method namesKevin Newton
https://github.com/ruby/yarp/commit/4a30c69051
2023-09-14[ruby/yarp] Simplify multi-target parsingKevin Newton
This simplifies how we handle multi-targets, and also fixes a bug we had where for loops were always getting multi-targets, even when there was only a single target. https://github.com/ruby/yarp/commit/31eb8b7ad5
2023-09-14[ruby/yarp] Write names should not underflow size_tKevin Newton
If the read_name is invalid, we shouldn't try to set a write name. https://github.com/ruby/yarp/commit/06881c8ca7
2023-09-14[ruby/yarp] Handle errors when operator writes on a call with a blockKevin Newton
https://github.com/ruby/yarp/commit/93bec2c173
2023-09-14[ruby/yarp] Reject invalid call-operator-writeKevin Newton
https://github.com/ruby/yarp/commit/d3a852dac2
2023-09-14[ruby/yarp] Add a frozen string flagKevin Newton
https://github.com/ruby/yarp/commit/09248a1f9e
2023-09-14[ruby/yarp] Handle invalid operator write on fcallKevin Newton
https://github.com/ruby/yarp/commit/22c800eab1
2023-09-13[ruby/yarp] Better handle invalid gvar writesKevin Newton
https://github.com/ruby/yarp/commit/eaaebc17c8
2023-09-12[ruby/yarp] Move the post required parameters after the rest parameterBenoit Daloze
* See https://github.com/ruby/yarp/issues/1436 https://github.com/ruby/yarp/commit/6f4e9ff940
2023-09-11[ruby/yarp] Provide a flag for the integer baseKevin Newton
https://github.com/ruby/yarp/commit/45dd046b83
2023-09-07[ruby/yarp] Extract error messages into diagnostic.c and use canonical ↵Mike Dalessio
message IDs The parser now passes around `yp_diagnostic_id_t` for diagnostic messages instead of character strings, and we rely on the function `diagnostic_message()` to resolve that to a string. In addition, many messages were edited so that the parser expresses coordinate ideas in similar form [1] using consistent voice and typographic conventions. Closes https://github.com/ruby/yarp/pull/1379, and makes progress on #941. [1] Strunk & White rule 19 https://github.com/ruby/yarp/commit/0b6dd85bf1
2023-09-07[ruby/yarp] Constants and def nodesKevin Newton
https://github.com/ruby/yarp/commit/6b2421ce1b
2023-09-07[ruby/yarp] Constants on rest parameter nodesKevin Newton
https://github.com/ruby/yarp/commit/a6fdb8aae9
2023-09-07[ruby/yarp] Constants on keyword rest parametersKevin Newton
https://github.com/ruby/yarp/commit/5e1a8fbc54
2023-09-07[ruby/yarp] Constants on keyword parametersKevin Newton
https://github.com/ruby/yarp/commit/d2d4f25a23
2023-09-07[ruby/yarp] Remove name constant from classes/modulesKevin Newton
https://github.com/ruby/yarp/commit/26105f0b58
2023-09-06[ruby/yarp] Constant on block parameter nodeKevin Newton
https://github.com/ruby/yarp/commit/2cd9a67150
2023-09-06[ruby/yarp] Constants on classes and modulesKevin Newton
(https://github.com/ruby/yarp/pull/1409) https://github.com/ruby/yarp/commit/0a11ec579f
2023-09-06[ruby/yarp] Temporarily add name_constant to replace name on ↵Kevin Newton
ClassNode/ModuleNode https://github.com/ruby/yarp/commit/8f87686e9c
2023-09-06[ruby/yarp] Add constants and constantsKevin Newton
https://github.com/ruby/yarp/commit/d7eaa89bc3
2023-09-01[ruby/yarp] Add global variables to the constant poolKevin Newton
https://github.com/ruby/yarp/commit/b48067b067
2023-09-01[ruby/yarp] fix: report syntax error for invalid hex escapeMike Dalessio
Closes https://github.com/ruby/yarp/pull/1367 https://github.com/ruby/yarp/commit/b1ab54f526
2023-09-01[ruby/yarp] fix: double-counting of errors in parsing escaped stringsMike Dalessio
Essentially, this change updates `yp_unescape_calculate_difference` to not create syntax errors, and we rely entirely on `yp_unescape_manipulate_string` to report syntax errors. To do that, this PR adds another (!) parameter to `unescape`: `yp_list_t *error_list`. When present, `unescape` reports syntax errors (and otherwise does not). However, an edge case that needed to be addressed is reporting syntax errors in this case: ?\u{1234 2345} In a string context, it's possible to have multiple codepoints by doing something like `"\u{1234 2345}"`; however, in the character literal context, this is a syntax error -- only a single codepoint is allowed. Unfortunately, when `yp_unescape_manipulate_string` is called, there's nothing to indicate that we are in a "character literal" context and that only a single codepoint is valid. To make this work, this PR: - introduces a new static utility function in yarp.c, `yp_char_literal_node_create_and_unescape`, which is called when we're parsing `YP_TOKEN_CHARACTER_LITERAL` - introduces a new (unexported) function, `yp_unescape_manipulate_char_literal` which does the same thing as `yp_unescape_manipulate_string` but tells `unescape` that only a single codepoint is expected https://github.com/ruby/yarp/commit/f6a65840b5
2023-09-01[ruby/yarp] Move name_loc before value for LocalVariableWriteNodeBenoit Daloze
* Consistent with ClassVariableWriteNode, ConstantWriteNode, InstanceVariableWriteNode, GlobalVariableWriteNode. * Fixes desugaring of local variable with operators. https://github.com/ruby/yarp/commit/9a66737775
2023-09-01[ruby/yarp] Make operator_loc the last field for GlobalVariableWriteNodeBenoit Daloze
* Consistent with ClassVariableWriteNode, ConstantWriteNode, InstanceVariableWriteNode, LocalVariableWriteNode. * Fixes desugaring of global variable with operators. https://github.com/ruby/yarp/commit/fb5a53fc0b
2023-08-31[ruby/yarp] fix: octal, hex, and unicode strings at the end of aMike Dalessio
file (https://github.com/ruby/yarp/pull/1371) * refactor: move EOF check into yp_unescape_calculate_difference parser_lex is a bit more readable when we can rely on that behavior * fix: octal and hex digits at the end of a file Previously this resulted in invalid memory access. * fix: unicode strings at the end of a file Previously this resulted in invalid memory access. * Unterminated curly-bracket unicode is a syntax error https://github.com/ruby/yarp/commit/21cf11acb5
2023-08-30[ruby/yarp] Nest all of the YARP tests under the YARP namespaceKevin Newton
https://github.com/ruby/yarp/commit/440cf93a70
2023-08-30[ruby/yarp] fix: "$" at the end of a fileMike Dalessio
Previously this resulted in invalid memory access as well as a cascading failed assertion: src/enc/yp_unicode.c:2224: yp_utf_8_codepoint: Assertion `n >= 1' failed. Found by the fuzzer. https://github.com/ruby/yarp/commit/a34c534440
2023-08-25[ruby/yarp] Move tests from test/* to test/yarp/* to match CRubyKevin Newton
This should make it easier on the sync to determine what changed and hopefully result in fewer merge conflicts that have to be manually resolved. https://github.com/ruby/yarp/commit/17d82afbfc
2023-08-25[ruby/yarp] Track block opening and closing locationsKevin Newton
https://github.com/ruby/yarp/commit/7984e4ddc7
2023-08-25[ruby/yarp] Add names to classes and modulesKevin Newton
This should hopefully make it easier to compile these nodes, and also for static analysis tools for having a quick label. https://github.com/ruby/yarp/commit/f086662144
2023-08-25[ruby/yarp] fix: unterminated regular expression with a heredocMike Dalessio
Previously this snippet would track the same newline twice, leading to a failed assertion in yp_newline_list_append. https://github.com/ruby/yarp/commit/1d3fe19a94
2023-08-24[ruby/yarp] Improve handling of line endingsMike Dalessio
Introduce three new inline helper functions: - `match_line_ending` - `match_line_ending_at` - `match_line_ending_addr` These functions are similar in signature to the `peek*` functions, but return the length of the line ending being inspected (or 0 if no line ending was found). These functions are then used to simplify how we're detecting line endings throughout "src/yarp.c". Also: - test coverage backfilled for `__END__` comments with CRLF line endings. - error message for invalid `%` tokens updated to not include the potential line endings. - some small refactorings for readability along the way https://github.com/ruby/yarp/commit/a00067386d
2023-08-21[ruby/yarp] fix: parsing a '%' expression with a CR but not a newlineMike Dalessio
Previously this failed an assertion and aborted. https://github.com/ruby/yarp/commit/a037d942a8