summaryrefslogtreecommitdiff
path: root/prism
AgeCommit message (Collapse)Author
2023-12-05[ruby/prism] Fix a typoTSUYUSATO Kitsune
https://github.com/ruby/prism/pull/1949#discussion_r1412568793 https://github.com/ruby/prism/commit/a00f21d10a
2023-12-05[ruby/prism] Fix argument orderTSUYUSATO Kitsune
https://github.com/ruby/prism/pull/1949#discussion_r1410733341 https://github.com/ruby/prism/commit/27635da821 Co-Authored-By: Kevin Newton <kddnewton@gmail.com>
2023-12-05[ruby/prism] Fix some corner casesTSUYUSATO Kitsune
https://github.com/ruby/prism/commit/d5453f168e
2023-12-05[ruby/prism] Fix to parse command-style method calls more correctlyTSUYUSATO Kitsune
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
2023-12-04[ruby/prism] Refactor pm_diagnostic_t and pm_comment_t to use pm_location_tLily Lyons
https://github.com/ruby/prism/commit/115b6a2fc6
2023-12-04[ruby/prism] Check "void value expression" for array literalsTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1978 https://github.com/ruby/prism/commit/194c997d0a
2023-12-01[ruby/prism] Prism.parse_success?(source)Kevin Newton
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
2023-12-01[ruby/prism] Fix parsing heredoc endsHaldun Bayhantopcu
https://github.com/ruby/prism/commit/aa8c702271
2023-12-01[ruby/prism] Change numbered parametersKevin Newton
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
2023-12-01Remove unused files in prismKevin Newton
2023-12-01[ruby/prism] Add missing context names to the switch in `debug_context`TSUYUSATO Kitsune
Now, `PM_DEBUG_LOGGING` can be available. https://github.com/ruby/prism/commit/569ffacb5f
2023-12-01[ruby/prism] Improve to handle unterminated stringsTSUYUSATO Kitsune
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
2023-12-01[ruby/prism] Fix `not_provided` commentTSUYUSATO Kitsune
I don't know when it is changed, but the `not_provided` signature is changed. https://github.com/ruby/prism/commit/0255cc307d
2023-12-01[PRISM] Remove transparent scope nodesMatt Valentine-House
2023-11-30[ruby/prism] Correctly pass around const pm_encoding_t *Kevin Newton
https://github.com/ruby/prism/commit/ce4c67fb3a
2023-11-30[ruby/prism] Document remaining encodingsKevin Newton
https://github.com/ruby/prism/commit/b9510aed40
2023-11-30[ruby/prism] Group encodings into a single arrayKevin Newton
https://github.com/ruby/prism/commit/f4b7beadc9
2023-11-30[ruby/prism] Do not expose encodings that do not need to be exposedKevin Newton
https://github.com/ruby/prism/commit/c52c7f37ea
2023-11-30[ruby/prism] Remove ability to decode other encodingsKevin Newton
https://github.com/ruby/prism/commit/98e218d989
2023-11-30[ruby/prism] Remove public ASCII functions that can now be staticKevin Newton
https://github.com/ruby/prism/commit/9461384b0c
2023-11-30[PRISM] Consolidate prism encoding filesKevin Newton
2023-11-30[ruby/prism] CESU encodingKevin Newton
https://github.com/ruby/prism/commit/2d5b9c2b3c
2023-11-30[ruby/prism] EUC-TW encodingKevin Newton
https://github.com/ruby/prism/commit/edfb54f039
2023-11-30[ruby/prism] Shorter function definitions in pm_big5.cKevin Newton
https://github.com/ruby/prism/commit/7ddf651bab
2023-11-30[ruby/prism] GB18030 encodingKevin Newton
https://github.com/ruby/prism/commit/ca3ab7ec89
2023-11-30[ruby/prism] Emacs MULE encodingsKevin Newton
https://github.com/ruby/prism/commit/4c06b6c42e
2023-11-30[PRISM] Big5 encodingsKevin Newton
2023-11-30[ruby/prism] EUC-KR encodingsKevin Newton
https://github.com/ruby/prism/commit/ba5218385a
2023-11-30[ruby/prism] Support other EUC-JP encodingsKevin Newton
https://github.com/ruby/prism/commit/d040337ce9
2023-11-30[PRISM] Alias CP51932 to EUC-JPKevin Newton
2023-11-30[PRISM] Consolidate SJIS encodingsKevin Newton
2023-11-30[ruby/prism] Add other UTF8 encodingsKevin Newton
https://github.com/ruby/prism/commit/709fb6e09f
2023-11-30[ruby/prism] Remove no-op assignmentHaldun Bayhantopcu
https://github.com/ruby/prism/commit/4b3079d9e8
2023-11-30[ruby/prism] Fix typo in commentsid-707
https://github.com/ruby/prism/commit/eb1a6ba263
2023-11-30[prism] Remove escaping C source filesKevin Newton
2023-11-29[ruby/prism] Add MacJapanese encodingMatt Boldt
MacJapanese (also aliased as MacJapan) is a modified Shift_JIS encoding, but is implemented identically in Ruby https://github.com/ruby/prism/commit/9e0a097699
2023-11-29[ruby/prism] added CP950 encodingDhaval
https://github.com/ruby/prism/commit/9c2d1cf4ba
2023-11-29[ruby/prism] Fixed comment on pm_parser_numbered_parameters_setJemma Issroff
https://github.com/ruby/prism/commit/ceae5727b8
2023-11-29[ruby/prism] Convert start line to signed integersJean Boussier
Ruby allows for 0 or negative line start, this is often used with `eval` calls to get a correct offset when prefixing a snippet. e.g. ```ruby caller = caller_locations(1, 1).first class_eval <<~RUBY, caller.path, caller.line - 2 # frozen_string_literal: true def some_method #{caller_provided_code_snippet} end RUBY ``` https://github.com/ruby/prism/commit/0d14ed1452
2023-11-29[ruby/prism] Rename varint as varuintJean Boussier
Line numbers may be negative, so we need to introduce signed varint, so renaming unsigned ones first avoid confusion. https://github.com/ruby/prism/commit/90d862361e
2023-11-29[ruby/prism] Reject class/module defs in method params/rescue/ensure/elseTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1936 https://github.com/ruby/prism/commit/232e77a003
2023-11-28[ruby/prism] Implicit rest nodesKevin Newton
Fundamentally, `foo { |bar,| }` is different from `foo { |bar, *| }` because of arity checks. This PR introduces a new node to handle that, `ImplicitRestNode`, which goes in the `rest` slot of parameter nodes instead of `RestParameterNode` instances. This is also used in a couple of other places, namely: * pattern matching: `foo in [bar,]` * multi target: `for foo, in bar do end` * multi write: `foo, = bar` Now the only splat nodes with a `NULL` value are when you're forwarding, as in: `def foo(*) = bar(*)`. https://github.com/ruby/prism/commit/dba2a3b652
2023-11-28[ruby/prism] Add numbered_parameters field to BlockNode and LambdaNodeJemma Issroff
We are aware at parse time how many numbered parameters we have on a BlockNode or LambdaNode, but prior to this commit, did not store that information anywhere in its own right. The numbered parameters were stored as locals, but this does not distinguish them from other locals that have been set, for example in `a { b = 1; _1 }` there is nothing on the AST that distinguishes b from _1. Consumers such as the compiler need to know information about how many numbered parameters exist to set up their own tables around parameters. Since we have this information at parse time, we should compute it here, instead of deferring the work later on. https://github.com/ruby/prism/commit/bf4a1e124d
2023-11-28Add in missing errorKevin Newton
2023-11-28[ruby/prism] Reset `current_param_name` around closed scopesTSUYUSATO Kitsune
It is for supporting `def foo(bar = (def baz(bar) = bar; 1)) = 2` case. https://github.com/ruby/prism/commit/c789a833c5
2023-11-28[ruby/prism] Use `0` for the default valie of `current_param_name`TSUYUSATO Kitsune
https://github.com/ruby/prism/commit/896915de24
2023-11-28[ruby/prism] Check circular references in default values of paramsTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1637 https://github.com/ruby/prism/commit/0172d69cba
2023-11-28[ruby/prism] Fix to parse `*` as forwarding in `foo[*]` caseTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1924 https://github.com/ruby/prism/commit/7cde900065
2023-11-28[ruby/prism] Move DATA parsing into its own parse result fieldKevin Newton
https://github.com/ruby/prism/commit/42b60b6e95
2023-11-28[ruby/prism] Use un-capitalized error messagesKevin Newton
I don't prefer this style, but it appears that a plurality of syntax error messages between with un-capitalized messages in CRuby, so we'll go with that for consistency, for now. https://github.com/ruby/prism/commit/b02df68954