carlkma / free-text

MIT License
0 stars 0 forks source link

Identify misplaced colon #2

Open carlkma opened 2 years ago

carlkma commented 2 years ago

return the exact position(s) of misplaced colons (if any) and suggest a valid colon position

carlkma commented 2 years ago

General Idea

Colons that do not align with the following usages are considered misplaced:

Colons serve three (3) primary purposes in Python:

  1. a slice operator, e.g., sub_string = a_string[3:9]
  2. a signal for the start of indented blocks, e.g., after for i in range(10):
  3. a designation for key:value pairs in a dictionary, e.g., a_dict = {"a_key": "a_value"}

Thus, we can conduct simple regex checks to verify if