tttm

git clone https://orangeshoelaces.net/git/tttm.git

1723c7843daafde95eba2574546c40d69ef98d13

Author: Vasily Kolobkov on 05/13/2016

Committer: Vasily Kolobkov on 05/13/2016

Index literals explicitly

Stats

parser.c | 185 ++++----
1 file changed, 92 insertions(+), 93 deletions(-)

Patch

diff --git a/parser.c b/parser.c
index 6f7ba02..d8cfd3c 100644
--- a/parser.c
+++ b/parser.c
@@ -25,102 +25,101 @@
 	"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
 
 static struct literal {
-	int    val;
 	char  *srep;
 	size_t slen;
 } literals[] = {
-	{ IL_7BIT,              "7BIT",              4  },
-	{ IL_8BIT,              "8BIT",              4  },
-	{ IL_ALERT,             "ALERT",             5  },
-	{ IL_APP,               "APPLICATION",       11 },
-	{ IL_APR,               "Apr",               3  },
-	{ IL_ASTERISK,          "*",                 1  },
-	{ IL_AUDIO,             "AUDIO",             5  },
-	{ IL_AUG,               "Aug",               3  },
-	{ IL_AUTHEQ,            "AUTH=",             5  },
-	{ IL_B64,               "BASE64",            6  },
-	{ IL_BAD,               "BAD",               3  },
-	{ IL_BADCS,             "BADCHARSET",        10 },
-	{ IL_BIN,               "BINARY",            6  },
-	{ IL_BODY,              "BODY",              4  },
-	{ IL_BSLASH,            "\\",                1  },
-	{ IL_BYE,               "BYE",               3  },
-	{ IL_CAP,               "CAPABILITY",        10 },
-	{ IL_CBRACE,            "}",                 1  },
-	{ IL_CBRACK,            "]",                 1  },
-	{ IL_COLON,             ":",                 1  },
-	{ IL_CPAR,              ")",                 1  },
-	{ IL_DEC,               "Dec",               3  },
-	{ IL_DHDR,              ".HEADER",           7  },
-	{ IL_DNOT,              ".NOT",              4  },
-	{ IL_DOT,               ".",                 1  },
-	{ IL_DQUOTE,            "\"",                1  },
-	{ IL_DTXT,              ".TEXT",             5  },
-	{ IL_ENVELOPE,          "ENVELOPE",          8  },
-	{ IL_EOL,               "\r\n",              2  },
-	{ IL_EXISTS,            "EXISTS",            6  },
-	{ IL_EXPUNGE,           "EXPUNGE",           7  },
-	{ IL_FEB,               "Feb",               3  },
-	{ IL_FETCH,             "FETCH",             5  },
-	{ IL_FLAGS,             "FLAGS",             5  },
-	{ IL_FLANSWERED,        "\\Answered",        9  },
-	{ IL_FLANY,             "\\*",               2  },
-	{ IL_FLDELETED,         "\\Deleted",         8  },
-	{ IL_FLDRAFT,           "\\Draft",           6  },
-	{ IL_FLFLAGGED,         "\\Flagged",         8  },
-	{ IL_FLMARKED,          "\\Marked",          7  },
-	{ IL_FLNOINFERIORS,     "\\Noinferiors",     12 },
-	{ IL_FLNOSEL,           "\\Noselect",        9  },
-	{ IL_FLRECENT,          "\\Recent",          7  },
-	{ IL_FLSEEN,            "\\Seen",            5  },
-	{ IL_FLUNMARKED,        "\\Unmarked",        9  },
-	{ IL_GT,                ">",                 1  },
-	{ IL_HDR,               "HEADER",            6  },
-	{ IL_HDRFIELDS,         "HEADER.FIELDS",     13 },
-	{ IL_IMG,               "IMAGE",             5  },
-	{ IL_INBOX,             "INBOX",             5  },
-	{ IL_INTDATE,           "INTERNALDATE",      12 },
-	{ IL_JAN,               "Jan",               3  },
-	{ IL_JUL,               "Jul",               3  },
-	{ IL_JUN,               "Jun",               3  },
-	{ IL_LIST,              "LIST",              4  },
-	{ IL_LSUB,              "LSUB",              4  },
-	{ IL_LT,                "<",                 1  },
-	{ IL_MAR,               "Mar",               3  },
-	{ IL_MAY,               "May",               3  },
-	{ IL_MIME,              "MIME",              4  },
-	{ IL_MINUS,             "-",                 1  },
-	{ IL_MSG,               "MESSAGE",           7  },
-	{ IL_MSGS,              "MESSAGES",          8  },
-	{ IL_NIL,               "NIL",               3  },
-	{ IL_NO,                "NO",                2  },
-	{ IL_NOV,               "Nov",               3  },
-	{ IL_OBRACE,            "{",                 1  },
-	{ IL_OBRACK,            "[",                 1  },
-	{ IL_OCT,               "Oct",               3  },
-	{ IL_OK,                "OK",                2  },
-	{ IL_OPAR,              "(",                 1  },
-	{ IL_PARSE,             "PARSE",             5  },
-	{ IL_PERMFL,            "PERMANENTFLAGS",    14 },
-	{ IL_PLUS,              "+",                 1  },
-	{ IL_QPRN,              "QUOTED-PRINTABLE",  16 },
-	{ IL_RECENT,            "RECENT",            6  },
-	{ IL_RFC822,            "RFC822",            6  },
-	{ IL_RFC822SIZE,        "RFC822.SIZE",       11 },
-	{ IL_RO,                "READ-ONLY",         9  },
-	{ IL_RW,                "READ-WRITE",        10 },
-	{ IL_SEARCH,            "SEARCH",            6  },
-	{ IL_SEP,               "Sep",               3  },
-	{ IL_SP,                " ",                 1  },
-	{ IL_STATUS,            "STATUS",            6  },
-	{ IL_STRUCT,            "STRUCTURE",         9  },
-	{ IL_TRYC,              "TRYCREATE",         9  },
-	{ IL_TXT,               "TEXT",              4  },
-	{ IL_UID,               "UID",               3  },
-	{ IL_UIDNEXT,           "UIDNEXT",           7  },
-	{ IL_UIDVAL,            "UIDVALIDITY",       11 },
-	{ IL_UNSEEN,            "UNSEEN",            6  },
-	{ IL_VIDEO,             "VIDEO",             5  },
+	[IL_7BIT]               = { "7BIT",              4  },
+	[IL_8BIT]               = { "8BIT",              4  },
+	[IL_ALERT]              = { "ALERT",             5  },
+	[IL_APP]                = { "APPLICATION",       11 },
+	[IL_APR]                = { "Apr",               3  },
+	[IL_ASTERISK]           = { "*",                 1  },
+	[IL_AUDIO]              = { "AUDIO",             5  },
+	[IL_AUG]                = { "Aug",               3  },
+	[IL_AUTHEQ]             = { "AUTH=",             5  },
+	[IL_B64]                = { "BASE64",            6  },
+	[IL_BAD]                = { "BAD",               3  },
+	[IL_BADCS]              = { "BADCHARSET",        10 },
+	[IL_BIN]                = { "BINARY",            6  },
+	[IL_BODY]               = { "BODY",              4  },
+	[IL_BSLASH]             = { "\\",                1  },
+	[IL_BYE]                = { "BYE",               3  },
+	[IL_CAP]                = { "CAPABILITY",        10 },
+	[IL_CBRACE]             = { "}",                 1  },
+	[IL_CBRACK]             = { "]",                 1  },
+	[IL_COLON]              = { ":",                 1  },
+	[IL_CPAR]               = { ")",                 1  },
+	[IL_DEC]                = { "Dec",               3  },
+	[IL_DHDR]               = { ".HEADER",           7  },
+	[IL_DNOT]               = { ".NOT",              4  },
+	[IL_DOT]                = { ".",                 1  },
+	[IL_DQUOTE]             = { "\"",                1  },
+	[IL_DTXT]               = { ".TEXT",             5  },
+	[IL_ENVELOPE]           = { "ENVELOPE",          8  },
+	[IL_EOL]                = { "\r\n",              2  },
+	[IL_EXISTS]             = { "EXISTS",            6  },
+	[IL_EXPUNGE]            = { "EXPUNGE",           7  },
+	[IL_FEB]                = { "Feb",               3  },
+	[IL_FETCH]              = { "FETCH",             5  },
+	[IL_FLAGS]              = { "FLAGS",             5  },
+	[IL_FLANSWERED]         = { "\\Answered",        9  },
+	[IL_FLANY]              = { "\\*",               2  },
+	[IL_FLDELETED]          = { "\\Deleted",         8  },
+	[IL_FLDRAFT]            = { "\\Draft",           6  },
+	[IL_FLFLAGGED]          = { "\\Flagged",         8  },
+	[IL_FLMARKED]           = { "\\Marked",          7  },
+	[IL_FLNOINFERIORS]      = { "\\Noinferiors",     12 },
+	[IL_FLNOSEL]            = { "\\Noselect",        9  },
+	[IL_FLRECENT]           = { "\\Recent",          7  },
+	[IL_FLSEEN]             = { "\\Seen",            5  },
+	[IL_FLUNMARKED]         = { "\\Unmarked",        9  },
+	[IL_GT]                 = { ">",                 1  },
+	[IL_HDR]                = { "HEADER",            6  },
+	[IL_HDRFIELDS]          = { "HEADER.FIELDS",     13 },
+	[IL_IMG]                = { "IMAGE",             5  },
+	[IL_INBOX]              = { "INBOX",             5  },
+	[IL_INTDATE]            = { "INTERNALDATE",      12 },
+	[IL_JAN]                = { "Jan",               3  },
+	[IL_JUL]                = { "Jul",               3  },
+	[IL_JUN]                = { "Jun",               3  },
+	[IL_LIST]               = { "LIST",              4  },
+	[IL_LSUB]               = { "LSUB",              4  },
+	[IL_LT]                 = { "<",                 1  },
+	[IL_MAR]                = { "Mar",               3  },
+	[IL_MAY]                = { "May",               3  },
+	[IL_MIME]               = { "MIME",              4  },
+	[IL_MINUS]              = { "-",                 1  },
+	[IL_MSG]                = { "MESSAGE",           7  },
+	[IL_MSGS]               = { "MESSAGES",          8  },
+	[IL_NIL]                = { "NIL",               3  },
+	[IL_NO]                 = { "NO",                2  },
+	[IL_NOV]                = { "Nov",               3  },
+	[IL_OBRACE]             = { "{",                 1  },
+	[IL_OBRACK]             = { "[",                 1  },
+	[IL_OCT]                = { "Oct",               3  },
+	[IL_OK]                 = { "OK",                2  },
+	[IL_OPAR]               = { "(",                 1  },
+	[IL_PARSE]              = { "PARSE",             5  },
+	[IL_PERMFL]             = { "PERMANENTFLAGS",    14 },
+	[IL_PLUS]               = { "+",                 1  },
+	[IL_QPRN]               = { "QUOTED-PRINTABLE",  16 },
+	[IL_RECENT]             = { "RECENT",            6  },
+	[IL_RFC822]             = { "RFC822",            6  },
+	[IL_RFC822SIZE]         = { "RFC822.SIZE",       11 },
+	[IL_RO]                 = { "READ-ONLY",         9  },
+	[IL_RW]                 = { "READ-WRITE",        10 },
+	[IL_SEARCH]             = { "SEARCH",            6  },
+	[IL_SEP]                = { "Sep",               3  },
+	[IL_SP]                 = { " ",                 1  },
+	[IL_STATUS]             = { "STATUS",            6  },
+	[IL_STRUCT]             = { "STRUCTURE",         9  },
+	[IL_TRYC]               = { "TRYCREATE",         9  },
+	[IL_TXT]                = { "TEXT",              4  },
+	[IL_UID]                = { "UID",               3  },
+	[IL_UIDNEXT]            = { "UIDNEXT",           7  },
+	[IL_UIDVAL]             = { "UIDVALIDITY",       11 },
+	[IL_UNSEEN]             = { "UNSEEN",            6  },
+	[IL_VIDEO]              = { "VIDEO",             5  },
 };
 
 static const char astr_specials[] = ASCII_CTL " \"%()*\\{\x7f";