mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] parser: update error reporting in closure parameter list
- don't report expected ','; - update test data to match new GeneratedParserUtilBase behaviour.
This commit is contained in:
+13
-2
@@ -2279,9 +2279,9 @@ public class GroovyBnfParser implements PsiParser, LightPsiParser {
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// <<a_b_a <<item>> ','>>
|
||||
// <<a_b_a <<item>> fast_comma>>
|
||||
static boolean comma_list(PsiBuilder b, int l, Parser _item) {
|
||||
return a_b_a(b, l + 1, _item, T_COMMA_parser_);
|
||||
return a_b_a(b, l + 1, _item, fast_comma_parser_);
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
@@ -3176,6 +3176,12 @@ public class GroovyBnfParser implements PsiParser, LightPsiParser {
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// ','
|
||||
static boolean fast_comma(PsiBuilder b, int l) {
|
||||
return consumeTokenFast(b, T_COMMA);
|
||||
}
|
||||
|
||||
/* ********************************************************** */
|
||||
// DOLLAR_SLASHY_CONTENT
|
||||
static boolean fast_dollar_slashy_content(PsiBuilder b, int l) {
|
||||
@@ -7241,6 +7247,11 @@ public class GroovyBnfParser implements PsiParser, LightPsiParser {
|
||||
return extends_recovery(b, l + 1);
|
||||
}
|
||||
};
|
||||
final static Parser fast_comma_parser_ = new Parser() {
|
||||
public boolean parse(PsiBuilder b, int l) {
|
||||
return fast_comma(b, l + 1);
|
||||
}
|
||||
};
|
||||
final static Parser fast_dollar_slashy_content_parser_ = new Parser() {
|
||||
public boolean parse(PsiBuilder b, int l) {
|
||||
return fast_dollar_slashy_content(b, l + 1);
|
||||
|
||||
@@ -1253,7 +1253,8 @@ private empty_pars ::= '(' ')' { consumeTokenMethod = 'consumeTokenFast' }
|
||||
// region Lists
|
||||
private meta comma_list_p ::= <<a_b_a_p <<item>> ','>>
|
||||
private meta a_b_a_p ::= <<a>> (<<b>> <<a>>)* { pin('.*') = 1 }
|
||||
private meta comma_list ::= <<a_b_a <<item>> ','>>
|
||||
private meta comma_list ::= <<a_b_a <<item>> fast_comma>>
|
||||
private fast_comma ::= ','
|
||||
private meta a_b_a ::= <<a>> (<<b>> <<a>>)* { pin = 1 }
|
||||
|
||||
private meta paren_list ::= '('')' | '(' <<paren_list_inner <<item>>>> ')' { pin('paren_list_1') = 1 }
|
||||
|
||||
@@ -16,7 +16,7 @@ Groovy script
|
||||
Variable
|
||||
PsiElement(identifier)('key')
|
||||
PsiElement(,)(',')
|
||||
PsiErrorElement:',', '->' or identifier expected, got '}'
|
||||
PsiErrorElement:'->' or identifier expected, got '}'
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(})('}')
|
||||
@@ -10,9 +10,8 @@ Groovy script
|
||||
<empty list>
|
||||
Reference expression
|
||||
PsiElement(identifier)('a')
|
||||
PsiElement(,)(',')
|
||||
PsiErrorElement:identifier expected, got 'b'
|
||||
<empty list>
|
||||
PsiErrorElement:<expression> expected, got ','
|
||||
PsiElement(,)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
Reference expression
|
||||
PsiElement(identifier)('b')
|
||||
|
||||
@@ -17,7 +17,7 @@ Groovy script
|
||||
PsiElement({)('{')
|
||||
Parameter list
|
||||
<empty list>
|
||||
PsiErrorElement:',', '->', ';', <statement>, identifier or new line expected, got 'do'
|
||||
PsiErrorElement:'->', ';', <statement>, identifier or new line expected, got 'do'
|
||||
PsiElement(do)('do')
|
||||
PsiWhiteSpace(' ')
|
||||
Compound Gstring
|
||||
|
||||
+2
-2
@@ -39,7 +39,7 @@ Groovy script
|
||||
PsiWhiteSpace('\n ')
|
||||
Parameter list
|
||||
<empty list>
|
||||
PsiErrorElement:',', '->', ';', <statement>, identifier or new line expected, got 'case'
|
||||
PsiErrorElement:'->', ';', <statement>, identifier or new line expected, got 'case'
|
||||
PsiElement(case)('case')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
@@ -109,7 +109,7 @@ Groovy script
|
||||
PsiWhiteSpace('\n ')
|
||||
Parameter list
|
||||
<empty list>
|
||||
PsiErrorElement:',', '->', ';', <statement>, identifier or new line expected, got 'case'
|
||||
PsiErrorElement:'->', ';', <statement>, identifier or new line expected, got 'case'
|
||||
PsiElement(case)('case')
|
||||
PsiWhiteSpace(' ')
|
||||
Literal
|
||||
|
||||
Reference in New Issue
Block a user