Skip to content

Changed dict key-matching regex to capture any valid dict key #920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Oct 6, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Changed dict key-matching regex to capture any valid dict key
  • Loading branch information
arian-deimling committed Sep 27, 2021
commit eb321aa9ec088eb4a97ef61ab1bc6a9bb10dfb03
4 changes: 2 additions & 2 deletions bpython/line.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def current_word(cursor_offset: int, line: str) -> Optional[LinePart]:
return LinePart(start, end, word)


_current_dict_key_re = LazyReCompile(r"""[\w_][\w0-9._]*\[([\w0-9._(), '"]*)""")
_current_dict_key_re = LazyReCompile(r"""[\w_][\w0-9._]*\[(.*)""")


def current_dict_key(cursor_offset: int, line: str) -> Optional[LinePart]:
Expand All @@ -45,7 +45,7 @@ def current_dict_key(cursor_offset: int, line: str) -> Optional[LinePart]:
return None


_current_dict_re = LazyReCompile(r"""([\w_][\w0-9._]*)\[([\w0-9._(), '"]*)""")
_current_dict_re = LazyReCompile(r"""([\w_][\w0-9._]*)\[(.*)""")


def current_dict(cursor_offset: int, line: str) -> Optional[LinePart]:
Expand Down