From 147fec98b54e0eb47593a9e5bebb8e2f56f6c15f Mon Sep 17 00:00:00 2001 From: xonix Date: Sun, 28 Apr 2024 03:09:28 +0300 Subject: [PATCH] Improve auto-complete for this case #186 : adjust grammar --- src/main/java/intellij_awk/Awk.bnf | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/intellij_awk/Awk.bnf b/src/main/java/intellij_awk/Awk.bnf index ac2c3d7..a5906a5 100644 --- a/src/main/java/intellij_awk/Awk.bnf +++ b/src/main/java/intellij_awk/Awk.bnf @@ -502,7 +502,7 @@ lvalue ::= gawk_var_name | DOLLAR expr // XXX this covers a[1][2][3] like in Gawk // XXX awk only supports a[1] -private gawk_var_name ::= var_name (LBRACKET expr_lst RBRACKET)* +//private gawk_var_name ::= var_name (LBRACKET expr_lst RBRACKET)* // XXX for some reason the below makes it terribly slow or hanging on profile5.awk /*private gawk_var_name ::= var_name (subscript_start RBRACKET)* @@ -512,6 +512,15 @@ private subscript_start ::= LBRACKET expr_lst { } private recover_on_rbracket ::= !RBRACKET*/ +private gawk_var_name ::= var_name (subscript_start RBRACKET)* +private subscript_start ::= LBRACKET expr_lst_inner { + pin=1 +} +private expr_lst_inner ::= expr_lst { +// recoverWhile=recover_on_rbracket +} +//private recover_on_rbracket ::= !RBRACKET + private var_name ::= builtin_var_name | user_var_name builtin_var_name ::= SPECIAL_VAR_NAME | SPECIAL_VAR_NAME_GAWK