Add #warning directive

This fixes #7.

Example:

 #warning blah blah

Result:

warning.pwn(1) : warning 237: user warning: blah blah

Pawn compiler 3.2.3664.samp	 	 	Copyright (c) 1997-2006, ITB CompuPhase

1 Warning.
This commit is contained in:
Zeex 2014-01-10 02:09:50 +07:00
parent fb96f7e44e
commit 1bd6be93e0
3 changed files with 96 additions and 87 deletions

View File

@ -290,7 +290,7 @@ typedef struct s_valuepair {
*/
#define tFIRST 256 /* value of first multi-character operator */
#define tMIDDLE 280 /* value of last multi-character operator */
#define tLAST 328 /* value of last multi-character match-able token */
#define tLAST 329 /* value of last multi-character match-able token */
/* multi-character operators */
#define taMULT 256 /* *= */
#define taDIV 257 /* /= */
@ -367,17 +367,18 @@ typedef struct s_valuepair {
#define tpPRAGMA 326
#define tpTRYINCLUDE 327
#define tpUNDEF 328
#define tpWARNING 329
/* semicolon is a special case, because it can be optional */
#define tTERM 329 /* semicolon or newline */
#define tENDEXPR 330 /* forced end of expression */
#define tTERM 330 /* semicolon or newline */
#define tENDEXPR 331 /* forced end of expression */
/* other recognized tokens */
#define tNUMBER 331 /* integer number */
#define tRATIONAL 332 /* rational number */
#define tSYMBOL 333
#define tLABEL 334
#define tSTRING 335
#define tEXPR 336 /* for assigment to "lastst" only (see SC1.C) */
#define tENDLESS 337 /* endless loop, for assigment to "lastst" only */
#define tNUMBER 332 /* integer number */
#define tRATIONAL 333 /* rational number */
#define tSYMBOL 334
#define tLABEL 335
#define tSTRING 336
#define tEXPR 337 /* for assigment to "lastst" only (see SC1.C) */
#define tENDLESS 338 /* endless loop, for assigment to "lastst" only */
/* (reversed) evaluation of staging buffer */
#define sSTARTREORDER 0x01

View File

@ -1383,6 +1383,12 @@ static int command(void)
if (!SKIPPING)
error(111,lptr); /* user error */
break;
case tpWARNING:
while (*lptr<=' ' && *lptr!='\0')
lptr++;
if (!SKIPPING)
error(237,lptr); /* user warning */
break;
default:
error(31); /* unknown compiler directive */
ret=SKIPPING ? CMD_CONDFALSE : CMD_NONE; /* process as normal line */
@ -1968,7 +1974,7 @@ char *sc_tokens[] = {
"sleep", "state", "static", "stock", "switch", "tagof", "*then", "while",
"#assert", "#define", "#else", "#elseif", "#emit", "#endif", "#endinput",
"#endscript", "#error", "#file", "#if", "#include", "#line", "#pragma",
"#tryinclude", "#undef",
"#tryinclude", "#undef", "#warning",
";", ";", "-integer value-", "-rational value-", "-identifier-",
"-label-", "-string-"
};

View File

@ -26,12 +26,12 @@ SC_FUNC int strexpand(char *dest, unsigned char *source, int maxlen, unsigned ch
#define SCPACK_TABLE errstr_table
/*-*SCPACK start of pair table, do not change or remove this line */
unsigned char errstr_table [][2] = {
{101,32}, {111,110}, {116,32}, {105,110}, {97,114}, {116,105}, {100,32}, {115,32}, {101,114}, {97,108}, {101,110}, {37,115}, {133,129}, {34,139}, {141,34}, {117,110},
{114,101}, {110,111}, {115,105}, {121,32}, {97,116}, {111,114}, {97,110}, {32,142}, {109,98}, {115,116}, {41,10}, {100,101}, {109,138}, {101,134}, {98,108}, {140,32},
{111,108}, {114,97}, {145,130}, {118,137}, {143,99}, {102,164}, {115,121}, {166,152}, {167,160}, {117,115}, {97,32}, {115,146}, {97,158}, {149,32}, {132,161}, {105,134},
{103,32}, {163,175}, {103,117}, {178,156}, {136,32}, {132,179}, {131,177}, {111,102}, {116,104}, {101,120}, {105,135}, {165,159}, {101,100}, {99,104}, {118,132}, {168,151},
{105,172}, {190,192}, {155,102}, {174,147}, {183,32}, {109,97}, {116,111}, {99,129}, {101,135}, {112,144}, {181,130}, {98,128}, {115,10}, {153,148}, {44,32}, {40,191},
{169,130}, {151,10}, {101,10}, {207,154}, {109,208}, {116,97}, {194,131}, {193,128}, {34,32}, {129,32}, {105,99}, {132,97}, {100,105}, {146,122}, {110,32}, {137,32},
{101,32}, {111,110}, {116,32}, {105,110}, {97,114}, {116,105}, {100,32}, {115,32}, {101,114}, {37,115}, {97,108}, {101,110}, {133,129}, {34,137}, {141,34}, {117,110},
{114,101}, {110,111}, {115,105}, {121,32}, {97,116}, {111,114}, {97,110}, {32,142}, {109,98}, {115,116}, {41,10}, {100,101}, {109,139}, {101,134}, {98,108}, {140,32},
{111,108}, {114,97}, {145,130}, {118,138}, {143,99}, {102,164}, {115,121}, {166,152}, {167,160}, {117,115}, {97,32}, {115,146}, {97,158}, {149,32}, {132,161}, {105,134},
{103,32}, {136,32}, {163,175}, {103,117}, {179,156}, {131,178}, {132,180}, {111,102}, {116,104}, {101,120}, {105,135}, {165,159}, {101,100}, {99,104}, {118,132}, {168,151},
{105,172}, {190,192}, {155,102}, {174,147}, {183,32}, {109,97}, {116,111}, {99,129}, {101,135}, {112,144}, {182,130}, {98,128}, {115,10}, {153,148}, {44,32}, {40,191},
{169,130}, {151,10}, {101,10}, {207,154}, {109,208}, {116,97}, {194,131}, {193,128}, {34,32}, {129,32}, {105,99}, {132,97}, {100,105}, {146,122}, {110,32}, {138,32},
{104,97}, {101,108}, {117,108}, {99,111}, {108,111}, {109,148}, {199,153}, {58,209}, {111,112}, {97,115}, {108,128}, {232,136}, {230,150}, {150,32}, {201,171}, {131,176},
{212,203}, {102,105}, {119,105}, {185,238}, {109,112}, {116,136}, {165,140}, {197,147}, {102,149}, {111,32}, {131,32}, {213,176}, {110,117}, {115,117}, {118,128}
};
@ -131,97 +131,97 @@ static char *errmsg[] = {
/*090*/ "public functions may not return arrays (symbol \"%s\")\n",
/*091*/ "ambiguous constant; tag override is required (symbol \"%s\")\n"
#else
"\271pect\235\306k\212:\227\316bu\202fo\217\206\216\012",
"\271pect\235\306k\213:\227\316bu\202fo\217\206\216\012",
"\201l\223\252s\203g\352\315e\234\202(\255\363\201) c\355f\240\344w ea\275 \042c\351e\042\012",
"\233cl\333\237\304\252\344c\337\327\324appe\204 \372\252\343\364o\217\206\236ock\012",
"\366\227 \272\242i\364le\234t\274\012",
"\273\367\242\340\376\265t\314",
"\273\367\242\340\376\266t\314",
"\360a\253gn\235\306 \355\256y\012",
"\353\224\255c\226\242\313\220\326\274\012",
"\360\252\354\202\363\201; \351\375m\235z\210o\012",
"\266\303\335\200(nega\205ve\316z\210\371\255ou\202\304bo\217ds\232",
"\266\273\255\233cl\333\214\012",
"\266out\222d\200\366\314",
"\266\273c\211l\316\242\252\261add\220s\314",
"\221 \212tr\223po\203\202(\221 pu\236\332 \366s\232",
"\266\315e\234t; \242\372s\362t\275\012",
"\265\303\335\200(nega\205ve\316z\210\371\255ou\202\304bo\217ds\232",
"\265\273\255\233cl\333\214\012",
"\265out\222d\200\366\314",
"\265\273c\212l\316\242\252\262add\220s\314",
"\221 \213tr\223po\203\202(\221 pu\236\332 \366s\232",
"\265\315e\234t; \242\372s\362t\275\012",
"\042\302a\342t\330c\351\200\360\270\200l\351\202c\351\200\372s\362t\275 \315e\234t\012",
"m\342\205p\352\302a\342t\207\372\042s\362t\275\042\012",
"\217\326\235\277\012",
"\203i\205\211iza\237d\224\252\271ce\274\207\233cl\204\235\335\322",
"\203i\205\212iza\237d\224\252\271ce\274\207\233cl\204\235\335\322",
"\242\252lab\341\347",
"\266\250 nam\200\216\012",
"\250 \211\220ad\223\326\274\347",
"\265\250 nam\200\216\012",
"\250 \212\220ad\223\326\274\347",
"\360l\243u\200(n\201-\354t\232",
"\303a\253gn\234\202\360\222\364\352a\253gn\234t\012",
"\042b\220ak\330\255\042\307t\203ue\330\272ou\202\304\307t\271t\012",
"\273head\357\334ff\210\207from pro\306typ\322",
"\221 \345\275\357\042#if...\042\012",
"\266\275\333ct\264\354t\012",
"\266\375bscrip\202(\242\355\303\255\306\371m\226\223\375bscripts)\347",
"\266\363\201\316\351\375m\235z\210o\012",
"\343\364o\217\206\315e\234\202\242c\344s\235a\202\270\200\212\206\304\361\352(\231\204t\235a\202l\203\200%d\232",
"\265\275\333ct\261\354t\012",
"\265\375bscrip\202(\242\355\303\255\306\371m\226\223\375bscripts)\347",
"\265\363\201\316\351\375m\235z\210o\012",
"\343\364o\217\206\315e\234\202\242c\344s\235a\202\270\200\213\206\304\361\352(\231\204t\235a\202l\203\200%d\232",
"\217k\221w\336\334\220c\205v\322",
"\303\203\233x ou\202\304bo\217d\207(\327\216\232",
"\303\360\203\233x\235(\327\216\232",
"\312do\310\242\340\376\252\302a\342\202\243u\200(\312%d\232",
"\312typ\200mis\345\275 (\312%d\232",
"e\364t\223\315e\234t\012",
"\266\231r\357(po\253\236\223n\201-\365m\203\224\235\231r\203g\232",
"\265\231r\357(po\253\236\223n\201-\365m\203\224\235\231r\203g\232",
"\271t\241 \275\333c\365\207\331l\203\322",
"\354\202\250 \340\207\221 \335\322",
"dupl\332\224\200\042c\351e\330lab\341 (\243u\200%d\232",
"\266\341lip\222s\316\303\335\200\272\242k\221wn\012",
"\266\343\230\203a\237\304cl\351\207speci\361\210\314",
"\275\333ct\264\354\202\271ce\274\207r\226g\200f\255pack\235\231r\203g\012",
"po\222\214\337p\333me\365\207\324\311c\274\200\211l nam\235p\333me\365\314",
"\306\371m\226\223\273\265t\314",
"\265\341lip\222s\316\303\335\200\272\242k\221wn\012",
"\265\343\230\203a\237\304cl\351\207speci\361\210\314",
"\275\333ct\261\354\202\271ce\274\207r\226g\200f\255pack\235\231r\203g\012",
"po\222\214\337p\333me\365\207\324\311c\274\200\212l nam\235p\333me\365\314",
"\306\371m\226\223\273\266t\314",
"\217k\221w\336\303\335\200(\327\216\232",
"\303\335\310d\371\242\345\275\316\255\233\231\203a\237\303\272\306\371sm\211l\012",
"\303\335\310d\371\242\345\275\316\255\233\231\203a\237\303\272\306\371sm\212l\012",
"\303\334\234\222\201\207d\371\242\345\275\012",
"\266l\203\200\307t\203ua\214\012",
"\266r\226g\322",
"\266\375bscript\316\251\200\042[ ]\330\353\224\225\207\331\305j\255\334\234\222\201\314",
"m\342\205-\334\234\222\201\337\256y\207\360f\342l\223\203i\205\211iz\274\012",
"\271ce\274\357\305ximum \374\230\264\304\334\234\222\201\314",
"\265l\203\200\307t\203ua\214\012",
"\265r\226g\322",
"\265\375bscript\316\251\200\042[ ]\330\353\224\225\207\331\305j\255\334\234\222\201\314",
"m\342\205-\334\234\222\201\337\256y\207\360f\342l\223\203i\205\212iz\274\012",
"\271ce\274\357\305ximum \374\230\261\304\334\234\222\201\314",
"\217\345\275\235c\344s\357b\241c\200(\042}\042\232",
"\231\204\202\304\273bod\223\362\270ou\202\273head\210\012",
"\256ys\316\344c\337\301\310\226\206\273\265t\207c\226\242\313pu\236\332 (\327\216\232",
"\217f\203ish\235\363\331be\370\200\343\364il\264\334\220c\205v\322",
"dupl\332\224\200\265t; sam\200\312\272p\351s\235tw\332\322",
"\256ys\316\344c\337\301\310\226\206\273\266t\207c\226\242\313pu\236\332 (\327\216\232",
"\217f\203ish\235\363\331be\370\200\343\364il\261\334\220c\205v\322",
"dupl\332\224\200\266t; sam\200\312\272p\351s\235tw\332\322",
"\273\312\367\242\340\376\252\302a\342\202\243u\200(\327\216\232",
"m\342\205p\352\042#\341se\330\334\220c\205v\310betwe\212 \042#if ... #\212\334f\042\012",
"m\342\205p\352\042#\341se\330\334\220c\205v\310betwe\213 \042#if ... #\213\334f\042\012",
"\042#\341seif\330\334\220c\205\376f\240\344w\207\355\042#\341se\330\334\220c\205v\322",
"\374\230\264\304\353\226d\207do\310\242\361\202\270\200\353\224\225\012",
"\374\230\261\304\353\226d\207do\310\242\361\202\270\200\353\224\225\012",
"\273\220s\342\202\373\304\353\224\225\227 \360\216\012",
"c\226\242\275\226g\200\311\326\235\353\224\225\314",
"\273\312\367\201l\223\340\376\252s\203g\352\373(\312%d\232",
"\273\312\367\242\313\252\220f\210\212c\200\312\255\355\303(\312\216\232",
"\327c\226\242\313bo\270 \252\220f\210\212c\200\226\206\355\303(\327\216\232",
"\266\241\214\337\374\230\264\311ci\222\331\372#p\241g\305\012",
"\241\214\337\374\230\264\370\305\202\211\220ad\223\326\274\012",
"\241\214\337\374\230\264\375pp\225\202wa\207\242\212\254\274\012",
"\273\312\367\242\313\252\220f\210\213c\200\312\255\355\303(\312\216\232",
"\327c\226\242\313bo\270 \252\220f\210\213c\200\226\206\355\303(\327\216\232",
"\265\241\214\337\374\230\261\311ci\222\331\372#p\241g\305\012",
"\241\214\337\374\230\261\370\305\202\212\220ad\223\326\274\012",
"\241\214\337\374\230\261\375pp\225\202wa\207\242\213\254\274\012",
"\251\210-\326\235\353\224\255\360\233cl\204\235be\370\200\251\200(\366\227\232",
"\042\335e\267\330\353\224\255\272\266\331\042\366\330\250\314",
"\042\335e\267\330\353\224\255\272\265\331\042\366\330\250\314",
"\273\312\360\355\303(\312\216\232",
"#\326\200p\224\365\336\324\231\204\202\362\270 \355\211p\340be\205c \275\333c\365\012",
"\203pu\202l\203\200\306\371l\201\260(aft\264\375bs\205tu\214s\232",
"\246n\325x \210r\255\372\270\200\363\201\316\255\266\273c\211l\012",
"m\211\370m\235UTF-8 \212\343d\203g\316\255c\225rupt\235\361le: \213\012",
"#\326\200p\224\365\336\324\231\204\202\362\270 \355\212p\340be\205c \275\333c\365\012",
"\203pu\202l\203\200\306\371l\201\260(aft\261\375bs\205tu\214s\232",
"\246n\325x \210r\255\372\270\200\363\201\316\255\265\273c\212l\012",
"m\212\370m\235UTF-8 \213\343d\203g\316\255c\225rupt\235\361le: \211\012",
"\273\251\310bo\270 \042\220turn\330\226\206\042\220tur\336<\243ue>\042\012",
"\203\307\222\231\212\202\220tur\336typ\310(\303& n\201-\256y\232",
"\203\307\222\231\213\202\220tur\336typ\310(\303& n\201-\256y\232",
"\217k\221w\336\250\316\255\242\252\354\202\250 \323",
"c\226\242\325k\200\252\373a\207\252\302a\342\202\243u\200f\255\355\203\233x\235\303p\333met\264\323",
"c\226\242\325k\200\252\373a\207\252\302a\342\202\243u\200f\255\355\203\233x\235\303p\333met\261\323",
"\251\210-\326\235\353\224\225\207\226\206na\205\376\366\207\367\242\340\376\315e\314",
"\252\273\255\327\367\201l\223b\341\201\260\306 \252s\203g\352au\306\345\331\323",
"\315\200\307fl\332t: \201\200\304\270\200\315\310\272\211\220ad\223a\253gn\235\306 a\221\270\264i\364le\234\325\237\323",
"\315\200\307fl\332t: \201\200\304\270\200\315\310\272\212\220ad\223a\253gn\235\306 a\221\270\261i\364le\234\325\237\323",
"\221 \315\310\204\200\326\235f\255\277\012",
"\217k\221w\336au\306\345\201\321",
"\217k\221w\336\315\200\216 f\255au\306\345\201\321",
"pu\236\332 \301\310\226\206\344c\337\301\310\367\242\340\376\315\310\323",
"\315\200\301\310\367\242\313\203i\205\211iz\235\323",
"\315\200\301\310\367\242\313\203i\205\212iz\235\323",
"pu\236\332 \366\207\367\242\220tur\336\256y\207\323",
"a\230i\262ou\207\354t; \373ov\210rid\200\272\220qui\220\206\323"
"a\230i\263ou\207\354t; \373ov\210rid\200\272\220qui\220\206\323"
#endif
};
@ -244,20 +244,20 @@ static char *fatalmsg[] = {
/*108*/ "codepage mapping file not found\n",
/*109*/ "invalid path: \"%s\"\n",
/*110*/ "assertion failed: %s\n",
/*111*/ "user error: %s\n",
/*111*/ "user error: %s\n"
#else
"c\226\242\220a\206from \361le\347",
"c\226\242writ\200\306 \361le\347",
"t\254\200ov\210f\344w\347",
"\203\375ff\332i\212\202mem\225y\012",
"\266\351se\230l\264\203\231ruc\214\321",
"\203\375ff\332i\213\202mem\225y\012",
"\265\351se\230l\261\203\231ruc\214\321",
"\374m\210\332 ov\210f\344w\316\271ce\274\357capacity\012",
"\343\364il\235scrip\202\271ce\274\207\270\200\305ximum mem\225\223\335\200(%l\206bytes\232",
"\306\371m\226\223\210r\255messag\310\331\201\200l\203\322",
"\343\233pag\200\305pp\357\361\352\242fo\217d\012",
"\266p\224h\347",
"\351s\210\237fail\274: \213\012",
"\251\264\210r\225: \213\012"
"\265p\224h\347",
"\351s\210\237fail\274: \211\012",
"\251\261\210r\225: \211\012"
#endif
};
@ -300,43 +300,45 @@ static char *warnmsg[] = {
/*234*/ "function is deprecated (symbol \"%s\") %s\n",
/*235*/ "public function lacks forward declaration (symbol \"%s\")\n",
/*236*/ "unknown parameter in substitution (incorrect #define pattern)\n"
/*237*/ "user warning: %s\n"
#else
"\277 \272tr\244\224\235\306 %\206\275\333c\365\314",
"\220\326i\237\304\354t/\305cr\371\323",
"\374\230\264\304\265t\207do\310\242\345\275 \326i\214\012",
"\250 \272nev\264\251\274\347",
"\250 \272a\253gn\235\252\243u\200\270a\202\272nev\264\251\274\347",
"\374\230\261\304\266t\207do\310\242\345\275 \326i\214\012",
"\250 \272nev\261\251\274\347",
"\250 \272a\253gn\235\252\243u\200\270a\202\272nev\261\251\274\347",
"\220d\217d\226\202\343\233: \354\202\363\331\272z\210o\012",
"\220d\217d\226\202te\231: \354\202\363\331\272n\201-z\210o\012",
"\217k\221w\336#p\241g\305\012",
"\273\362\270 \373\220s\342\202\251\235be\370\200\326i\214\316\370c\357\220p\204s\322",
"\366\227 sho\342\206\220tur\336\252\243u\322",
"po\253\236\200\251\200\304\250 be\370\200\203i\205\211iza\214\347",
"po\253\236\223\217\203t\212\233\206a\253gn\234t\012",
"po\253\236\223\217\203t\212\233\206bit\362s\200\353a\214\012",
"po\253\236\200\251\200\304\250 be\370\200\203i\205\212iza\214\347",
"po\253\236\223\217\203t\213\233\206a\253gn\234t\012",
"po\253\236\223\217\203t\213\233\206bit\362s\200\353a\214\012",
"\373mis\345\275\012",
"po\253\236\223\252\042\346\330\303\312wa\207\203t\212\233d\347",
"po\253\236\223\252\042\346\330\303\312wa\207\203t\213\233d\347",
"\363\331\340\207\221 effect\012",
"ne\231\235\343m\234t\012",
"\344os\200\203d\212\325\214\012",
"\344os\200\203d\213\325\214\012",
"\240\206\231y\352pro\306typ\310\251\235\362\270 \350\214\337sem\332\240umn\314",
"\344c\337\327\216 s\340dow\207\252\327a\202\252\311c\274\357lev\341\012",
"\363\331\362\270 \373ov\210rid\200\324appe\204 betwe\212 p\204\212\270ese\314",
"\363\331\362\270 \373ov\210rid\200\324appe\204 betwe\213 p\204\213\270ese\314",
"lab\341 nam\200\216 s\340dow\207\373nam\322",
"\374\230\264\304\334git\207\271ce\274\207\241\214\337\374\230\264\311ci\222\201\012",
"\220d\217d\226\202\042\335e\267\042: \312\335\200\272\211way\2071 \323",
"\374\230\261\304\334git\207\271ce\274\207\241\214\337\374\230\261\311ci\222\201\012",
"\220d\217d\226\202\042\335e\267\042: \312\335\200\272\212way\2071 \323",
"\203\233\365m\203\224\200\303\335\200\372\042\335e\267\330\363\331\323",
"\217\220a\275\254\200\343\233\012",
"\252\327\272a\253gn\235\306 its\341f \323",
"m\225\200\203i\205\211l\210\207\270\355\212um \361\341d\314",
"l\212g\270 \304\203i\205\211l\264\271ce\274\207\335\200\304\270\200\212um \361\341d\012",
"m\225\200\203i\205\212l\210\207\270\355\213um \361\341d\314",
"l\213g\270 \304\203i\205\212l\261\271ce\274\207\335\200\304\270\200\213um \361\341d\012",
"\203\233x \373mis\345\275 \323",
"\221 i\364le\234\325\237f\255\315\200\216 \372\366\227\316\221 f\211l-back\012",
"\221 i\364le\234\325\237f\255\315\200\216 \372\366\227\316\221 f\212l-back\012",
"\315\200specif\332a\237\331\370w\204\206\233cl\333\237\272ig\221\220d\012",
"outpu\202\361\352\272writt\212\316bu\202\362\270 \343\364ac\202\212\343d\357\334s\254\274\012",
"outpu\202\361\352\272writt\213\316bu\202\362\270 \343\364ac\202\213\343d\357\334s\254\274\012",
"\315\200\327\216 s\340dow\207\252g\344b\337\301\322",
"\273\272\233\311c\224\235\317) \213\012",
"\273\272\233\311c\224\235\317) \211\012",
"pu\236\332 \273lack\207\370w\204\206\233cl\333\237\323",
"\217k\221w\336p\333met\264\372\375bs\205tu\237(\203c\225\220c\202#\326\200p\224\365n\232"
"\217k\221w\336p\333met\261\372\375bs\205tu\237(\203c\225\220c\202#\326\200p\224\365n\232",
"\251\261w\204n\203g: \211\012"
#endif
};