@@ -65,41 +65,14 @@ def current_word(cursor_offset: int, line: str) -> Optional[LinePart]:
65
65
# end matching at closing double-quote if one is present
66
66
"?"""
67
67
68
- _match_int_and_float = \
69
- r"""\-? # match a negative sign if present
70
- \d+ # match any number of digits
71
- (?:\.\d*)? # if there is a decimal point, match it and subsequent digits
72
- |\- # if only a negative sign has been entered, match it
73
- """
74
-
75
- # used to match possible elements in a tuple
76
- _match_tuple_element = (
77
- f'(?:{ _match_single_quote_str_bytes } |' # match single quote str/bytes repr
78
- f'{ _match_double_quote_str_bytes } |' # or double quote str/bytes repr
79
- f'{ _match_int_and_float } )' # or int or float repr
80
- )
81
-
82
- _match_tuple = \
83
- rf""" # match open parenthesis
84
- \(
85
- # matches any number of tuple elements followed by `,` then ` `
86
- (?:{ _match_tuple_element } ,[ ])*
87
- # followed by another element being typed or one element tuple i.e. `(1,)`
88
- (?:{ _match_tuple_element } ,?)?
89
- # match close parentesis if present
90
- \)?
91
- """
92
-
93
68
# match valid identifier name followed by `[` character
94
69
_match_dict_before_key = r"""[\w_][\w0-9._]*\["""
95
70
96
71
_current_dict_key_re = LazyReCompile (
97
- f'{ _match_dict_before_key } ('
72
+ f'{ _match_dict_before_key } ((?: '
98
73
f'{ _match_single_quote_str_bytes } |'
99
74
f'{ _match_double_quote_str_bytes } |'
100
- f'{ _match_int_and_float } |'
101
- f'{ _match_tuple } |'
102
- f'{ _match_all_dict_keys } |)' ,
75
+ f'{ _match_all_dict_keys } |)*)' ,
103
76
re .VERBOSE
104
77
)
105
78
@@ -116,12 +89,12 @@ def current_dict_key(cursor_offset: int, line: str) -> Optional[LinePart]:
116
89
_capture_dict_name = r"""([\w_][\w0-9._]*)\["""
117
90
118
91
_current_dict_re = LazyReCompile (
119
- f'{ _capture_dict_name } ('
92
+ f'{ _capture_dict_name } ((?: '
120
93
f'{ _match_single_quote_str_bytes } |'
121
94
f'{ _match_double_quote_str_bytes } |'
122
- f'{ _match_int_and_float } |'
123
- f'{ _match_tuple } |'
124
- f'{ _match_all_dict_keys } |)' ,
95
+ # f'{_match_int_and_float}|'
96
+ # f'{_match_tuple}|'
97
+ f'{ _match_all_dict_keys } |)*) ' ,
125
98
re .VERBOSE
126
99
)
127
100
0 commit comments