parser 2.6.5.0 → 2.7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c12b17e36f142aa8aacc1aae95cd464ea9239cf526d973b7b1ed3f0825fc7698
4
- data.tar.gz: 49948dbdc512a19d0b02d5edea2e12ff4eed8c89a2827728e5f0f9a618109b44
3
+ metadata.gz: 9c513c025d3466aaa344468699cb2b737a4d85ba3275b8702fe8cd7194e0fe74
4
+ data.tar.gz: 26b706425f418a7dbdb4063f7cd082e22633deb035c4444ca01dfe28c1a5c3d6
5
5
  SHA512:
6
- metadata.gz: 67bbf82221c9795d5a892f51ccb3c51835657448842a078bbcee88b8b1ef649643600d01d2c1c0b2e59982a774803a3a780538c433e8cc3a4fdfe8168838a697
7
- data.tar.gz: 9d7053f65800e04f8f2c0b1f344d9f83efd1282744aba49c02b384ea4242a3bcc5b65b7ac3eca4c4d0c34317ed70393a1eb26e146b34517ad75810b9498eb0a7
6
+ metadata.gz: a9743ae26ad02e463e5592cd53f0f6e2ab95ced23f687468fbd58df249971be181b7b69edafc69ca65e7a98048205940c0108aff96ceb7984c9220439e9e6d7f
7
+ data.tar.gz: 17afaecd6b1d3af320d62b570ccce3ebfb109ed845fc78059fd69a8561fe90630d01470f401370913a7ffc5e298f862580f7c302617432059d1afb8dd6ea13bc
@@ -1,6 +1,40 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ Not released (2019-12-26)
5
+ -------------------------
6
+
7
+ API modifications:
8
+ * README.md: documented compatibility issue with EOF chars after… (#637) (Ilya Bylich)
9
+ * ruby27.y: refactor logic around 'circular argument reference'(#628) (Ilya Bylich)
10
+
11
+ Features implemented:
12
+ * ruby27.y: added pattern matching (#574) (Ilya Bylich)
13
+ * lexer.rl: parse embedded ivars/cvars starting with digit as str (#639) (Ilya Bylich)
14
+ * lexer.rl: warn on `...` at EOL. (#636) (Ilya Bylich)
15
+ * ruby27.y: removed opt_block_args_tail: tOROP rule. (#635) (Ilya Bylich)
16
+ * ruby27.y: reverted method reference operator (added in #634) (Ilya Bylich)
17
+ * ruby27.y: treat numparams as locals outside numblock. (#633) (Ilya Bylich)
18
+
19
+ Bugs fixed:
20
+ * dedenter.rb: fixed over-dedenting of squiggly heredocs (#641) (Ilya Bylich)
21
+ * ruby27.y: added "arguments forwarding" (#625) (Ilya Bylich)
22
+ * ruby27.y: reject circular argument reference. (#622) (Ilya Bylich)
23
+ * ruby27.y: changed prefix of numparams to "_" (#620) (Ilya Bylich)
24
+
25
+ v2.6.5.0 (2019-10-03)
26
+ ---------------------
27
+
28
+ API modifications:
29
+ * Bump ruby versions to 2.4.9, 2.5.7 and 2.6.5. (#619) (Ilya Bylich)
30
+
31
+ Features implemented:
32
+ * lexer.rl: changed max numparam to `@9` (#617) (Ilya Bylich)
33
+ * lexer.rl: support comments before leading dot in 27 mode. (#613) (Ilya Bylich)
34
+
35
+ Bugs fixed:
36
+ * lexer.rl: emit tMETHREF as tDOT+tCOLON for rubies \< 27. (#614) (Ilya Bylich)
37
+
4
38
  v2.6.4.1 (2019-09-12)
5
39
  ---------------------
6
40
 
data/README.md CHANGED
@@ -269,6 +269,13 @@ follows 2.1 behavior.
269
269
 
270
270
  No known code is affected by this issue.
271
271
 
272
+ ### EOF characters after embedded documents before 2.7
273
+
274
+ Code like `"=begin\n""=end\0"` is invalid for all versions of Ruby before 2.7. Ruby 2.7 and later parses it
275
+ normally. Parser follows 2.7 behavior.
276
+
277
+ It is unknown whether any gems are affected by this issue.
278
+
272
279
  ## Contributors
273
280
 
274
281
  * [whitequark][]
@@ -602,18 +602,6 @@ Format:
602
602
  ~~~~~~~~~~~~~ expression
603
603
  ~~~
604
604
 
605
- ### Method reference operator
606
-
607
- Format:
608
-
609
- ~~~
610
- (meth-ref (self) :foo)
611
- "self.:foo"
612
- ^^ dot
613
- ^^^ selector
614
- ^^^^^^^^^ expression
615
- ~~~
616
-
617
605
  ### Multiple assignment
618
606
 
619
607
  #### Multiple left hand side
@@ -1118,22 +1106,41 @@ Format:
1118
1106
  s(:numblock,
1119
1107
  s(:send, nil, :proc), 3,
1120
1108
  s(:send,
1121
- s(:numparam, 1), :+,
1122
- s(:numparam, 3)))
1123
- "proc { @1 + @3 }"
1109
+ s(:lvar, :_1), :+,
1110
+ s(:lvar, :_3)))
1111
+ "proc { _1 + _3 }"
1124
1112
  ~ begin ~ end
1125
1113
  ~~~~~~~~~~~~~~~~ expression
1126
1114
  ~~~
1127
1115
 
1128
- ### Numbered parameter
1116
+ ## Forward arguments
1117
+
1118
+ ### Method definition accepting forwarding arguments
1119
+
1120
+ Ruby 2.7 introduced a feature called "arguments forwarding".
1121
+ When a method takes any arguments for forwarding them in the future
1122
+ the whole `args` node gets replaced with `forward-args` node.
1129
1123
 
1130
1124
  Format:
1131
1125
 
1132
1126
  ~~~
1133
- (numparam 10)
1134
- "@10"
1135
- ~~~ name
1136
- ~~~ expression
1127
+ (def :foo
1128
+ (forward-args) nil)
1129
+ "def foo(...); end"
1130
+ ~ end
1131
+ ~ begin
1132
+ ~~~~~ expression
1133
+ ~~~
1134
+
1135
+ ### Method call taking arguments of the currently forwarding method
1136
+
1137
+ Format:
1138
+
1139
+ ~~~
1140
+ (send nil :foo
1141
+ (forwarded-args))
1142
+ "foo(...)"
1143
+ ~~~ expression
1137
1144
  ~~~
1138
1145
 
1139
1146
  ## Send
@@ -1814,3 +1821,322 @@ Format:
1814
1821
  "__ENCODING__"
1815
1822
  ~~~~~~~~~~~~ expression
1816
1823
  ~~~
1824
+
1825
+ ## Pattern matching
1826
+
1827
+ ### Using `in` modifier
1828
+
1829
+ Format:
1830
+
1831
+ ~~~
1832
+ (in-match
1833
+ (int 1)
1834
+ (match-var :a))
1835
+ "1 in a"
1836
+ ~~ operator
1837
+ ~~~~~~ expression
1838
+ ~~~
1839
+
1840
+ ### Case with pattern matching
1841
+
1842
+ #### Without else
1843
+
1844
+ Format:
1845
+
1846
+ ~~~
1847
+ (case-match
1848
+ (str "str")
1849
+ (in-pattern
1850
+ (match-var :foo)
1851
+ (lvar :bar)) nil)
1852
+ "case "str"; in foo; bar; end"
1853
+ ~~~~ keyword ~~~ end
1854
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ expression
1855
+ ~~~
1856
+
1857
+ #### With else
1858
+
1859
+ Format:
1860
+
1861
+ ~~~
1862
+ (case-match,
1863
+ (str "str")
1864
+ (in-pattern
1865
+ (match-var :foo)
1866
+ (lvar :bar))
1867
+ (lvar :baz))
1868
+ "case "str"; in foo; bar; else; baz; end"
1869
+ ~~~~ keyword ~~~~ else ~~~ end
1870
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ expression
1871
+ ~~~
1872
+
1873
+ ### In clause
1874
+
1875
+ Format:
1876
+
1877
+ ~~~
1878
+ (in-pattern
1879
+ (match-var :foo)
1880
+ (lvar :bar))
1881
+ "in foo then bar"
1882
+ ~~ keyword
1883
+ ~~~~ begin
1884
+ ~~~~~~~~~~~~~~~ expression
1885
+ ~~~
1886
+
1887
+ ### If guard
1888
+
1889
+ This guard runs after matching, so it's not an `if` modifier.
1890
+
1891
+ Format:
1892
+
1893
+ ~~~
1894
+ (in-pattern
1895
+ (match-var :foo)
1896
+ (if-guard
1897
+ (lvar :bar)) nil)
1898
+ "in foo if bar"
1899
+ ~~ keyword
1900
+ ~~~~~~ expression
1901
+ ~~~
1902
+
1903
+ ### Unless guard
1904
+
1905
+ This guard runs after matching, so it's not an `unless` modifier.
1906
+
1907
+ Format:
1908
+
1909
+ ~~~
1910
+ (in-pattern
1911
+ (match-var :foo)
1912
+ (unless-guard
1913
+ (lvar :bar)) nil)
1914
+ "in foo unless bar"
1915
+ ~~~~~~ keyword
1916
+ ~~~~~~~~~~ expression
1917
+ ~~~
1918
+
1919
+ ### Match variable
1920
+
1921
+ Format:
1922
+
1923
+ ~~~
1924
+ (match-var :foo)
1925
+ "in foo"
1926
+ ~~~ name
1927
+ ~~~ expression
1928
+ ~~~
1929
+
1930
+ ### Match rest
1931
+
1932
+ #### With name
1933
+
1934
+ Format:
1935
+
1936
+ ~~~
1937
+ (match-rest
1938
+ (match-var :foo))
1939
+ "in *foo"
1940
+ ~ operator
1941
+ ~~~~ expression
1942
+ ~~~
1943
+
1944
+ #### Without name
1945
+
1946
+ Format:
1947
+
1948
+ ~~~
1949
+ (match-rest)
1950
+ "in *"
1951
+ ~ operator
1952
+ ~ expression
1953
+ ~~~
1954
+
1955
+ ### Pin operator
1956
+
1957
+ Format:
1958
+
1959
+ ~~~
1960
+ (pin
1961
+ (lvar :foo))
1962
+ "in ^foo"
1963
+ ~ selector
1964
+ ~~~~ expression
1965
+ ~~~
1966
+
1967
+ ### Match alternative
1968
+
1969
+ Format:
1970
+
1971
+ ~~~
1972
+ (match-alt
1973
+ (pin
1974
+ (lvar :foo))
1975
+ (int 1))
1976
+ "in ^foo | 1"
1977
+ ~ operator
1978
+ ~~~~~~~~ expression
1979
+ ~~~
1980
+
1981
+ ### Match with alias
1982
+
1983
+ Format:
1984
+
1985
+ ~~~
1986
+ (match-as
1987
+ (int 1)
1988
+ (match-var :foo))
1989
+ "in 1 => foo"
1990
+ ~~ operator
1991
+ ~~~~~~~~ expression
1992
+ ~~~
1993
+
1994
+ ### Match using array pattern
1995
+
1996
+ #### Explicit
1997
+
1998
+ Format:
1999
+
2000
+ ~~~
2001
+ (array-pattern
2002
+ (pin
2003
+ (lvar :foo))
2004
+ (match-var :bar))
2005
+ "in [^foo, bar]"
2006
+ ~ begin ~ end
2007
+ ~~~~~~~~~~~ expression
2008
+ ~~~
2009
+
2010
+ #### Explicit with tail
2011
+
2012
+ Adding a trailing comma in the end works as `, *`
2013
+
2014
+ Format:
2015
+
2016
+ ~~~
2017
+ (array-pattern-with-tail
2018
+ (pin
2019
+ (lvar :foo))
2020
+ (match-var :bar))
2021
+ "in [^foo, bar,]"
2022
+ ~ begin ~ end
2023
+ ~~~~~~~~~~~~ expression
2024
+ ~~~
2025
+
2026
+ #### Implicit
2027
+
2028
+ Format:
2029
+
2030
+ ~~~
2031
+ (array-pattern
2032
+ (pin
2033
+ (lvar :foo))
2034
+ (match-var :bar))
2035
+ "in ^foo, bar"
2036
+ ~~~~~~~~~ expression
2037
+ ~~~
2038
+
2039
+ #### Implicit with tail
2040
+
2041
+ Format:
2042
+
2043
+ Adding a trailing comma in the end works as `, *`,
2044
+ so a single item match with comma gets interpreted as an array.
2045
+
2046
+ ~~~
2047
+ (array-pattern-with-tail
2048
+ (match-var :foo))
2049
+ "in foo,"
2050
+ ~~~ expression
2051
+ ~~~
2052
+
2053
+ ### Matching using hash pattern
2054
+
2055
+ #### Explicit
2056
+
2057
+ Format:
2058
+
2059
+ ~~~
2060
+ (hash-pattern
2061
+ (pair
2062
+ (sym :a)
2063
+ (int 10)))
2064
+ "in { a: 10 }"
2065
+ ~ begin ~ end
2066
+ ~~~~~~~~~ expression
2067
+ ~~~
2068
+
2069
+ #### Implicit
2070
+
2071
+ Format:
2072
+
2073
+ ~~~
2074
+ (hash-pattern
2075
+ (pair
2076
+ (sym :a)
2077
+ (int 10)))
2078
+ "in a: 10"
2079
+ ~~~~~ expression
2080
+ ~~~
2081
+
2082
+ #### Assignment using hash pattern
2083
+
2084
+ Format:
2085
+
2086
+ ~~~
2087
+ (hash-pattern
2088
+ (match-var :a))
2089
+ "in a:"
2090
+ ~ name (match-var)
2091
+ ~~ expression (match-var)
2092
+ ~~~
2093
+
2094
+ #### Nil hash pattern
2095
+
2096
+ Format:
2097
+ ~~~
2098
+ (hash-pattern
2099
+ (match-nil-pattern))
2100
+ "in **nil"
2101
+ ~~~~~ expression (match-nil-pattern)
2102
+ ~~~ name (match-nil-pattern)
2103
+ ~~~
2104
+
2105
+ ### Matching using const pattern
2106
+
2107
+ #### With array pattern
2108
+
2109
+ Format:
2110
+
2111
+ ~~~
2112
+ (const-pattern
2113
+ (const nil :X)
2114
+ (array-pattern
2115
+ (pin
2116
+ (lvar :foo))
2117
+ (match-var :bar)))
2118
+ "in X[^foo bar]"
2119
+ ~ begin (const-pattern)
2120
+ ~ end (const-pattern)
2121
+ ~~~~~~~~~~~ expression (const-pattern)
2122
+ ~ name (const-pattern.const)
2123
+ ~ expression (const-pattern.const)
2124
+ ~~~
2125
+
2126
+ #### With hash pattern
2127
+
2128
+ Format:
2129
+
2130
+ ~~~
2131
+ (const-pattern
2132
+ (const nil :X)
2133
+ (hash-pattern
2134
+ (match-var :foo)
2135
+ (match-var :bar)))
2136
+ "in X[foo:, bar:]"
2137
+ ~ begin (const-pattern)
2138
+ ~ end (const-pattern)
2139
+ ~~~~~~~~~~~~ expression (const-pattern)
2140
+ ~ name (const-pattern.const)
2141
+ ~ expression (const-pattern.const)
2142
+ ~~~