@@ -1473,44 +1473,48 @@ def resp_text
1473
1473
end
1474
1474
end
1475
1475
1476
- # See https://www.rfc-editor.org/errata/rfc3501
1476
+ # RFC3501 (See https://www.rfc-editor.org/errata/rfc3501):
1477
+ # resp-text-code = "ALERT" /
1478
+ # "BADCHARSET" [SP "(" charset *(SP charset) ")" ] /
1479
+ # capability-data / "PARSE" /
1480
+ # "PERMANENTFLAGS" SP "(" [flag-perm *(SP flag-perm)] ")" /
1481
+ # "READ-ONLY" / "READ-WRITE" / "TRYCREATE" /
1482
+ # "UIDNEXT" SP nz-number / "UIDVALIDITY" SP nz-number /
1483
+ # "UNSEEN" SP nz-number /
1484
+ # atom [SP 1*<any TEXT-CHAR except "]">]
1485
+ # capability-data = "CAPABILITY" *(SP capability) SP "IMAP4rev1"
1486
+ # *(SP capability)
1477
1487
#
1478
- # resp-text-code = "ALERT" /
1479
- # "BADCHARSET" [SP "(" charset *(SP charset) ")" ] /
1480
- # capability-data / "PARSE" /
1481
- # "PERMANENTFLAGS" SP "("
1482
- # [flag-perm *(SP flag-perm)] ")" /
1483
- # "READ-ONLY" / "READ-WRITE" / "TRYCREATE" /
1484
- # "UIDNEXT" SP nz-number / "UIDVALIDITY" SP nz-number /
1485
- # "UNSEEN" SP nz-number /
1486
- # atom [SP 1*<any TEXT-CHAR except "]">]
1488
+ # RFC4315 (UIDPLUS), RFC9051 (IMAP4rev2):
1489
+ # resp-code-apnd = "APPENDUID" SP nz-number SP append-uid
1490
+ # resp-code-copy = "COPYUID" SP nz-number SP uid-set SP uid-set
1491
+ # resp-text-code =/ resp-code-apnd / resp-code-copy / "UIDNOTSTICKY"
1487
1492
#
1488
- # +UIDPLUS+ ABNF:: https://www.rfc-editor.org/rfc/rfc4315.html#section-4
1489
- # resp-text-code =/ resp-code-apnd / resp-code-copy / "UIDNOTSTICKY"
1493
+ # RFC7162 (CONDSTORE):
1494
+ # resp-text-code =/ "HIGHESTMODSEQ" SP mod-sequence-value /
1495
+ # "NOMODSEQ" /
1496
+ # "MODIFIED" SP sequence-set
1490
1497
def resp_text_code
1491
- token = match ( T_ATOM )
1492
- name = token . value . upcase
1498
+ name = resp_text_code__name
1493
1499
case name
1494
- when / \A (?: ALERT| PARSE| READ-ONLY| READ-WRITE| TRYCREATE| NOMODSEQ) \z /n
1500
+ when " ALERT" , " PARSE" , " READ-ONLY" , " READ-WRITE" , " TRYCREATE" , " NOMODSEQ"
1495
1501
result = ResponseCode . new ( name , nil )
1496
- when / \A (?: BADCHARSET) \z /n
1502
+ when " BADCHARSET"
1497
1503
result = ResponseCode . new ( name , charset_list )
1498
- when / \A (?: CAPABILITY) \z /ni
1504
+ when " CAPABILITY"
1499
1505
result = ResponseCode . new ( name , capability__list )
1500
- when / \A (?: PERMANENTFLAGS) \z /n
1501
- match ( T_SPACE )
1506
+ when " PERMANENTFLAGS"
1507
+ SP!
1502
1508
result = ResponseCode . new ( name , flag_list )
1503
- when / \A (?: UIDVALIDITY| UIDNEXT| UNSEEN) \z /n
1504
- match ( T_SPACE )
1509
+ when " UIDVALIDITY" , " UIDNEXT" , " UNSEEN"
1510
+ SP!
1505
1511
result = ResponseCode . new ( name , number )
1506
- when / \A (?: APPENDUID) \z /n
1512
+ when " APPENDUID"
1507
1513
result = ResponseCode . new ( name , resp_code_apnd__data )
1508
- when / \A (?: COPYUID) \z /n
1514
+ when " COPYUID"
1509
1515
result = ResponseCode . new ( name , resp_code_copy__data )
1510
1516
else
1511
- token = lookahead
1512
- if token . symbol == T_SPACE
1513
- shift_token
1517
+ if SP?
1514
1518
result = ResponseCode . new ( name , text_chars_except_rbra )
1515
1519
else
1516
1520
result = ResponseCode . new ( name , nil )
@@ -1519,6 +1523,8 @@ def resp_text_code
1519
1523
return result
1520
1524
end
1521
1525
1526
+ alias resp_text_code__name case_insensitive__atom
1527
+
1522
1528
# 1*<any TEXT-CHAR except "]">
1523
1529
def text_chars_except_rbra
1524
1530
match_re ( CTEXT_REGEXP , '1*<any TEXT-CHAR except "]">' ) [ 0 ]
0 commit comments