From 153bbba6417ba115f11cbf5139636a01a5aa509b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 2 Jul 2014 23:01:00 -0700 Subject: [PATCH] WIP. --- sourcepawn/compiler/sc.h | 4 +- sourcepawn/compiler/sc1.c | 71 ++-- sourcepawn/compiler/sc5.scp | 389 +++++++++--------- sourcepawn/compiler/tests/ok-new-decl-args.sp | 34 ++ 4 files changed, 278 insertions(+), 220 deletions(-) create mode 100644 sourcepawn/compiler/tests/ok-new-decl-args.sp diff --git a/sourcepawn/compiler/sc.h b/sourcepawn/compiler/sc.h index c2104b18..9fbd97b6 100644 --- a/sourcepawn/compiler/sc.h +++ b/sourcepawn/compiler/sc.h @@ -516,8 +516,10 @@ typedef enum s_optmark { #define FIXEDTAG 0x40000000Lu #define FUNCTAG 0x20000000Lu #define OBJECTTAG 0x10000000Lu +#define ENUMTAG 0x08000000Lu #define TAGMASK (~PUBLICTAG) -#define TAGFLAGMASK (FIXEDTAG | FUNCTAG | OBJECTTAG) +#define TAGTYPEMASK (FUNCTAG | OBJECTTAG | ENUMTAG) +#define TAGFLAGMASK (FIXEDTAG | TAGTYPEMASK) #define CELL_MAX (((ucell)1 << (sizeof(cell)*8-1)) - 1) diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index 1377f47c..33c6a1c1 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -704,8 +704,10 @@ int pc_addtag_flags(char *name, int flags) ptr=tagname_tab.next; while (ptr!=NULL) { tag=(int)(ptr->value & TAGMASK); - if (strcmp(name,ptr->name)==0) + if (strcmp(name,ptr->name)==0) { + ptr->value |= flags; return tag; /* tagname is known, return its sequence number */ + } tag &= ~TAGFLAGMASK; if (tag>last) last=tag; @@ -3277,27 +3279,6 @@ static int parse_new_typeexpr(typeinfo_t *type, const token_t *first, int flags) lextok(&tok); } - // Note: we could have already filled in the prefix array bits below, so we - // check that ident != iARRAY before looking for an open bracket. - if (type->ident != iARRAY && tok.id == '[') { - // Not yet supported for return vals. This is allowed with old decls, but - // it's a huge hack. For now we forbid it in new code until it works right. - if (flags & TYPEFLAG_RETURN) - error(136); - - while (tok.id == '[') { - if (type->numdim == sDIMEN_MAX) { - error(53); - break; - } - type->dim[type->numdim++] = 0; - if (!needtoken(']')) - goto err_out; - lextok(&tok); - } - type->ident = iARRAY; - } - switch (tok.id) { case tINT: strcpy(type->type, "int"); @@ -3321,12 +3302,21 @@ static int parse_new_typeexpr(typeinfo_t *type, const token_t *first, int flags) type->tag = sc_rationaltag; } else { type->tag = pc_findtag(type->type); - if (type->tag == sc_rationaltag) + if (type->tag == sc_rationaltag) { error(98, "Float", "float"); - else if (type->tag == pc_tag_string) + } else if (type->tag == pc_tag_string) { error(98, "String", "char"); - else if (type->tag == 0) + } else if (type->tag == 0) { error(98, "_", "int"); + } else if (type->tag == -1) { + error(139, type->type); + type->tag = 0; + } else { + // Perform some basic filters so we can start narrowing down what can + // be used as a type. + if (!(type->tag & TAGTYPEMASK)) + error(139, type->type); + } } break; default: @@ -3334,6 +3324,27 @@ static int parse_new_typeexpr(typeinfo_t *type, const token_t *first, int flags) goto err_out; } + // Note: we could have already filled in the prefix array bits, so we check + // that ident != iARRAY before looking for an open bracket. + if (type->ident != iARRAY && matchtoken('[')) { + // Not yet supported for return vals. This is allowed with old decls, but + // it's a huge hack. For now we forbid it in new code until it works right. + if (flags & TYPEFLAG_RETURN) + error(136); + + do { + if (type->numdim == sDIMEN_MAX) { + error(53); + break; + } + type->dim[type->numdim++] = 0; + if (!needtoken(']')) + goto err_out; + } while (matchtoken('[')); + type->ident = iARRAY; + } + + if (flags & TYPEFLAG_ARGUMENT) { if (matchtoken('&')) { if (type->ident == iARRAY) { @@ -4382,7 +4393,10 @@ static void decl_enum(int vclass) * pc_addtag() here */ if (lex(&val,&str)==tLABEL) { - tag = pc_addtag(str); + int flags = ENUMTAG; + if (isupper(*str)) + flags |= FIXEDTAG; + tag = pc_addtag_flags(str, flags); spec = deduce_layout_spec_by_tag(tag); if (!can_redef_layout_spec(spec, Layout_Enum)) error(110, str, layout_spec_name(spec)); @@ -4397,7 +4411,10 @@ static void decl_enum(int vclass) if (lex(&val,&str)==tSYMBOL) { /* read in (new) token */ strcpy(enumname,str); /* save enum name (last constant) */ if (!explicittag) { - tag=pc_addtag(enumname); + int flags = ENUMTAG; + if (isupper(*str)) + flags |= FIXEDTAG; + tag=pc_addtag_flags(enumname, flags); spec = deduce_layout_spec_by_tag(tag); if (!can_redef_layout_spec(spec, Layout_Enum)) error(110, enumname, layout_spec_name(spec)); diff --git a/sourcepawn/compiler/sc5.scp b/sourcepawn/compiler/sc5.scp index c721b399..37f37def 100644 --- a/sourcepawn/compiler/sc5.scp +++ b/sourcepawn/compiler/sc5.scp @@ -31,14 +31,14 @@ 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}, {116,32}, {111,110}, {115,32}, {105,110}, {100,32}, {97,114}, {116,105}, {37,115}, {101,114}, {110,111}, {101,110}, {97,108}, {97,110}, {135,130}, {34,136}, - {143,34}, {111,114}, {114,101}, {117,110}, {121,32}, {138,129}, {97,116}, {115,116}, {115,105}, {100,101}, {101,133}, {32,144}, {117,109}, {41,10}, {116,104}, {117,115}, - {145,32}, {147,99}, {98,108}, {142,32}, {102,161}, {97,32}, {98,111}, {101,120}, {118,140}, {114,97}, {115,121}, {109,166}, {170,171}, {172,108}, {103,32}, {156,139}, - {99,141}, {137,32}, {103,175}, {134,178}, {116,111}, {105,131}, {115,10}, {176,149}, {115,152}, {134,169}, {99,104}, {105,133}, {102,132}, {97,162}, {116,121}, {101,131}, - {159,129}, {164,163}, {168,187}, {109,192}, {104,97}, {101,100}, {111,102}, {99,116}, {132,194}, {109,97}, {109,101}, {190,112}, {37,131}, {173,155}, {44,32}, {116,97}, - {99,111}, {167,112}, {98,128}, {99,130}, {118,134}, {198,32}, {105,189}, {212,214}, {117,108}, {109,139}, {185,148}, {153,188}, {134,97}, {118,128}, {179,129}, {101,10}, - {130,32}, {102,105}, {111,112}, {97,115}, {136,10}, {155,10}, {151,150}, {109,150}, {110,32}, {226,137}, {128,144}, {205,157}, {34,32}, {100,105}, {119,105}, {40,235}, - {99,108}, {211,151}, {140,32}, {141,32}, {196,221}, {101,108}, {152,122}, {108,128}, {164,142}, {132,32}, {132,174}, {207,174}, {231,186}, {158,128}, {97,131} + {101,32}, {116,32}, {111,110}, {115,32}, {100,32}, {105,110}, {97,114}, {116,105}, {37,115}, {101,114}, {110,111}, {97,110}, {101,110}, {97,108}, {135,130}, {34,136}, + {143,34}, {114,101}, {111,114}, {117,110}, {121,32}, {138,129}, {97,116}, {115,105}, {115,116}, {101,132}, {100,101}, {109,140}, {32,144}, {41,10}, {109,98}, {116,104}, + {114,97}, {117,115}, {146,32}, {147,99}, {142,32}, {98,108}, {102,163}, {111,108}, {101,120}, {118,141}, {97,32}, {115,121}, {171,158}, {172,167}, {99,139}, {103,32}, + {134,160}, {116,121}, {115,10}, {174,149}, {112,101}, {103,117}, {181,155}, {137,32}, {134,182}, {116,111}, {102,133}, {115,151}, {99,104}, {105,132}, {97,165}, {105,131}, + {161,129}, {166,164}, {169,189}, {109,192}, {104,97}, {109,101}, {111,102}, {99,116}, {133,194}, {109,97}, {101,100}, {99,130}, {37,131}, {176,148}, {173,156}, {44,32}, + {117,108}, {99,111}, {98,128}, {118,134}, {112,145}, {198,32}, {105,190}, {211,214}, {116,97}, {101,131}, {130,32}, {154,186}, {134,97}, {102,105}, {118,128}, {184,129}, + {110,32}, {111,112}, {97,115}, {136,10}, {156,10}, {128,144}, {152,150}, {109,150}, {100,105}, {119,105}, {225,137}, {101,10}, {206,157}, {34,32}, {40,236}, {99,108}, + {97,131}, {203,152}, {139,32}, {141,32}, {196,222}, {101,108}, {177,112}, {151,122}, {108,128}, {166,142}, {133,32}, {159,32}, {216,175}, {133,175}, {231,188} }; /*-*SCPACK end of pair table, do not change or remove this line */ @@ -182,142 +182,147 @@ static char *errmsg[] = { /*136*/ "arrays are not supported as return types\n", /*137*/ "cannot mix reference and array types\n", /*138*/ "const was specified twice\n", +/*139*/ "could not find type \"%s\"\n", #else - "\321e\307\232\264k\213:\233\316bu\201fo\223\205\220\012", - "\202l\224\245s\204g\367\346e\331\201(\240\321\222\270\202) \260 follow ea\272 \042c\343e\042\012", - "\231\360\334\243\325\245loc\362\327\200\303appe\206 \371\245\320mpo\223\205\242ock\012", - "\370\233 \265\225imple\331t\305\012", - "\301\311\224\225\364\263t\266", - "\303\322a\270gn\232\264 \363\271y\012", - "\351\226\240\267\322\222\333\305\012", - "\303\322\245\361\215\201\321\222\270\202; \343s\234\232z\211o\012", - "\310\332\366\200(nega\207ve\316z\211o \240ou\201\325\246\223ds\235", - "\310\301\240\231\360\334\216\012", - "\310out\230d\200\370\266", - "\310\301c\214l\316\225\245\302add\222s\266", - "\212 \213tr\224po\204\201(\212 pu\242ic \370s\235", - "\310\346e\331t; \225\371s\356t\272\012", - "\042\231fa\330t\354c\343\200\303\322\375l\343\201c\343\200\371s\356t\272 \346e\331t\012", - "m\330\207p\367\231fa\330t\203\371\042s\356t\272\042\012", - "\223\333\232\315\012", - "\204i\207\214iza\243d\226\245\247ce\305\203\231\360\206\232\366\337", - "\225\245lab\365:\345", - "\310\255 nam\352\012", - "\255 \214\222ad\224\333\305:\345", - "\303\322l\250u\200(n\202-\361\215t\235", - "\332a\270gn\331\201\303\322\230mp\367a\270gn\331t\012", - "\042b\222ak\354\240\042\323t\204ue\354\265ou\201\325\323t\247t\012", - "\301head\372\355ff\211\203from pro\264\313\337", - "\212 \374\372\042#if...\042\012", - "\310\272\334\307\261\361\215t\012", - "\310subscrip\201(\225\363\332\240\264o m\215\224subscripts):\345", - "\310\321\222\270\202\316\343s\234\232z\211o\012", - "\320mpo\223\205\346e\331\201\225\360os\232a\201\375\213\205\325\341\367(\227\206t\232a\201l\204\200%d\235", - "\223k\212w\350\355\222c\207v\337", - "\332\204\231x ou\201\325\246\223d\203(\327\352\235", - "\332\303\322\204\231x\232(\327\352\235", - "\336do\277\225\364\245\231fa\330\201\250u\200(\336%d\235", - "\336\313\200mis\374 (\336%d\235", - "empt\224\346e\331t\012", - "\310\227r\372(po\270\242\224n\202-t\211m\204\226\232\227r\204g\235", - "\247tr\245\272\334\307\211\203\340l\204\337", - "\361\215\201\255 \304\203\212 \366\337", - "duplic\226\200\042c\343e\354lab\365 (\250u\200%d\235", - "\310\365lip\230s\316\332\366\200\265\225k\212wn\012", - "\310\320mb\204a\243\325\360\343\203speci\341\211\266", - "\272\334\307\261\361\215\201\247ce\305\203r\215g\200f\240pack\232\227r\204g\012", - "po\230\216\362p\334\312t\211\203\303p\222c\305\200\214l nam\232p\334\312t\211\266", - "\264o m\215\224\301\263t\266", - "\223k\212w\350\332\366\200(\327\352\235", - "\332\366\277do \225\374\316\240\231\227\204a\243\332\265\264o sm\214l\012", - "\332(\203do \225\374\012", - "\310l\204\200\323t\204ua\216\012", - "\310r\215g\337", - "\310subscript\316\237\200\042[ ]\354\351\226\221\203\340\311j\240\355\331\230\202\266", - "m\330\207-\355\331\230\202\362\271y\203\303\322f\330l\224\204i\207\214iz\305\012", - "\247ce\305\372\311xim\234 n\234b\261\325\355\331\230\202\266", - "\223\374\232\360os\372b\251c\200(\042}\042\235", - "\227\206\201\325\301\246d\224\356\236ou\201\301head\211\012", - "\271ys\316loc\362\327\277\215\205\301\263t\203\267\322pu\242ic (\327\352\235", - "\223\274ish\232\321\222\270\340bef\221\200\320mpil\261\355\222c\207v\337", - "duplic\226\200\263t; sam\200\336\265p\343s\232t\356c\337", - "\301\336\311\224\225\364\245\231fa\330\201\250u\200(\327\352\235", - "m\330\207p\367\042#\365se\354\355\222c\207v\277betwe\213 \042#if ... #\213\355f\042\012", - "\042#\365seif\354\355\222c\207\335follow\203\363\042#\365se\354\355\222c\207v\337", - "n\234b\261\325\351\215d\203do\277\225\341\201\375\351\226\221\012", - "\301\222s\330\201\373\325\351\226\221\233 \303\322\220\012", - "\267\272\215g\200p\222\333\232\351\226\221\266", - "\301\336\311\224\202l\224\364\245s\204g\367\373(\336%d\235", - "\301\336\311\224\225\322\245\222f\211\213c\200\336\240\363\332(\336\220\235", - "\327\200\267\322\246\236 \245\222f\211\213c\200\215\205\363\332(\327\352\235", - "\310\251\216\362n\234b\261p\222ci\230\340\371#p\251g\311\012", - "\251\216\362n\234b\261f\221\311\201\214\222ad\224\333\305\012", - "\251\216\362n\234b\261supp\221\201w\376\225\213\275\305\012", - "\237\211-\333\232\351\226\240\303\322\231\360\206\232bef\221\200\237\200(\370\233\235", - "\042\366e\306\354\351\226\240\265\310\340\042\370\354\255\266", - "\301\336\303\322\363\332(\336\220\235", - "#\333\200p\226t\211\350\303\227\206\201\356\236 \363\214p\304be\207c \272\334\307\211\012", - "\204pu\201l\204\200\264o l\202\256(aft\261subs\207tu\216s\235", - "\252n\317x \211r\240\371\375\321\222\270\202\316\240\310\301c\214l\012", - "m\214f\221m\232UTF-8 \213\320d\204g\316\240c\221rupt\232\341le: \344", - "\301\237\277\246\236 \042\222turn\354\215\205\042\222tur\350<\250ue>\042\012", - "\204\323\230\227\213\201\222tur\350\313\277(\332& n\202-\271y\235", - "\223k\212w\350\255\316\240\225\245\361\215\201\255 \357", - "\267\317k\200\245\373\376\245\231fa\330\201\250u\200f\240\363\204\231x\232\332p\334\312t\261\357", - "\237\211-\333\232\351\226\221\203\215\205na\207\335\370\203\311\224\225\364\346e\266", - "\245\301\240\327\200\311\224\202l\224b\365\202\256\264 \245s\204g\367au\264\347\340\357", - "\346\200\323fli\307: \202\200\325\375\346\277\265\214\222ad\224a\270gn\232\264 a\212\236\261imple\331\317\243\357", - "\212 \346\277\206\200\333\232f\240\315\012", - "\223k\212w\350au\264\347\202\345", - "\223k\212w\350\346\352 f\240au\264\347\202\345", - "pu\242ic \327\277\215\205loc\362\327\277\311\224\225\364\346\277\357", - "\346\200\327\277\311\224\225\322\204i\207\214iz\232\357", - "pu\242ic \370\203\311\224\225\222tur\350\271y\203\357", - "ambiguou\203\361\215t; \373ov\211rid\200\265\222qui\222\205\357", - "n\234b\261\325\263t\203do\277\225\374 \333i\216\012", - "\321e\307\232\373nam\200id\213\207\341\211\012", - "\301\213\234\211a\243\222qui\222\203\223iqu\200\317g\012", - "\267\364\222qui\222\205p\334\312t\211\203aft\261\342\216\362p\334\312t\211\266", - "\320\330\205\225\274\205\312mb\211\233 \371\227ruc\201\220\012", - "\315 do\277\225\364\245\374\372\313\337", - "\313\352 sho\330\205\322\220 \371new-\227y\367\231\360\334\216\266", - "\314sho\330\205\225\364\363\321lici\201\222tur\350\313\337", - "\301pro\264\313\277do \225\374\012", - "specif\224ei\236\261\214l \355\331\230\202\203\240\202l\224\375l\343\201\355\331\230\202\012", - "\267\274\205\314\344", - "\314w\376\214\222ad\224\333\232\340\236\265\344", - "\267\274\205\215\224\312\236od\203f\240\344", - "\267\274\205\312\236o\205\240pr\351t\224\210.\344", - "\267c\214l \312\236od\203\340\363\271y\012", - "\267c\214l \312\236od\203\340\245\370\012", - "\312\236o\205\303\364\245\341rs\201\336\320mpa\207\242\200\356\236 \375\314\313\200(\210\235", - "\314nam\200\303\227\206\201\356\236 \363upp\211c\343\200lett\211\012", - "\314\304\203\214\222ad\224be\213 \333\232(p\222vio\237l\224se\213 \376\210\235", - "\321e\307\232id\213\207\341\261- d\273you f\221ge\201\245\313e?\012", - "\361ru\307\240\301\303\222tur\350\373\344", - "\267\333\200\361ru\307\240f\221\233; \214\222ad\224\247i\227\203\376\245\344", - "miss\372\313e\316\240\314\303\364\375sam\200nam\200\376\314\220\012", - "\267\237\200\231lete\316\314\314\304\203\212 \231\227ru\307\221\012", - "\212 \312\236od\311p \240\360\343\203w\376fo\223\205f\240\344", - "\212 \231\227ru\307\240w\376fo\223\205f\240\314\344", - "\231\227ru\307\221\203\303\322na\207\335\370\266", - "\231\227ru\307\221\203\267\364\247tr\245\263t\266", - "\312\236od\311p \215\205\360\343\203\230gn\226u\222\203\303\237\200new-\227y\367\313\200\231\360\334\216\266", - "\236\265\252n\317x \265\225ye\201supp\221t\305\012", - "\321e\307\232\313\200\321\222\270\202\012", - "f\330ly-qu\214i\341\232nam\352 \265\264o l\202g\316wo\330\205\322tr\241\226\232\264\345", - "\223\321e\307\232\264k\213\316\321e\307\232\312\236o\205\240pr\351\276\012", - "\321e\307\232\042na\207ve\354\240\042get\042\012", - "\314f\240\314\214\222ad\224\247i\227\266", - "pr\351t\224gett\211\203\267accep\201\247tr\245\263t\266", - "\314\303\364\375sam\200\222tur\350\313\200\376pr\351t\224\314(\210\235", - "\267mix \312\236od\311p\203\215\205\360\343s\277\356\236 \204h\211it\215c\337", - "\267\320\211c\200\370\203\264 \250ue\266", - "\267\320\211c\200objec\201\313\200\314\264 n\202-objec\201\313\200\344", - "\267\320\211c\200n\202-objec\201\313\200\314\264 objec\201\313\200\344", - "\267\320\211c\200\223\222l\226\232objec\201\313\277\314\215\205\344", - "\313\200mis\374 (\314\215\205\210\235", - "\267\237\200\363objec\201\371\245m\330\207-\373s\365e\307\221\012" + "\250\264\307\231\271k\214:\234\317bu\201fo\223\204\220\012", + "\202l\224\252s\205g\370\346e\233\201(\242\250\324\273\202) \256 f\247low ea\274 \042c\342e\042\012", + "\232\357\334\244\325\252loc\363\327\200\303ap\264\206 \372\252\321mpo\223\204\245ock\012", + "\371\234 \277\225imple\233t\312\012", + "\301\311\224\225\364\270t\262", + "\303\322a\273gn\231\271 \362\260y\012", + "\352\226\242\263\322\221\333\312\012", + "\303\322\252\361\213\201\250\324\273\202; \342sum\231z\211o\012", + "\310\315\367\200(nega\207ve\317z\211o \242ou\201\325bo\223ds\235", + "\310\301\242\232\357\334\216\012", + "\310out\227d\200\371\262", + "\310\301c\215l\317\225\252\302add\221s\262", + "\212 \214tr\224po\205\201(\212 pu\245ic \371s\235", + "\310\346e\233t; \225\372s\351t\274\012", + "\042\232fa\320t\355c\342\200\303\322\237\200l\342\201c\342\200\372s\351t\274 \346e\233t\012", + "m\320\207p\370\232fa\320t\203\372\042s\351t\274\042\012", + "\223\333\231\316\012", + "\205i\207\215iza\244d\226\252\250ce\312\203\232\357\206\231\367\353", + "\225\252lab\365:\344", + "\310\255 nam\345\012", + "\255 \215\221ad\224\333\312:\344", + "\303\322l\251u\200(n\202-\361\213t\235", + "\315a\273gn\233\201\303\322\227mp\370a\273gn\233t\012", + "\042b\221ak\355\242\042\313t\205ue\355\277ou\201\325\313t\250t\012", + "\301head\375\350ff\211\203from pro\271\261\264\012", + "\212 \376\375\042#if...\042\012", + "\310\274\334\307\267\361\213t\012", + "\310subscrip\201(\225\362\315\242\271o m\213\224subscripts):\344", + "\310\250\324\273\202\317\342sum\231z\211o\012", + "\321mpo\223\204\346e\233\201\225\357os\231a\201\237\200\214\204\325\335\370(\230\206t\231a\201l\205\200%d\235", + "\223k\212w\340\350\221c\207v\353", + "\315\205\232x ou\201\325bo\223d\203(\327\345\235", + "\315\303\322\205\232x\231(\327\345\235", + "\337do\331\225\364\252\232fa\320\201\251u\200(\337%d\235", + "\337\366\200mis\376 (\337%d\235", + "empt\224\346e\233t\012", + "\310\230r\375(po\273\245\224n\202-t\211m\205\226\231\230r\205g\235", + "\250t\240 \274\334\307\211\203\332l\205\353", + "\361\213\201\255 \304\203\212 \367\353", + "duplic\226\200\042c\342e\355lab\365 (\251u\200%d\235", + "\310\365lip\227s\317\315\367\200\277\225k\212wn\012", + "\310\321\236\205a\244\325\357\342\203s\264ci\335\211\262", + "\274\334\307\267\361\213\201\250ce\312\203r\213g\200f\242pack\231\230r\205g\012", + "po\227\216\363p\334\305t\211\203\303\324c\312\200\215l nam\231p\334\305t\211\262", + "\271o m\213\224\301\270t\262", + "\223k\212w\340\315\367\200(\327\345\235", + "\315\367\331do \225\376\317\242\232\230\205a\244\315\277\271o sm\215l\012", + "\315(\203do \225\376\012", + "\310l\205\200\313t\205ua\216\012", + "\310r\213g\353", + "\310subscript\317\241\200\042[ ]\355\352\226\222\203\332\311j\242\350\233\227\202\262", + "m\320\207-\350\233\227\202\363\260y\203\303\322f\320l\224\205i\207\215iz\312\012", + "\250ce\312\375\311ximum nu\236\267\325\350\233\227\202\262", + "\223\376\231\357os\375b\240c\200(\042}\042\235", + "\230\206\201\325\301bod\224\351\237ou\201\301head\211\012", + "\260ys\317loc\363\327\331\213\204\301\270t\203\263\322pu\245ic (\327\345\235", + "\223\272ish\231\250\324\273\332bef\222\200\321mpil\267\350\221c\207v\353", + "duplic\226\200\270t; sam\200\337\277p\342s\231t\351c\353", + "\301\337\311\224\225\364\252\232fa\320\201\251u\200(\327\345\235", + "m\320\207p\370\042#\365se\355\350\221c\207v\331betwe\214 \042#if ... #\214\350f\042\012", + "\042#\365seif\355\350\221c\207\336f\247low\203\362\042#\365se\355\350\221c\207v\353", + "nu\236\267\325\352\213d\203do\331\225\335\201\237\200\352\226\222\012", + "\301\221s\320\201\374\325\352\226\222\234 \303\322\220\012", + "\263\274\213g\200\324\333\231\352\226\222\262", + "\301\337\311\224\202l\224\364\252s\205g\370\374(\337%d\235", + "\301\337\311\224\225\322\252\221f\211\214c\200\337\242\362\315(\337\220\235", + "\327\200\263\322bo\373\252\221f\211\214c\200\213\204\362\315(\327\345\235", + "\310\240\216\363nu\236\267\324ci\227\332\372#p\240g\311\012", + "\240\216\363nu\236\267f\222\311\201\215\221ad\224\333\312\012", + "\240\216\363nu\236\267supp\222\201w\360\225\214\276\312\012", + "\241\211-\333\231\352\226\242\303\322\232\357\206\231bef\222\200\241\200(\371\234\235", + "\042\367e\306\355\352\226\242\277\310\332\042\371\355\255\262", + "\301\337\303\322\362\315(\337\220\235", + "#\333\200p\226t\211\340\303\230\206\201\351\373\362\215p\304be\207c \274\334\307\211\012", + "\205pu\201l\205\200\271o l\202\257(aft\267subs\207tu\216s\235", + "\253n\330x \211r\242\372\237\200\250\324\273\202\317\242\310\301c\215l\012", + "m\215f\222m\231UTF-8 \214\321d\205g\317\242c\222rupt\231\335le: \343", + "\301\241\331bo\373\042\221turn\355\213\204\042\221tur\340<\251ue>\042\012", + "\205\313\227\230\214\201\221tur\340\261\264\203(\315& n\202-\260y\235", + "\223k\212w\340\255\317\242\225\252\361\213\201\255 \356", + "\263\330k\200\252\374\360\252\232fa\320\201\251u\200f\242\362\205\232x\231\315p\334\305t\267\356", + "\241\211-\333\231\352\226\222\203\213\204na\207\336\371\203\311\224\225\364\346e\262", + "\252\301\242\327\200\311\224\202l\224b\365\202\257\271 \252s\205g\370au\271\347\332\356", + "\346\200\313fli\307: \202\200\325\237\200\346\331\277\215\221ad\224a\273gn\231\271 a\212\237\267imple\233\330\244\356", + "\212 \346\331\206\200\333\231f\242\316\012", + "\223k\212w\340au\271\347\202\344", + "\223k\212w\340\346\345 f\242au\271\347\202\344", + "pu\245ic \327\331\213\204loc\363\327\331\311\224\225\364\346\331\356", + "\346\200\327\331\311\224\225\322\205i\207\215iz\231\356", + "pu\245ic \371\203\311\224\225\221tur\340\260y\203\356", + "a\236i\265ou\203\361\213t; \374ov\211rid\200\277\221qui\221\204\356", + "nu\236\267\325\270t\203do\331\225\376 \333i\216\012", + "\250\264\307\231\374nam\200id\214\207\335\211\012", + "\301\214um\211a\244\221qui\221\203\223iqu\200\330g\012", + "\263\364\221qui\221\204p\334\305t\211\203aft\267\341\216\363p\334\305t\211\262", + "\321\320\204\225\272\204\305\236\211\234 \372\230ruc\201\220\012", + "\316 do\331\225\364\252\376\375\261\264\012", + "\366\345 sho\320\204\322\220 \372new-\230y\370\232\357\334\216\262", + "\314sho\320\204\225\364\362\250plici\201\221tur\340\261\264\012", + "\301pro\271\261\264\203do \225\376\012", + "s\264cif\224ei\237\267\215l \350\233\227\202\203\242\202l\224\237\200l\342\201\350\233\227\202\012", + "\263\272\204\314\343", + "\314w\360\215\221ad\224\333\231\332\237\277\343", + "\263\272\204\213\224\305\237od\203f\242\343", + "\263\272\204\305\237o\204\242pr\352t\224\210.\343", + "\263c\215l \305\237od\203\332\362\260y\012", + "\263c\215l \305\237od\203\332\252\371\012", + "\305\237o\204\303\364\252\335rs\201\337\321mpa\207\245\200\351\373\237\200\314\366\200(\210\235", + "\314nam\200\303\230\206\201\351\373\362upp\211c\342\200lett\211\012", + "\314\304\203\215\221ad\224be\214 \333\231(\324vio\241l\224se\214 \360\210\235", + "\250\264\307\231id\214\207\335\267- d\275you f\222ge\201\252\261\264?\012", + "\361ru\307\242\301\303\221tur\340\374\343", + "\263\333\200\361ru\307\242f\222\234; \215\221ad\224\250i\230\203\360\252\343", + "miss\375\261\264\317\242\314\303\364\237\200sam\200nam\200\360\314\220\012", + "\263\241\200\232lete\317\314\314\304\203\212 \232\230ru\307\222\012", + "\212 \305\237od\311p \242\357\342\203w\360fo\223\204f\242\343", + "\212 \232\230ru\307\242w\360fo\223\204f\242\314\343", + "\232\230ru\307\222\203\303\322na\207\336\371\262", + "\232\230ru\307\222\203\263\364\250t\240 \270t\262", + "\305\237od\311p \213\204\357\342\203\227gn\226u\221\203\303\241\200new-\230y\370\366\200\232\357\334\216\262", + "\263s\264cif\224\315\350\233\227\202\203\332bo\373\366\200\213\204na\305\012", + "\250\264\307\231\366\200\250\324\273\202\012", + "f\320ly-qu\215i\335\231nam\345 \277\271o l\202g\317wo\320\204\322tr\243\226\231\271\344", + "\223\250\264\307\231\271k\214\317\250\264\307\231\305\237o\204\242pr\352\261\012", + "\250\264\307\231\042na\207ve\355\242\042get\042\012", + "\314f\242\314\215\221ad\224\250i\230\262", + "pr\352t\224gett\211\203\263accep\201\250t\240 \270t\262", + "\314\303\364\237\200sam\200\221tur\340\366\200\360pr\352t\224\314(\210\235", + "\263mix \305\237od\311p\203\213\204\357\342s\331\351\373\205h\211it\213c\353", + "\263\321\211c\200\371\203\271 \251ue\262", + "\263\321\211c\200objec\201\366\200\314\271 n\202-objec\201\366\200\343", + "\263\321\211c\200n\202-objec\201\366\200\314\271 objec\201\366\200\343", + "\263\321\211c\200\223\221l\226\231objec\201\261\264\203\314\213\204\343", + "\366\200mis\376 (\314\213\204\210\235", + "\263\241\200\362objec\201\372\252m\320\207-\374s\365e\307\222\012", + "\260y\203\206\200\225supp\222t\231\360\221tur\340\261\264\262", + "\263mix \221f\211\214c\200\213\204\315\261\264\262", + "\313s\201w\360s\264ci\335\231t\351c\353", + "\321\320\204\225\272\204\366\345\012" #endif }; @@ -342,18 +347,18 @@ static char *fatalmsg[] = { /*170*/ "assertion failed: %s\n", /*171*/ "user error: %s\n", #else - "\267\222a\205from \341le:\345", - "\267writ\200\264 \341le:\345", - "t\275\200ov\211flow:\345", - "\204suf\341ci\213\201\312m\221y\012", - "\310\343sem\242\261\204\227ruc\216\345", - "n\234\211ic ov\211flow\316\247ce\305\372capaci\276\012", - "\320mpil\232scrip\201\247ce\305\203\375\311xim\234 \312m\221\224\366\200(%l\205bytes\235", - "\264o m\215\224\211r\240\312ssag\277\340\202\200l\204\337", - "\320\231pag\200\311pp\372\341\367\225fo\223d\012", - "\310p\226h:\345", - "\343s\211\243fail\305: \344", - "\237\261\211r\221: \344" + "\263\221a\204from \335le:\344", + "\263writ\200\271 \335le:\344", + "t\276\200ov\211flow:\344", + "\205suf\335ci\214\201\305m\222y\012", + "\310\342se\236l\267\205\230ruc\216\344", + "num\211ic ov\211flow\317\250ce\312\375capaci\261\012", + "\321mpil\231scrip\201\250ce\312\203\237\200\311ximum \305m\222\224\367\200(%l\204bytes\235", + "\271o m\213\224\211r\242\305ssag\331\332\202\200l\205\353", + "\321\232pag\200\311pp\375\335\370\225fo\223d\012", + "\310p\226h:\344", + "\342s\211\244fail\312: \343", + "\241\267\211r\222: \343" #endif }; @@ -397,43 +402,43 @@ static char *warnmsg[] = { /*235*/ "public function lacks forward declaration (symbol \"%s\")\n", /*236*/ "unknown parameter in substitution (incorrect #define pattern)\n" #else - "\315 \265tr\241\226\232\264 %\205\272\334\307\211\266", - "\222\333i\243\325\361\215t/\311cro \357", - "n\234b\261\325\263t\203do\277\225\374 \333i\216\012", - "\255 \265nev\261\237\305:\345", - "\255 \265a\270gn\232\245\250u\200\236a\201\265nev\261\237\305:\345", - "\222d\223d\215\201\320\231: \361\215\201\321\222\270\340\265z\211o\012", - "\222d\223d\215\201te\227: \361\215\201\321\222\270\340\265n\202-z\211o\012", - "\223k\212w\350#p\251g\311\012", - "\301\356\236 \373\222s\330\201\237\232bef\221\200\333i\216\316f\221c\372\222p\206s\337", - "\370\233 sho\330\205\222tur\350\245\250u\337", - "po\270\242\200\237\200\325\255 bef\221\200\204i\207\214iza\216:\345", - "po\270\242\224\223\204t\213\231\205a\270gn\331t\012", - "po\270\242\224\223\204t\213\231\205bit\356s\200\351a\216\012", - "\373mis\374\012", - "po\270\242\224\245\042\361\354\332\336w\376\204t\213\231d:\345", - "\321\222\270\340\304\203\212 effe\307\012", - "ne\227\232\320m\331t\012", - "loos\200\204d\213\317\216\012", - "ol\205\227y\367pro\264\313\277\237\232\356\236 \342\216\362semi\320l\234n\266", - "loc\362\327\352 s\304dow\203\245\327\200a\201\245p\222c\305\372lev\365\012", - "\321\222\270\340\356\236 \373ov\211rid\200\303appe\206 betwe\213 p\206\213\236ese\266", - "lab\365 nam\352 s\304dow\203\373na\312\012", - "n\234b\261\325\355git\203\247ce\305\203\251\216\362n\234b\261p\222ci\230\202\012", - "\222d\223d\215\201\042\366e\306\042: \336\366\200\265\214way\2031 \357", - "\204\231t\211m\204\226\200\332\366\200\371\042\366e\306\354\321\222\270\340\357", - "\223\222a\272\275\200\320\231\012", - "\245\327\200\265a\270gn\232\264 its\365f \357", - "m\221\200\204i\207\214iz\211\203\236\363\213\234 \341\365d\266", - "l\213g\236 \325\204i\207\214iz\261\247ce\305\203\366\200\325\375\213\234 \341\365d\012", - "\204\231x \373mis\374 \357", - "\212 imple\331\317\243f\240\346\352 \371\370\233\316\212 f\214l-back\012", - "\346\200speci\341ca\243\340f\221w\206\205\231\360\334\243\265ig\212\222d\012", - "outpu\201\341\367\265writt\213\316bu\201\356\236 \320mpac\201\213\320d\372\355s\275\305\012", - "\346\200\327\352 s\304dow\203\245glob\362\327\337", - "\315 \265m\206k\232\376\231p\222c\226\305: \344", - "pu\242ic \301lack\203f\221w\206\205\231\360\334\243\357", - "\223k\212w\350p\334\312t\261\371subs\207tu\243(\204c\221\222c\201#\333\200p\226t\211n\235" + "\316 \277tr\243\226\231\271 %\204\274\334\307\211\262", + "\221\333i\244\325\361\213t/\311cro \356", + "nu\236\267\325\270t\203do\331\225\376 \333i\216\012", + "\255 \277nev\267\241\312:\344", + "\255 \277a\273gn\231\252\251u\200\237a\201\277nev\267\241\312:\344", + "\221d\223d\213\201\321\232: \361\213\201\250\324\273\332\277z\211o\012", + "\221d\223d\213\201te\230: \361\213\201\250\324\273\332\277n\202-z\211o\012", + "\223k\212w\340#p\240g\311\012", + "\301\351\373\374\221s\320\201\241\231bef\222\200\333i\216\317f\222c\375\221p\206s\353", + "\371\234 sho\320\204\221tur\340\252\251u\353", + "po\273\245\200\241\200\325\255 bef\222\200\205i\207\215iza\216:\344", + "po\273\245\224\223\205t\214d\231a\273gn\233t\012", + "po\273\245\224\223\205t\214d\231bit\351s\200\352a\216\012", + "\374mis\376\012", + "po\273\245\224\252\042\361\355\315\337w\360\205t\214\232d:\344", + "\250\324\273\332\304\203\212 effe\307\012", + "ne\230\231\321m\233t\012", + "loos\200\205d\214\330\216\012", + "\247\204\230y\370pro\271\261\264\203\241\231\351\373\341\216\363semic\247umn\262", + "loc\363\327\345 s\304dow\203\252\327\200a\201\252\324c\312\375lev\365\012", + "\250\324\273\332\351\373\374ov\211rid\200\303ap\264\206 betwe\214 p\206\214\237ese\262", + "lab\365 nam\345 s\304dow\203\374na\305\012", + "nu\236\267\325\350git\203\250ce\312\203\240\216\363nu\236\267\324ci\227\202\012", + "\221d\223d\213\201\042\367e\306\042: \337\367\200\277\215way\2031 \356", + "\205\232t\211m\205\226\200\315\367\200\372\042\367e\306\355\250\324\273\332\356", + "\223\221a\274\276\200\321\232\012", + "\252\327\200\277a\273gn\231\271 its\365f \356", + "m\222\200\205i\207\215iz\211\203\237\362\214um \335\365d\262", + "l\214g\373\325\205i\207\215iz\267\250ce\312\203\367\200\325\237\200\214um \335\365d\012", + "\205\232x \374mis\376 \356", + "\212 imple\233\330\244f\242\346\345 \372\371\234\317\212 f\215l-back\012", + "\346\200s\264ci\335ca\244\332f\222w\206\204\232\357\334\244\277ig\212\221d\012", + "outpu\201\335\370\277writt\214\317bu\201\351\373\321mpac\201\214\321d\375\350s\276\312\012", + "\346\200\327\345 s\304dow\203\252glob\363\327\353", + "\316 \277m\206k\231\360\232\324c\226\312: \343", + "pu\245ic \301lack\203f\222w\206\204\232\357\334\244\356", + "\223k\212w\340p\334\305t\267\372subs\207tu\244(\205c\222\221c\201#\333\200p\226t\211n\235" #endif }; diff --git a/sourcepawn/compiler/tests/ok-new-decl-args.sp b/sourcepawn/compiler/tests/ok-new-decl-args.sp new file mode 100644 index 00000000..79d813ca --- /dev/null +++ b/sourcepawn/compiler/tests/ok-new-decl-args.sp @@ -0,0 +1,34 @@ +stock A(int n) +{ +} + +stock B(int n[]) +{ +} + +stock C(int[] n) +{ +} + +enum E1: { +} +enum E2 { +} + +stock D(E1 t) +{ +} + +stock E(E2 t) +{ +} + +public main() +{ + new x[10] + A(1) + B(x) + C(x) + D(E1:5) + E(E2:5) +}