>From 3d8c711acc63bb2e61dfeccb73223ff3bf29b67e Mon Sep 17 00:00:00 2001 From: Kapuze Martin Date: Wed, 18 Nov 2020 18:11:36 +0100 Subject: [PATCH 2/3] add python grammar for type hints for function return value --- admin/grammars/python.wy | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/admin/grammars/python.wy b/admin/grammars/python.wy index b7254e2533..cc5093b0b7 100644 --- a/admin/grammars/python.wy +++ b/admin/grammars/python.wy @@ -184,6 +184,7 @@ %token ASSIGN "=" %token BACKQUOTE "`" %token AT "@" +%token FOLLOWS "->" ;; ----------------- @@ -808,12 +809,17 @@ decorators ;; funcdef: [decorators] 'def' NAME parameters ':' suite funcdef - : DEF NAME function_parameter_list COLON suite + : DEF NAME function_parameter_list return_type_hint COLON suite (wisent-python-reconstitute-function-tag - (FUNCTION-TAG $2 nil $3) $5) - | decorators DEF NAME function_parameter_list COLON suite + (FUNCTION-TAG $2 nil $3) $6) + | decorators DEF NAME function_parameter_list return_type_hint COLON suite (wisent-python-reconstitute-function-tag - (FUNCTION-TAG $3 nil $4 :decorators $1) $6) + (FUNCTION-TAG $3 nil $4 :decorators $1) $7) + ; + +return_type_hint + : ;;EMPTY + | FOLLOWS type ; function_parameter_list -- 2.25.1