aboutsummaryrefslogtreecommitdiffstats
path: root/prism
Commit message (Collapse)AuthorAgeFilesLines
* [ruby/prism] Update ordering of integer base flagsKevin Newton2023-12-071-2/+2
| | | | https://github.com/ruby/prism/commit/d711950d5f
* [ruby/prism] Remove warnings check from parse_success? methodKevin Newton2023-12-071-7/+6
| | | | https://github.com/ruby/prism/commit/e30a241fb3
* [ruby/prism] Emit error for constant assignments in defsHaldun Bayhantopcu2023-12-063-0/+5
| | | | https://github.com/ruby/prism/commit/864b06f90e
* [ruby/prism] Simplify unterminated stringKevin Newton2023-12-061-2/+2
| | | | https://github.com/ruby/prism/commit/ef512ca914
* [ruby/prism] Move flag position consistently to frontKevin Newton2023-12-061-50/+50
| | | | https://github.com/ruby/prism/commit/6e69a81737
* [ruby/prism] Fix closing loc for string literalsTSUYUSATO Kitsune2023-12-061-3/+3
| | | | | | Fix https://github.com/ruby/prism/pull/1974 https://github.com/ruby/prism/commit/453d403593
* [ruby/prism] Fix one potential memory leak and silence one false positive ↵Haldun Bayhantopcu2023-12-061-0/+3
| | | | | | report. https://github.com/ruby/prism/commit/9608aa386e
* [ruby/prism] Update documentation for encodingsKevin Newton2023-12-062-3/+3
| | | | https://github.com/ruby/prism/commit/18e6df0d4f
* [ruby/prism] Provide flags for changing encodingsKevin Newton2023-12-0613-137/+279
| | | | https://github.com/ruby/prism/commit/e838eaff6f
* [ruby/prism] Add locals_body_index to DefNode, BlockNode, LambdaNodeJemma Issroff2023-12-062-3/+31
| | | | | | | | The locals_body_index gives the index in the locals array where the locals from the body start. This allows compilers to easily index past the parameters in the locals array. https://github.com/ruby/prism/commit/5d4627b890
* Revert "allow enabling Prism via flag or env var"HParker2023-12-061-11/+0
| | | | This reverts commit 9b76c7fc89460ed8e9be40e4037c1d68395c0f6d.
* [ruby/prism] Fix defined with new lineeileencodes2023-12-051-0/+1
| | | | | | | | | | | | | | | It's possible to write the following and have it be valid Ruby: ``` defined?("foo" ) ``` But Prism wasn't taking the new line into account. This adds an `accept1` for a `PM_TOKEN_NEWLINE` to account for this. I've also updated the fixtures and snapshots to test this. https://github.com/ruby/prism/commit/b87f8eedc6
* allow enabling Prism via flag or env varHParker2023-12-051-0/+11
| | | | | | | | | | Enable Prism using either --prism ruby --prism test.rb or via env var RUBY_PRISM=1 ruby test.rb
* [ruby/prism] Remove unnecessary matchHaldun Bayhantopcu2023-12-051-5/+1
| | | | https://github.com/ruby/prism/commit/694d3d7279
* [ruby/prism] Fix a typoTSUYUSATO Kitsune2023-12-051-1/+1
| | | | | | https://github.com/ruby/prism/pull/1949#discussion_r1412568793 https://github.com/ruby/prism/commit/a00f21d10a
* [ruby/prism] Fix argument orderTSUYUSATO Kitsune2023-12-051-112/+112
| | | | | | | | https://github.com/ruby/prism/pull/1949#discussion_r1410733341 https://github.com/ruby/prism/commit/27635da821 Co-Authored-By: Kevin Newton <kddnewton@gmail.com>
* [ruby/prism] Fix some corner casesTSUYUSATO Kitsune2023-12-051-5/+5
| | | | https://github.com/ruby/prism/commit/d5453f168e
* [ruby/prism] Fix to parse command-style method calls more correctlyTSUYUSATO Kitsune2023-12-051-156/+206
| | | | | | | | | | | | | | | | | | | | | | Fix https://github.com/ruby/prism/pull/1468 Fix https://github.com/ruby/prism/pull/1575 To decide command-style method calls are allowed, this introduce a new parameter `accepts_command_call` to `parse_expression` and some functions. Although one think this can be solved by operator precedence, it is hard or impossible, because the precedence of command-style calls is skewed (e.g. `! bar 1 ` is accepted, but `foo = ! bar 1` is rejected.) One of the most complex examples is that: (1) even though `foo = bar = baz 1` and `foo, bar = baz 1` is accepted, (2) `foo, bar = baz = fuzz 1` is rejected. To implement this behavior, this introduces a new binding power `PM_BINDING_POWER_MULTI_ASSIGNMENT` and uses it for distinguish which single assignments or multi assignments at their RHS. https://github.com/ruby/prism/commit/d4dd49ca81
* [ruby/prism] Refactor pm_diagnostic_t and pm_comment_t to use pm_location_tLily Lyons2023-12-046-28/+18
| | | | https://github.com/ruby/prism/commit/115b6a2fc6
* [ruby/prism] Check "void value expression" for array literalsTSUYUSATO Kitsune2023-12-041-3/+3
| | | | | | Fix https://github.com/ruby/prism/pull/1978 https://github.com/ruby/prism/commit/194c997d0a
* [ruby/prism] Prism.parse_success?(source)Kevin Newton2023-12-013-0/+91
| | | | | | | | | | | | A lot of tools use Ripper/RubyVM::AbstractSyntaxTree to determine if a source is valid. These tools both create an AST instead of providing an API that will return a boolean only. This new API only creates the C structs, but doesn't bother reifying them into Ruby/the serialization API. Instead it only returns true/false, which is significantly more efficient. https://github.com/ruby/prism/commit/7014740118
* [ruby/prism] Fix parsing heredoc endsHaldun Bayhantopcu2023-12-011-28/+67
| | | | https://github.com/ruby/prism/commit/aa8c702271
* [ruby/prism] Change numbered parametersKevin Newton2023-12-0112-40/+95
| | | | | | | | | | | | | | | | | | | | Previously numbered parameters were a field on blocks and lambdas that indicated the maximum number of numbered parameters in either the block or lambda, respectively. However they also had a parameters field that would always be nil in these cases. This changes it so that we introduce a NumberedParametersNode that goes in place of parameters, which has a single uint8_t maximum field on it. That field contains the maximum numbered parameter in either the block or lambda. As a part of the PR, I'm introducing a new UInt8Field type that can be used on nodes, which is just to make it a little more explicit what the maximum values can be (the maximum is actually 9, since it only goes up to _9). Plus we can do a couple of nice things in serialization like just read a single byte. https://github.com/ruby/prism/commit/2d87303903
* Remove unused files in prismKevin Newton2023-12-016-3097/+0
|
* [ruby/prism] Add missing context names to the switch in `debug_context`TSUYUSATO Kitsune2023-12-011-0/+3
| | | | | | Now, `PM_DEBUG_LOGGING` can be available. https://github.com/ruby/prism/commit/569ffacb5f
* [ruby/prism] Improve to handle unterminated stringsTSUYUSATO Kitsune2023-12-011-27/+94
| | | | | | | | | | | | | | | Fix https://github.com/ruby/prism/pull/1946 This fixes to set an error position for unterminated strings to the opening delimiters. Previously, the error position was set to the end of the delimiter. The same fix applies to other string-like literals. Additionally, this fixes https://github.com/ruby/prism/pull/1946; that is, it adds the last part of the string even though the string literal does not terminate. https://github.com/ruby/prism/commit/c1240baafd
* [ruby/prism] Fix `not_provided` commentTSUYUSATO Kitsune2023-12-011-2/+1
| | | | | | | I don't know when it is changed, but the `not_provided` signature is changed. https://github.com/ruby/prism/commit/0255cc307d
* [PRISM] Remove transparent scope nodesMatt Valentine-House2023-12-012-46/+4
|
* [ruby/prism] Correctly pass around const pm_encoding_t *Kevin Newton2023-11-305-7/+7
| | | | https://github.com/ruby/prism/commit/ce4c67fb3a
* [ruby/prism] Document remaining encodingsKevin Newton2023-11-302-3/+2
| | | | https://github.com/ruby/prism/commit/b9510aed40
* [ruby/prism] Group encodings into a single arrayKevin Newton2023-11-303-1041/+965
| | | | https://github.com/ruby/prism/commit/f4b7beadc9
* [ruby/prism] Do not expose encodings that do not need to be exposedKevin Newton2023-11-303-375/+311
| | | | https://github.com/ruby/prism/commit/c52c7f37ea
* [ruby/prism] Remove ability to decode other encodingsKevin Newton2023-11-303-54/+1
| | | | https://github.com/ruby/prism/commit/98e218d989
* [ruby/prism] Remove public ASCII functions that can now be staticKevin Newton2023-11-302-36/+3
| | | | https://github.com/ruby/prism/commit/9461384b0c
* [PRISM] Consolidate prism encoding filesKevin Newton2023-11-305-117/+3121
|
* [ruby/prism] CESU encodingKevin Newton2023-11-303-0/+106
| | | | https://github.com/ruby/prism/commit/2d5b9c2b3c
* [ruby/prism] EUC-TW encodingKevin Newton2023-11-303-99/+75
| | | | https://github.com/ruby/prism/commit/edfb54f039
* [ruby/prism] Shorter function definitions in pm_big5.cKevin Newton2023-11-301-9/+9
| | | | https://github.com/ruby/prism/commit/7ddf651bab
* [ruby/prism] GB18030 encodingKevin Newton2023-11-303-0/+47
| | | | https://github.com/ruby/prism/commit/ca3ab7ec89
* [ruby/prism] Emacs MULE encodingsKevin Newton2023-11-303-15/+93
| | | | https://github.com/ruby/prism/commit/4c06b6c42e
* [PRISM] Big5 encodingsKevin Newton2023-11-304-113/+39
|
* [ruby/prism] EUC-KR encodingsKevin Newton2023-11-303-1/+86
| | | | https://github.com/ruby/prism/commit/ba5218385a
* [ruby/prism] Support other EUC-JP encodingsKevin Newton2023-11-303-3/+27
| | | | https://github.com/ruby/prism/commit/d040337ce9
* [PRISM] Alias CP51932 to EUC-JPKevin Newton2023-11-302-57/+10
|
* [PRISM] Consolidate SJIS encodingsKevin Newton2023-11-305-115/+57
|
* [ruby/prism] Add other UTF8 encodingsKevin Newton2023-11-303-3/+39
| | | | https://github.com/ruby/prism/commit/709fb6e09f
* [ruby/prism] Remove no-op assignmentHaldun Bayhantopcu2023-11-301-1/+0
| | | | https://github.com/ruby/prism/commit/4b3079d9e8
* [ruby/prism] Fix typo in commentsid-7072023-11-301-1/+1
| | | | https://github.com/ruby/prism/commit/eb1a6ba263
* [prism] Remove escaping C source filesKevin Newton2023-11-301-4/+0
|
* [ruby/prism] Add MacJapanese encodingMatt Boldt2023-11-293-0/+60
| | | | | | | MacJapanese (also aliased as MacJapan) is a modified Shift_JIS encoding, but is implemented identically in Ruby https://github.com/ruby/prism/commit/9e0a097699