atom = [CFWS] 1*atext [CFWS] An atom could be an rfc2047 encoded word.
(value)
| 1319 | return quoted_string, value |
| 1320 | |
| 1321 | def get_atom(value): |
| 1322 | """atom = [CFWS] 1*atext [CFWS] |
| 1323 | |
| 1324 | An atom could be an rfc2047 encoded word. |
| 1325 | """ |
| 1326 | atom = Atom() |
| 1327 | if value and value[0] in CFWS_LEADER: |
| 1328 | token, value = get_cfws(value) |
| 1329 | atom.append(token) |
| 1330 | if value and value[0] in ATOM_ENDS: |
| 1331 | raise errors.HeaderParseError( |
| 1332 | "expected atom but found '{}'".format(value)) |
| 1333 | if value.startswith('=?'): |
| 1334 | try: |
| 1335 | token, value = get_encoded_word(value) |
| 1336 | except errors.HeaderParseError: |
| 1337 | # XXX: need to figure out how to register defects when |
| 1338 | # appropriate here. |
| 1339 | token, value = get_atext(value) |
| 1340 | else: |
| 1341 | token, value = get_atext(value) |
| 1342 | atom.append(token) |
| 1343 | if value and value[0] in CFWS_LEADER: |
| 1344 | token, value = get_cfws(value) |
| 1345 | atom.append(token) |
| 1346 | return atom, value |
| 1347 | |
| 1348 | def get_dot_atom_text(value): |
| 1349 | """ dot-text = 1*atext *("." 1*atext) |
no test coverage detected