Thomas Marshall 14fbcf0e6e [ruby/prism] Report missing end errors at opening token
This commit adds an `expect1_opening` function that expects a token and
attaches the error to the opening token location rather than the current
position. This is useful for errors about missing closing tokens, where
we want to point to the line with the opening token rather than the end
of the file.

For example:

```ruby
def foo
def bar
def baz
       ^ expected an `end` to close the `def` statement
       ^ expected an `end` to close the `def` statement
       ^ expected an `end` to close the `def` statement
```

This would previously produce three identical errors at the end of the
file. After this commit, they would be reported at the opening token
location:

```ruby
def foo
^~~ expected an `end` to close the `def` statement
def bar
^~~ expected an `end` to close the `def` statement
def baz
^~~ expected an `end` to close the `def` statement
```

I considered using the end of the line where the opening token is
located, but in some cases that would be less useful than the opening
token location itself. For example:

```ruby
def foo def bar def baz
```

Here the end of the line where the opening token is located would be the
same for each of the unclosed `def` nodes.

https://github.com/ruby/prism/commit/2d7829f060
2025-12-29 14:12:20 +00:00
2025-12-02 08:56:21 +09:00
2025-12-29 09:03:31 -05:00
2025-12-29 09:03:31 -05:00
2025-12-26 15:11:23 +09:00
2025-12-18 16:12:47 +00:00
2025-09-13 16:32:30 +09:00
2025-12-19 17:09:10 -05:00
2025-12-10 12:09:50 +09:00
2025-12-09 22:48:06 -08:00
2025-12-28 08:55:38 -05:00
2025-12-25 09:18:17 -05:00
2025-12-10 10:23:37 +09:00
2025-12-12 14:03:37 -08:00
2025-12-21 14:05:55 -05:00
2025-12-29 09:03:31 -05:00
2025-12-09 16:45:38 +09:00
2025-11-10 19:12:35 +09:00
GPL
2025-12-29 09:03:31 -05:00
2025-12-29 09:03:31 -05:00
2025-12-24 11:14:29 +09:00
2025-10-30 21:47:12 +09:00
2025-12-10 12:09:50 +09:00
2025-09-06 07:17:52 +09:00
2025-08-30 22:41:23 +09:00
2025-12-19 21:36:46 -05:00
2025-12-15 17:28:35 -05:00
2025-12-21 14:05:38 -05:00
2025-12-29 17:21:33 +09:00
2025-12-29 09:03:31 -05:00
2025-12-18 15:59:49 -08:00
2025-12-22 09:12:33 -05:00
2025-10-31 20:49:59 +09:00
2025-10-31 20:49:59 +09:00
2025-10-31 20:49:59 +09:00
2025-12-19 21:38:12 -05:00
2025-12-29 09:03:31 -05:00
2025-12-05 15:40:39 -08:00
2025-10-23 13:08:26 +09:00
2025-09-30 09:47:29 -04:00
2025-12-10 10:23:37 +09:00
2025-12-18 13:43:45 -08:00
2025-12-28 08:55:38 -05:00

Actions Status: MinGW Actions Status: Ubuntu Actions Status: Windows Travis Status

日本語

What is Ruby?

Ruby is an interpreted object-oriented programming language often used for web development. It also offers many scripting features to process plain text and serialized files, or manage system tasks. It is simple, straightforward, and extensible.

Features of Ruby

  • Simple Syntax
  • Normal Object-oriented Features (e.g. class, method calls)
  • Advanced Object-oriented Features (e.g. mix-in, singleton-method)
  • Operator Overloading
  • Exception Handling
  • Iterators and Closures
  • Garbage Collection
  • Dynamic Loading of Object Files (on some architectures)
  • Highly Portable (works on many Unix-like/POSIX compatible platforms as well as Windows, macOS, etc.) cf. https://docs.ruby-lang.org/en/master/maintainers_md.html#label-Platform+Maintainers

How to get Ruby

For a complete list of ways to install Ruby, including using third-party tools like rvm, see:

https://www.ruby-lang.org/en/downloads/

You can download release packages and the snapshot of the repository. If you want to download whole versions of Ruby, please visit https://www.ruby-lang.org/en/downloads/releases/.

Download with Git

The mirror of the Ruby source tree can be checked out with the following command:

$ git clone https://github.com/ruby/ruby.git

There are some other branches under development. Try the following command to see the list of branches:

$ git ls-remote https://github.com/ruby/ruby.git

You may also want to use https://git.ruby-lang.org/ruby.git (actual master of Ruby source) if you are a committer.

How to build

See Building Ruby

Ruby home page

https://www.ruby-lang.org/

Documentation

Mailing list

There is a mailing list to discuss Ruby. To subscribe to this list, please send the following phrase:

join

in the mail subject (not body) to the address ruby-talk-request@ml.ruby-lang.org.

Copying

See the file COPYING.

Feedback

Questions about the Ruby language can be asked on the Ruby-Talk mailing list or on websites like https://stackoverflow.com.

Bugs should be reported at https://bugs.ruby-lang.org. Read "Reporting Issues" for more information.

Contributing

See "Contributing to Ruby", which includes setup and build instructions.

The Author

Ruby was originally designed and developed by Yukihiro Matsumoto (Matz) in 1995.

matz@ruby-lang.org

Description
Languages
Ruby 58.9%
C 29.5%
Rust 6.1%
C++ 2.9%
Yacc 0.9%
Other 1.6%