atom/language-ruby — pull request #32 by ryansobol (2014-04-28 01:24:08+00:00)
Title: Fix literal grammar

This pull request fixes inaccuracies and inconsistencies with the literal grammar.

The goal is to produce grammar that syntax theme authors, like myself, can use to better visually represent the resulting objects of Ruby literals. And I believe better visual representations will help developers write code with fewer bugs and attain a deeper understanding of the Ruby language. After seeing the before and after screenshots, my hope is that you agree. :)

The changes in this pull request are long so please don't hesitate to ask questions or make suggestions. This pull request also replaces my earlier pull request -- #29 -- and is based on some feedback I received from @nathansobo.

#### %w and %W literal grammar

Before, the grammar parsed these literals as a `String` of `String` tokens.

![1_1](https://cloud.githubusercontent.com/assets/5688/2812802/bac4b7d2-ce6f-11e3-928c-2534e06f93e6.png)

Now, the grammar parses these literals as an `Array` of `String` tokens.

![1_2](https://cloud.githubusercontent.com/assets/5688/2812804/c5a20786-ce6f-11e3-8bd7-36c759a7f4f2.png)

#### %i and %I literal grammar

Before, the grammar parsed these literals as a `String` of `String` tokens.

![2_1](https://cloud.githubusercontent.com/assets/5688/2812806/d92c73b8-ce6f-11e3-8dba-c4677eacc4fa.png)

Now, the grammar parses these literals as an `Array` of `Symbol` tokens.

![2_2](https://cloud.githubusercontent.com/assets/5688/2812808/de305654-ce6f-11e3-9b3a-64ccc0464adb.png)

#### %q, %Q, '', and "" literal grammar

Before, the grammar parsed these literals as `String` tokens.

![3_1](https://cloud.githubusercontent.com/assets/5688/2812810/e6da9d0a-ce6f-11e3-8cf7-b2347d88a2de.png)

And they still do, although now the grammar rules are consistent with the others.

#### %s, %S, :'', and :"" literal grammar

Before, the grammar parsed these literals as either `String` or `Symbol` tokens.

![4_1](https://cloud.githubusercontent.com/assets/5688/2812812/f3056ace-ce6f-11e3-9f40-e3d56427ac9c.png)

Now, the grammar parses these literals as an `Symbol` tokens.

![4_2](https://cloud.githubusercontent.com/assets/5688/2812813/f736ab26-ce6f-11e3-8129-8f2dadceadda.png)

Note that `%S` doesn't exist in the Ruby language so that grammar has been removed.

#### %r, %R, and // literal grammar

Before, the grammar parsed these literals as either a `String` or a `String` of `RegExp` tokens.

![5_1](https://cloud.githubusercontent.com/assets/5688/2812814/fbbd050a-ce6f-11e3-96db-c4788fca7227.png)

Now, the grammar parses these literals as `RegExp` tokens.

![5_2](https://cloud.githubusercontent.com/assets/5688/2812815/ff972e58-ce6f-11e3-93c0-18d03a8b2cf5.png)

Note that `%R` doesn't exist in the Ruby language so that grammar has been removed.