mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
An ellipsis (...) can only be placed at the beginning
This commit is contained in:
parent
9f3adaf529
commit
bf951c763d
1 changed files with 6 additions and 2 deletions
|
@ -25,10 +25,10 @@ grammar = %r'
|
|||
(?<ws> \g<comment> | \s ){0}
|
||||
(?<ident> [_a-zA-Z] [0-9_a-zA-Z]* ){0}
|
||||
(?<type> (?: \g<keyword> \g<ws>+ )* \g<ident> ){0}
|
||||
(?<arg> \g<type> \g<ws>+ \g<ident> | \.\.\. ){0}
|
||||
(?<arg> \g<type> \g<ws>+ \g<ident> ){0}
|
||||
(?<argv> (?# empty ) |
|
||||
void |
|
||||
\g<arg> (?: \g<ws>* , \g<ws>* \g<arg> \g<ws>* )* ){0}
|
||||
(?: \.\.\. | \g<arg>) (?: \g<ws>* , \g<ws>* \g<arg> \g<ws>* )* ){0}
|
||||
(?<pragma> \g<ws>* // \s* attr \g<ws>+
|
||||
(?<pragma:type> \g<type> ) \g<ws>+
|
||||
(?<pragma:name> \g<ident> ) \g<ws>*
|
||||
|
@ -57,6 +57,10 @@ until scanner.eos? do
|
|||
ope = split.(scanner["insn:opes"])
|
||||
pop = split.(scanner["insn:pops"])
|
||||
ret = split.(scanner["insn:rets"])
|
||||
if ope.include?("...")
|
||||
raise sprintf("parse error at %s:%d:%s: operands cannot be variadic",
|
||||
scanner.__FILE__, scanner.__LINE__, name)
|
||||
end
|
||||
|
||||
attrs = []
|
||||
while l2 = scanner.scan(/\G#{grammar}\g<pragma>/o) do
|
||||
|
|
Loading…
Add table
Reference in a new issue