Merge pull request #88 from alliedmodders/bug-6175

Fix and formalize newline and semicolon behavior in methodmaps. (bug 6175)
This commit is contained in:
David Anderson 2014-07-12 20:45:35 -07:00
commit cd6997cd0b
9 changed files with 339 additions and 247 deletions

View File

@ -168,8 +168,8 @@ methodmap StringMap < Handle {
public Clear() = ClearTrie;
property int Size {
public get() = GetTrieSize;
};
};
}
}
/**
* Creates a snapshot of all keys in the map. If the map is changed after this

View File

@ -82,7 +82,7 @@ methodmap Handle __nullable__
{
public Clone() = CloneHandle;
public ~Handle() = CloseHandle;
};
}
/**
* Do not use this function. Returns if a Handle and its contents

View File

@ -598,7 +598,7 @@ methodmap Menu < Handle {
return GetMenuSelectionPosition();
}
}
};
}
/**
* Returns the number of seconds you should "wait" before displaying

View File

@ -463,6 +463,7 @@ enum {
tEXPR, /* for assigment to "lastst" only (see SC1.C) */
tENDLESS, /* endless loop, for assigment to "lastst" only */
tEMPTYBLOCK, /* empty blocks for AM bug 4825 */
tEOL, /* newline, only returned by peek_new_line() */
tLAST_TOKEN_ID
};
@ -648,6 +649,8 @@ SC_FUNC int matchtoken2(int id, token_t *tok);
SC_FUNC int expecttoken(int id, token_t *tok);
SC_FUNC int matchsymbol(token_ident_t *ident);
SC_FUNC int needsymbol(token_ident_t *ident);
SC_FUNC int peek_same_line();
SC_FUNC int require_newline(int allow_semi);
SC_FUNC void litadd(cell value);
SC_FUNC void litinsert(cell value,int pos);
SC_FUNC int alphanum(char c);

View File

@ -3769,12 +3769,11 @@ int parse_property_accessor(const typeinfo_t *type, methodmap_t *map, methodmap_
error(150, pc_tagname(type->tag));
return FALSE;
}
if (target->tag != pc_tag_void)
error(151);
}
needtoken(tTERM);
require_newline(is_bind || (target->usage & uNATIVE));
return TRUE;
}
@ -3796,16 +3795,13 @@ methodmap_method_t *parse_property(methodmap_t *map)
method->getter = NULL;
method->setter = NULL;
if (!matchtoken(tTERM)) {
if (!needtoken('{'))
return method;
if (matchtoken('{')) {
while (!matchtoken('}')) {
if (!parse_property_accessor(&type, map,method))
lexclr(TRUE);
}
needtoken(tTERM);
require_newline(FALSE);
}
return method;
@ -3967,17 +3963,14 @@ methodmap_method_t *parse_method(methodmap_t *map)
// If the symbol is a constructor, we bypass the initial argument checks.
if (is_ctor) {
define_constructor(map, method);
return method;
}
if (!check_this_tag(map, target)) {
} else if (!check_this_tag(map, target)) {
error(108, spectype, map->name);
return method;
}
if (is_dtor)
map->dtor = method;
require_newline(is_bind || (target->usage & uNATIVE));
return method;
}
@ -4070,8 +4063,6 @@ static void domethodmap(LayoutSpec spec)
continue;
}
needtoken(tTERM);
methods = (methodmap_method_t **)realloc(map->methods, sizeof(methodmap_method_t *) * (map->nummethods + 1));
if (!methods) {
error(163);
@ -4081,7 +4072,7 @@ static void domethodmap(LayoutSpec spec)
map->methods[map->nummethods++] = method;
}
needtoken(tTERM);
require_newline(TRUE);
}
// delete ::= "delete" expr

View File

@ -1922,7 +1922,7 @@ static full_token_t *current_token()
return &sTokenBuffer->tokens[sTokenBuffer->cursor];
}
static full_token_t *last_token()
static full_token_t *next_token()
{
assert(sTokenBuffer->depth > 0);
int cursor = sTokenBuffer->cursor + 1;
@ -1971,7 +1971,7 @@ char *sc_tokens[] = {
"-label-", "-string-"
};
static full_token_t *next_token_ptr()
static full_token_t *advance_token_ptr()
{
assert(sTokenBuffer->depth == 0);
sTokenBuffer->num_tokens++;
@ -1989,6 +1989,17 @@ static void preprocess_in_lex()
sTokenBuffer = &sNormalBuffer;
}
// Pops a token off the token buffer, making it the current token.
static void lexpop()
{
assert(sTokenBuffer->depth > 0);
sTokenBuffer->depth--;
sTokenBuffer->cursor++;
if (sTokenBuffer->cursor == MAX_TOKEN_DEPTH)
sTokenBuffer->cursor = 0;
}
SC_FUNC int lex(cell *lexvalue,char **lexsym)
{
int i,toolong,newline;
@ -1996,16 +2007,13 @@ SC_FUNC int lex(cell *lexvalue,char **lexsym)
const unsigned char *starttoken;
if (sTokenBuffer->depth > 0) {
sTokenBuffer->depth--;
sTokenBuffer->cursor++;
if (sTokenBuffer->cursor == MAX_TOKEN_DEPTH)
sTokenBuffer->cursor = 0;
lexpop();
*lexvalue = current_token()->value;
*lexsym = current_token()->str;
return current_token()->id;
}
full_token_t *tok = next_token_ptr();
full_token_t *tok = advance_token_ptr();
tok->id = 0;
tok->value = 0;
tok->str[0] = '\0';
@ -2042,6 +2050,9 @@ SC_FUNC int lex(cell *lexvalue,char **lexsym)
stmtindent++;
} /* if */
tok->start.line = fline;
tok->start.col = (int)(lptr - pline);
i=tFIRST;
tokptr=sc_tokens;
while (i<=tMIDDLE) { /* match multi-character operators */
@ -2049,6 +2060,8 @@ SC_FUNC int lex(cell *lexvalue,char **lexsym)
tok->id = i;
if (pc_docexpr) /* optionally concatenate to documentation string */
insert_autolist(*tokptr);
tok->end.line = fline;
tok->end.col = (int)(lptr - pline);
return tok->id;
} /* if */
i+=1;
@ -2060,6 +2073,8 @@ SC_FUNC int lex(cell *lexvalue,char **lexsym)
errorset(sRESET,0); /* reset error flag (clear the "panic mode")*/
if (pc_docexpr) /* optionally concatenate to documentation string */
insert_autolist(*tokptr);
tok->end.line = fline;
tok->end.col = (int)(lptr - pline);
return tok->id;
} /* if */
i+=1;
@ -2227,6 +2242,8 @@ SC_FUNC int lex(cell *lexvalue,char **lexsym)
free(docstr);
} /* if */
} /* if */
tok->end.line = fline;
tok->end.col = (int)(lptr - pline);
return tok->id;
}
@ -2294,19 +2311,23 @@ SC_FUNC int matchtoken(int token)
char *str;
int tok;
tok=lex(&val,&str);
if (tok==token || (token==tTERM && (tok==';' || tok==tENDEXPR))) {
tok = lex(&val, &str);
if (token == tok)
return 1;
} else if (!sc_needsemicolon && token==tTERM && (_lexnewline || !freading)) {
if (token==tTERM && (tok==';' || tok==tENDEXPR))
return 1;
if (!sc_needsemicolon && token==tTERM && (_lexnewline || !freading)) {
/* Push "tok" back, because it is the token following the implicit statement
* termination (newline) token.
*/
lexpush();
return 2;
} else {
lexpush();
return 0;
} /* if */
}
lexpush();
return 0;
}
/* tokeninfo
@ -2347,15 +2368,66 @@ SC_FUNC int needtoken(int token)
strcpy(s1,sc_tokens[token-tFIRST]); /* multi-character symbol */
if (!freading)
strcpy(s2,"-end of file-");
else if (last_token()->id < 256)
sprintf(s2,"%c",(char)last_token()->id);
else if (next_token()->id < 256)
sprintf(s2,"%c",(char)next_token()->id);
else
strcpy(s2, sc_tokens[last_token()->id - tFIRST]);
strcpy(s2, sc_tokens[next_token()->id - tFIRST]);
error(1,s1,s2); /* expected ..., but found ... */
return FALSE;
} /* if */
}
// If the next token is on the current line, return that token. Otherwise,
// return tNEWLINE.
SC_FUNC int peek_same_line()
{
// We should not call this without having parsed at least one token.
assert(sTokenBuffer->num_tokens > 0);
// If there's tokens pushed back, then |fline| is the line of the furthest
// token parsed. If fline == current token's line, we are guaranteed any
// buffered token is still on the same line.
if (sTokenBuffer->depth > 0 && current_token()->end.line == fline)
return next_token()->id;
// Make sure the next token is lexed by lexing, and then buffering it.
full_token_t *next;
{
token_t tmp;
lextok(&tmp);
next = current_token();
lexpush();
}
// If the next token starts on the line the last token ends, then the next
// token is considered on the same line.
if (next->start.line == current_token()->end.line)
return next->id;
return tEOL;
}
SC_FUNC int require_newline(int allow_semi)
{
if (allow_semi) {
// Semicolon must be on the same line.
if (peek_same_line() == ';')
lexpop();
}
int tokid = peek_same_line();
if (tokid == tEOL || tokid == 0)
return TRUE;
char s[20];
if (tokid < 256)
sprintf(s, "%c", (char)tokid);
else
strcpy(s, sc_tokens[tokid - tFIRST]);
error(155, s);
return FALSE;
}
/* match
*
* Compares a series of characters from the input file with the characters
@ -2898,7 +2970,6 @@ SC_FUNC void markusage(symbol *sym,int usage)
} /* if */
}
/* findglb
*
* Returns a pointer to the global symbol (if found) or NULL (if not found)

View File

@ -32,13 +32,13 @@ SC_FUNC int strexpand(char *dest, unsigned char *source, int maxlen, unsigned ch
/*-*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}, {100,32}, {105,110}, {97,114}, {116,105}, {101,114}, {37,115}, {110,111}, {97,110}, {135,130}, {114,101}, {101,110}, {97,108},
{117,110}, {111,114}, {34,137}, {146,34}, {121,32}, {138,129}, {115,105}, {115,116}, {100,101}, {97,116}, {101,132}, {109,142}, {32,147}, {116,104}, {41,10}, {109,98},
{117,115}, {114,97}, {144,99}, {145,32}, {98,108}, {162,140}, {102,165}, {101,120}, {97,32}, {116,121}, {99,139}, {118,143}, {111,108}, {169,112}, {170,149}, {115,121},
{175,159}, {136,32}, {134,161}, {176,172}, {115,10}, {103,32}, {116,111}, {115,150}, {103,117}, {105,132}, {184,155}, {134,186}, {101,131}, {160,129}, {97,164}, {109,189},
{102,133}, {101,10}, {44,32}, {171,185}, {99,104}, {105,131}, {166,32}, {133,195}, {104,97}, {111,102}, {117,108}, {99,116}, {98,128}, {97,140}, {178,148}, {110,32},
{109,97}, {101,100}, {99,111}, {167,112}, {99,130}, {37,131}, {118,134}, {179,156}, {201,32}, {105,190}, {214,217}, {109,101}, {111,112}, {137,10}, {130,32}, {99,108},
{118,128}, {187,129}, {152,192}, {102,105}, {119,105}, {97,131}, {173,128}, {220,136}, {116,97}, {100,105}, {97,115}, {108,128}, {156,10}, {109,153}, {151,153}, {218,128},
{139,132}, {215,158}, {200,224}, {40,241}, {116,117}, {150,122}, {212,151}, {34,32}, {133,32}, {138,32}, {139,32}, {143,32}, {157,32}, {133,181}, {110,97}
{117,110}, {111,114}, {34,137}, {146,34}, {121,32}, {138,129}, {115,105}, {115,116}, {101,132}, {97,116}, {100,101}, {109,142}, {32,147}, {116,104}, {41,10}, {109,98},
{117,115}, {114,97}, {144,99}, {145,32}, {98,108}, {162,140}, {102,165}, {101,120}, {97,32}, {116,121}, {99,139}, {118,143}, {112,101}, {111,108}, {170,149}, {115,121},
{175,159}, {136,32}, {134,161}, {176,173}, {115,10}, {103,32}, {116,111}, {115,150}, {103,117}, {105,132}, {184,155}, {134,186}, {160,129}, {44,32}, {97,164}, {109,188},
{102,133}, {171,185}, {99,104}, {99,116}, {105,131}, {166,32}, {133,193}, {104,97}, {111,102}, {117,108}, {98,128}, {109,101}, {97,140}, {178,148}, {110,32}, {109,97},
{101,100}, {99,111}, {101,131}, {99,130}, {37,131}, {118,134}, {112,141}, {179,156}, {200,32}, {105,190}, {213,217}, {111,112}, {137,10}, {130,32}, {99,108}, {118,128},
{187,129}, {154,192}, {102,105}, {119,105}, {112,128}, {97,131}, {219,136}, {169,172}, {116,97}, {115,101}, {169,228}, {100,105}, {108,128}, {156,10}, {109,153}, {151,153},
{218,128}, {139,132}, {215,158}, {199,223}, {97,115}, {40,242}, {116,117}, {150,122}, {101,10}, {211,151}, {34,32}, {133,32}, {138,32}, {139,32}, {143,32}
};
/*-*SCPACK end of pair table, do not change or remove this line */
@ -198,161 +198,163 @@ static char *errmsg[] = {
/*152*/ "no setter found for property %s\n",
/*153*/ "cannot use non-public functions as callbacks\n",
/*154*/ "cannot assign INVALID_FUNCTION to a non-function type\n",
/*155*/ "expected newline, but found '%s'\n",
#else
"\323e\313\232\266k\216:\234\302bu\201fo\220\204\223\012",
"\202l\224\250s\205g\353\356e\233\201(\243\323\215\267\202) \252 f\254low ea\304 \042c\352e\042\012",
"\230\337\206\315 \330\250loc\373\357\277appe\206 \370\250\322mpo\220\204\244ock\012",
"\246\234 \305\225imple\233t\321\012",
"\306\320\224\225\362\273t\264",
"\277\314a\267gn\232\266 \372\262y\012",
"\347\231\243\256\314\215\342\321\012",
"\277\314\250\366\213\201\323\215\267\202; \352sum\232z\210o\012",
"\307\316\365\200(nega\207ve\302z\210o \243ou\201\330bo\220ds\236",
"\307\306\243\230\337\206\315\012",
"\307out\226d\200\246\264",
"\307\306c\217l\302\225\250\303add\215s\264",
"\371\216tr\224po\205\201(\371pu\244ic \246s\236",
"\307\356e\233t; \225\370s\344t\304\012",
"\042\230fa\312t\367c\352\200\277\314\235\200l\352\201c\352\200\370s\344t\304 \356e\233t\012",
"m\312\207p\353\230fa\312t\203\370\042s\344t\304\042\012",
"\220\342\232\327\012",
"\205i\207\217iz\315 d\231\250\247ce\321\203\230\337\206\232\365\301",
"\225\250label:\354",
"\307\263 \376m\200\223\012",
"\263 \217\215ad\224\342\321:\354",
"\277\314l\253u\200(n\202-\366\213t\236",
"\316a\267gn\233\201\277\314\226mp\353a\267gn\233t\012",
"\042b\215ak\367\243\042\324t\205ue\367\305ou\201\330\324t\247t\012",
"\306head\375\351ff\210\203from pro\266\255\301",
"\371\355\304\375\042#if...\042\012",
"\307\304\206a\313\261\366\213t\012",
"\307subscrip\201(\225\372\316\243\266o m\213\224subscripts):\354",
"\307\323\215\267\202\302\352sum\232z\210o\012",
"\322mpo\220\204\356e\233\201\225\337os\232a\201\235\200\216\204\330\343\353(\227\206t\232a\201l\205\200%d\236",
"\220k\212w\317\351\215c\207v\301",
"\316\205\230x ou\201\330bo\220d\203(\357\223\236",
"\316\277\314\205\230x\232(\357\223\236",
"\341do\274\225\362\250\230fa\312\201\253u\200(\341%d\236",
"\341\346mis\355\304 (\341%d\236",
"empt\224\356e\233t\012",
"\307\227r\375(po\267\244\224n\202-t\210m\205\231\232\227r\205g\236",
"\247t\241 \304\206a\313\210\203\336l\205\301",
"\366\213\201\263 \310\203\371\365\301",
"duplic\231\200\042c\352e\367label (\253u\200%d\236",
"\307ellip\226s\302\316\365\200\305\225k\212wn\012",
"\307\322\237\205\315 \330\337\352\203speci\343\210\264",
"\304\206a\313\261\366\213\201\247ce\321\203r\213g\200f\243pack\232\227r\205g\012",
"po\226\214\373p\206a\333t\210\203\277p\215c\321\200\217l \376m\232p\206a\333t\210\264",
"\266o m\213\224\306\273t\264",
"\220k\212w\317\316\365\200(\357\223\236",
"\316\365\274do \225\355\304\302\243\230\227\205\315 \316\305\266o sm\217l\012",
"\316(\203do \225\355\304\012",
"\307l\205\200\324t\205u\315\012",
"\307r\213g\301",
"\307subscript\302\240\200\042[ ]\367\347\231\221\203\336\320j\243\351\233\226\202\264",
"m\312\207-\351\233\226\202\373\262y\203\277\314f\312l\224\205i\207\217iz\321\012",
"\247ce\321\375\320ximum nu\237\261\330\351\233\226\202\264",
"\220\355\304\232\337os\375b\241c\200(\042}\042\236",
"\227\206\201\330\306bod\224\344\235ou\201\306head\210\012",
"\262ys\302loc\373\332\274\360\306\273t\203\256\314pu\244ic (\357\223\236",
"\220\300ish\232\323\215\267\336bef\221\200\322mpil\261\351\215c\207v\301",
"duplic\231\200\273t; sam\200\341\305p\352s\232t\344c\301",
"\306\341\320\224\225\362\250\230fa\312\201\253u\200(\357\223\236",
"m\312\207p\353\042#else\367\351\215c\207v\274betwe\216 \042#if ... #\216\351f\042\012",
"\042#elseif\367\351\215c\207\340f\254low\203\372\042#else\367\351\215c\207v\301",
"nu\237\261\330\347\213d\203do\274\225\343\201\235\200\347\231\221\012",
"\306\215s\312\201\350\265\330\347\231\221\234 \277\314\223\012",
"\256\304\213g\200p\215\342\232\347\231\221\264",
"\306\341\320\224\202l\224\362\250s\205g\353\350\265(\341%d\236",
"\306\341\320\224\225\314\250\215f\210\216c\200\341\243\372\316(\341\223\236",
"\357\256\314bo\374\250\215f\210\216c\200\360\372\316(\357\223\236",
"\307\241\214\373nu\237\261p\215ci\226\336\370#p\241g\320\012",
"\241\214\373nu\237\261f\221\320\201\217\215ad\224\342\321\012",
"\241\214\373nu\237\261supp\221\201w\345\225\216\276\321\012",
"\240\210-\342\232\347\231\243\277\314\230\337\206\232bef\221\200\240\200(\246\234\236",
"\042\365e\311\367\347\231\243\305\307\336\042\246\367\263\264",
"\306\341\277\314\372\316(\341\223\236",
"#\342\200p\231t\210\317\277\227\206\201\344\374\372\217p\310be\207c \304\206a\313\210\012",
"\205pu\201l\205\200\266o l\202\265(aft\261subs\207\364\214s\236",
"\257n\350x \210r\243\370\235\200\323\215\267\202\302\243\307\306c\217l\012",
"m\217f\221m\232UTF-8 \216\322d\205g\302\243c\221rupt\232\343le: \335",
"\306\240\274bo\374\042\215\364rn\367\360\042\215\364r\317<\253ue>\042\012",
"\205\324\226\227\216\201\215\364r\317\255\274(\316& n\202-\262y\236",
"\220k\212w\317\263\302\243\225\250\366\213\201\263 \363",
"\256\350k\200\250\350\265\345\250\230fa\312\201\253u\200f\243\372\205\230x\232\316p\206a\333t\261\363",
"\240\210-\342\232\347\231\221\203\360\376\207\340\246\203\320\224\225\362\356e\264",
"\250\306\243\357\320\224\202l\224bel\202\265\266 \250s\205g\353au\266\355\336\363",
"\356\200\324fli\313: \202\200\330\235\200\356\274\305\217\215ad\224a\267gn\232\266 a\212\235\261imple\233t\315 \363",
"\371\356\274\206\200\342\232f\243\327\012",
"\220k\212w\317au\266\355\202\354",
"\220k\212w\317\356\200\223 f\243au\266\355\202\354",
"pu\244ic \332\274\360loc\373\332\274\320\224\225\362\356\274\363",
"\356\200\332\274\320\224\225\314\205i\207\217iz\232\363",
"pu\244ic \246\203\320\224\225\215\364r\317\262y\203\363",
"a\237i\270ou\203\366\213t; \350\265ov\210rid\200\305\215qui\215\204\363",
"nu\237\261\330\273t\203do\274\225\355\304 \342i\214\012",
"\323e\313\232\350\265\376m\200id\216\207\343\210\012",
"\306\216um\210\315 \215qui\215\203\220iqu\200\350g\012",
"\256\362\215qui\215\204p\206a\333t\210\203aft\261\334\214\373p\206a\333t\210\264",
"\322\312\204\225\300\204\333\237\210\234 \370\227ruc\201\223\012",
"\327 do\274\225\362\250\355\304\375\255\301",
"\346\223 sho\312\204\314\223 \370new-\227y\353\230\337\206\315\264",
"\325sho\312\204\225\362\372\323lici\201\215\364r\317\255\301",
"\306pro\266\255\274do \225\355\304\012",
"specif\224ei\235\261\217l \351\233\226\202\203\243\202l\224\235\200l\352\201\351\233\226\202\012",
"\256\300\204\325\335",
"\325w\345\217\215ad\224\342\232\336\235\305\335",
"\256\300\204\213\224\333\235od\203f\243\335",
"\256\300\204\333\235o\204\243pr\347t\224\211.\335",
"\256c\217l \333\235od\203\336\372\262y\012",
"\256c\217l \333\235od\203\336\250\246\012",
"\333\235o\204\277\362\250\343rs\201\341\322mpa\207\244\200\344\374\235\200\325\346(\211\236",
"\325\376m\200\277\227\206\201\344\374\372upp\210c\352\200lett\210\012",
"\325\310\203\217\215ad\224be\216 \342\232(p\215vio\240l\224se\216 \345\211\236",
"\323e\313\232id\216\207\343\261- d\271you f\221ge\201\250\255e?\012",
"\366ru\313\243\306\277\215\364r\317\350\265\335",
"\256\342\200\366ru\313\243f\221\234; \217\215ad\224\247i\227\203\345\250\335",
"miss\375\255e\302\243\325\277\362\235\200sam\200\376m\200\345\325\223\012",
"\256\240\200\230lete\302\325\325\310\203\371\230\227ru\313\221\012",
"\371\333\235od\320p \243\337\352\203w\345fo\220\204f\243\335",
"\371\230\227ru\313\243w\345fo\220\204f\243\325\335",
"\230\227ru\313\221\203\277\314\376\207\340\246\264",
"\230\227ru\313\221\203\256\362\247t\241 \273t\264",
"\333\235od\320p \360\337\352\203\226gn\231u\215\203\277\240\200new-\227y\353\346\230\337\206\315\264",
"\256specif\224\316\351\233\226\202\203\336bo\374\346\360\376m\301",
"\323e\313\232\346\323\215\267\202\012",
"f\312ly-qu\217i\343\232\376m\200\223 \305\266o l\202g\302wo\312\204\314tr\242\231\232\266\354",
"\220\323e\313\232\266k\216\302\323e\313\232\333\235o\204\243pr\347\251\012",
"\323e\313\232\042\376\207ve\042\302\042get\042\302\243\042set\042\012",
"\325f\243\325\217\215ad\224\247i\227\264",
"pr\347t\224gett\210\203\256accep\201\247t\241 \273t\264",
"\325\277\362\235\200sam\200\215\364r\317\346\345pr\347t\224\325(\211\236",
"\256mix \333\235od\320p\203\360\337\352s\274\344\374\205h\210it\213c\301",
"\256\322\210c\200\246\203\266 \253ue\264",
"\256\322\210c\200objec\201\346\325\266 n\202-objec\201\346\335",
"\256\322\210c\200n\202-objec\201\346\325\266 objec\201\346\335",
"\256\322\210c\200\220\215l\231\232objec\201\255\274\325\360\335",
"\346mis\355\304 (\325\360\211\236",
"\256\240\200\372objec\201\370\250m\312\207-\350\265sele\313\221\012",
"\262y\203\206\200\225supp\221t\232\345\215\364r\317\255e\264",
"\256mix \215f\210\216c\200\360\316\255e\264",
"\324s\201w\345speci\343\232t\344c\301",
"\322\312\204\225\300\204\346\223\012",
"new-\227y\353\316\255\274\256specif\224\351\233\226\336\365\274\345p\206\201\330\235eir \255\301",
"\376\207ves\302f\221w\206ds\302\360pu\244ic \246\203\256\215\364r\317\262y\264",
"\307\346\230\337\206\315\012",
"new-\227y\353\230\337\206\315\203sho\312\204\225\362\042new\042\012",
"vo\271\256\314\240\232\345\250\357\255\301",
"\307\346\323\215\267\202\012",
"#p\241gm\250new\230\337\203\277\314\215qui\215\204\243\334\214\217\012",
"new-\227y\353\230\337\206\315\203\206\200\215qui\215d\012",
"\256a\267g\317n\312l \266 \250n\202-n\312l\276\200\255\301",
"\371gett\261fo\220\204f\243pr\347t\224\335",
"sett\261\277\350k\200\247a\313l\224\202\200\247t\241 \341\344\374\346\335",
"sett\261\277\215\364r\317void\012",
"\371sett\261fo\220\204f\243pr\347t\224\335",
"\247\254\303\230\266k\216:\234\275bu\201fo\220\204\223\012",
"\202l\224\250s\205g\354\357e\233\201(\243\247\326\267\202) \252 f\255low ea\302 \042ca\351\042\012",
"\232\336\206\314 \330\250loc\376\360\277ap\254\206 \373\250\321mpo\220\204\244ock\012",
"\246\234 \304\225imple\233t\320\012",
"\305\317\224\225\363\273t\264",
"\277\312a\267gn\230\266 \375\262y\012",
"\346\231\243\256\312\215\341\320\012",
"\277\312\250\371\213\201\247\326\267\202; \364sum\230z\210o\012",
"\306\315\367\200(nega\207ve\275z\210o \243ou\201\330bo\220ds\236",
"\306\305\243\232\336\206\314\012",
"\306out\226d\200\246\264",
"\306\305c\217l\275\225\250\301add\215s\264",
"\374\216tr\224po\205\201(\374pu\244ic \246s\236",
"\306\357e\233t; \225\373s\343t\302\012",
"\042\232fa\311t\372c\364\200\277\312\235\200l\364\201c\364\200\373s\343t\302 \357e\233t\012",
"m\311\207p\354\232fa\311t\203\373\042s\343t\302\042\012",
"\220\341\230\327\012",
"\205i\207\217iz\314 d\231\250\247ce\320\203\232\336\206\230\367\370",
"\225\250label:\355",
"\306\263 nam\200\223\012",
"\263 \217\215ad\224\341\320:\355",
"\277\312l\253u\200(n\202-\371\213t\236",
"\315a\267gn\233\201\277\312\226mp\354a\267gn\233t\012",
"\042b\215ak\372\243\042\323t\205ue\372\304ou\201\330\323t\247t\012",
"\305head\205\265\353ff\210\203from pro\266\347\012",
"\374\356\302\205\265\042#if...\042\012",
"\306\302\206a\303\261\371\213t\012",
"\306subscrip\201(\225\375\315\243\266o m\213\224subscripts):\355",
"\306\247\326\267\202\275\364sum\230z\210o\012",
"\321mpo\220\204\357e\233\201\225\336os\230a\201\235\200\216\204\330\342\354(\227\206t\230a\201l\205\200%d\236",
"\220k\212w\316\353\215c\207v\370",
"\315\205\232x ou\201\330bo\220d\203(\360\223\236",
"\315\277\312\205\232x\230(\360\223\236",
"\340do\322\225\363\250\232fa\311\201\253u\200(\340%d\236",
"\340\352mis\356\302 (\340%d\236",
"empt\224\357e\233t\012",
"\306\227r\205\265(po\267\244\224n\202-t\210m\205\231\230\227r\205g\236",
"\247t\241 \302\206a\303\210\203\335l\205\370",
"\371\213\201\263 \307\203\374\367\370",
"duplic\231\200\042ca\351\372label (\253u\200%d\236",
"\306ellip\226s\275\315\367\200\304\225k\212wn\012",
"\306\321\237\205\314 \330\336\364\203s\254ci\342\210\264",
"\302\206a\303\261\371\213\201\247ce\320\203r\213g\200f\243pack\230\227r\205g\012",
"po\226\214\376p\206a\313t\210\203\277\326c\320\200\217l nam\230p\206a\313t\210\264",
"\266o m\213\224\305\273t\264",
"\220k\212w\316\315\367\200(\360\223\236",
"\315\367\322do \225\356\302\275\243\232\227\205\314 \315\304\266o sm\217l\012",
"\315(\203do \225\356\302\012",
"\306l\205\200\323t\205u\314\012",
"\306r\213g\370",
"\306subscript\275\240\200\042[ ]\372\346\231\221\203\335\317j\243\353\233\226\202\264",
"m\311\207-\353\233\226\202\376\262y\203\277\312f\311l\224\205i\207\217iz\320\012",
"\247ce\320\205\265\317ximum nu\237\261\330\353\233\226\202\264",
"\220\356\302\230\336os\205\265b\241c\200(\042}\042\236",
"\227\206\201\330\305bod\224\343\235ou\201\305head\210\012",
"\262ys\275loc\376\332\322\361\305\273t\203\256\312pu\244ic (\360\223\236",
"\220\300ish\230\247\326\267\335bef\221\200\321mpil\261\353\215c\207v\370",
"duplic\231\200\273t; sam\200\340\304p\364s\230t\343c\370",
"\305\340\317\224\225\363\250\232fa\311\201\253u\200(\360\223\236",
"m\311\207p\354\042#el\351\372\353\215c\207v\322betwe\216 \042#if ... #\216\353f\042\012",
"\042#el\351if\372\353\215c\207\337f\255low\203\375\042#el\351\372\353\215c\207v\370",
"nu\237\261\330\346\213d\203do\322\225\342\201\235\200\346\231\221\012",
"\305\215s\311\201\350\265\330\346\231\221\234 \277\312\223\012",
"\256\302\213g\200\326\341\230\346\231\221\264",
"\305\340\317\224\202l\224\363\250s\205g\354\350\265(\340%d\236",
"\305\340\317\224\225\312\250\215f\210\216c\200\340\243\375\315(\340\223\236",
"\360\256\312bo\235 \250\215f\210\216c\200\361\375\315(\360\223\236",
"\306\241\214\376nu\237\261\326ci\226\335\373#p\241g\317\012",
"\241\214\376nu\237\261f\221\317\201\217\215ad\224\341\320\012",
"\241\214\376nu\237\261supp\221\201w\345\225\216\276\320\012",
"\240\210-\341\230\346\231\243\277\312\232\336\206\230bef\221\200\240\200(\246\234\236",
"\042\367e\310\372\346\231\243\304\306\335\042\246\372\263\264",
"\305\340\277\312\375\315(\340\223\236",
"#\341\200p\231t\210\316\277\227\206\201\343\235 \375\217p\307be\207c \302\206a\303\210\012",
"\205pu\201l\205\200\266o l\202\265(aft\261subs\207\366\214s\236",
"\257n\350x \210r\243\373\235\200\247\326\267\202\275\243\306\305c\217l\012",
"m\217f\221m\230UTF-8 \216\321d\205g\275\243c\221rupt\230\342le: \334",
"\305\240\322bo\235 \042\215\366rn\372\361\042\215\366r\316<\253ue>\042\012",
"\205\323\226\227\216\201\215\366r\316\347\203(\315& n\202-\262y\236",
"\220k\212w\316\263\275\243\225\250\371\213\201\263 \365",
"\256\350k\200\250\350\265\345\250\232fa\311\201\253u\200f\243\375\205\232x\230\315p\206a\313t\261\365",
"\240\210-\341\230\346\231\221\203\361na\207\337\246\203\317\224\225\363\357e\264",
"\250\305\243\360\317\224\202l\224bel\202\265\266 \250s\205g\354au\266\356\335\365",
"\357\200\323fli\303: \202\200\330\235\200\357\322\304\217\215ad\224a\267gn\230\266 a\212\235\261imple\233t\314 \365",
"\374\357\322\206\200\341\230f\243\327\012",
"\220k\212w\316au\266\356\202\355",
"\220k\212w\316\357\200\223 f\243au\266\356\202\355",
"pu\244ic \332\322\361loc\376\332\322\317\224\225\363\357\322\365",
"\357\200\332\322\317\224\225\312\205i\207\217iz\230\365",
"pu\244ic \246\203\317\224\225\215\366r\316\262y\203\365",
"a\237i\270ou\203\371\213t; \350\265ov\210rid\200\304\215qui\215\204\365",
"nu\237\261\330\273t\203do\322\225\356\302 \341i\214\012",
"\247\254\303\230\350\265nam\200id\216\207\342\210\012",
"\305\216um\210\314 \215qui\215\203\220iqu\200\350g\012",
"\256\363\215qui\215\204p\206a\313t\210\203aft\261\333\214\376p\206a\313t\210\264",
"\321\311\204\225\300\204\313\237\210\234 \373\227ruc\201\223\012",
"\327 do\322\225\363\250\356\302\205\265\347\012",
"\352\223 sho\311\204\312\223 \373new-\227y\354\232\336\206\314\264",
"\324sho\311\204\225\363\375\247plici\201\215\366r\316\347\012",
"\305pro\266\347\203do \225\356\302\012",
"s\254cif\224ei\235\261\217l \353\233\226\202\203\243\202l\224\235\200l\364\201\353\233\226\202\012",
"\256\300\204\324\334",
"\324w\345\217\215ad\224\341\230\335\235\304\334",
"\256\300\204\213\224\313\235od\203f\243\334",
"\256\300\204\313\235o\204\243pr\346t\224\211.\334",
"\256c\217l \313\235od\203\335\375\262y\012",
"\256c\217l \313\235od\203\335\250\246\012",
"\313\235o\204\277\363\250\342rs\201\340\321mpa\207\244\200\343\235 \235\200\324\352(\211\236",
"\324nam\200\277\227\206\201\343\235 \375upp\210c\364\200lett\210\012",
"\324\307\203\217\215ad\224be\216 \341\230(\326vio\240l\224\351\216 \345\211\236",
"\247\254\303\230id\216\207\342\261- d\271you f\221ge\201\250\347?\012",
"\371ru\303\243\305\277\215\366r\316\350\265\334",
"\256\341\200\371ru\303\243f\221\234; \217\215ad\224\247i\227\203\345\250\334",
"miss\205\265\347\275\243\324\277\363\235\200sam\200nam\200\345\324\223\012",
"\256\240\200\232lete\275\324\324\307\203\374\232\227ru\303\221\012",
"\374\313\235od\317p \243\336\364\203w\345fo\220\204f\243\334",
"\374\232\227ru\303\243w\345fo\220\204f\243\324\334",
"\232\227ru\303\221\203\277\312na\207\337\246\264",
"\232\227ru\303\221\203\256\363\247t\241 \273t\264",
"\313\235od\317p \361\336\364\203\226gn\231u\215\203\277\240\200new-\227y\354\352\232\336\206\314\264",
"\256s\254cif\224\315\353\233\226\202\203\335bo\235 \352\361na\313\012",
"\247\254\303\230\352\247\326\267\202\012",
"f\311ly-qu\217i\342\230nam\200\223 \304\266o l\202g\275wo\311\204\312tr\242\231\230\266\355",
"\220\247\254\303\230\266k\216\275\247\254\303\230\313\235o\204\243pr\346\251\012",
"\247\254\303\230\042na\207ve\042\275\042get\042\275\243\042\351t\042\012",
"\324f\243\324\217\215ad\224\247i\227\264",
"pr\346t\224gett\210\203\256accep\201\247t\241 \273t\264",
"\324\277\363\235\200sam\200\215\366r\316\352\345pr\346t\224\324(\211\236",
"\256mix \313\235od\317p\203\361\336\364s\322\343\235 \205h\210it\213c\370",
"\256\321\210c\200\246\203\266 \253ue\264",
"\256\321\210c\200objec\201\352\324\266 n\202-objec\201\352\334",
"\256\321\210c\200n\202-objec\201\352\324\266 objec\201\352\334",
"\256\321\210c\200\220\215l\231\230objec\201\347\203\324\361\334",
"\352mis\356\302 (\324\361\211\236",
"\256\240\200\375objec\201\373\250m\311\207-\350\265\351le\303\221\012",
"\262y\203\206\200\225supp\221t\230\345\215\366r\316\347\264",
"\256mix \215f\210\216c\200\361\315\347\264",
"\323s\201w\345s\254ci\342\230t\343c\370",
"\321\311\204\225\300\204\352\223\012",
"new-\227y\354\315\347\203\256s\254cif\224\353\233\226\335\367\322\345p\206\201\330\235eir \347\012",
"na\207ves\275f\221w\206ds\275\361pu\244ic \246\203\256\215\366r\316\262y\264",
"\306\352\232\336\206\314\012",
"new-\227y\354\232\336\206\314\203sho\311\204\225\363\042new\042\012",
"vo\271\256\312\240\230\345\250\360\347\012",
"\306\352\247\326\267\202\012",
"#p\241gm\250new\232\336\203\277\312\215qui\215\204\243\333\214\217\012",
"new-\227y\354\232\336\206\314\203\206\200\215qui\215d\012",
"\256a\267g\316n\311l \266 \250n\202-n\311l\276\200\347\012",
"\374gett\261fo\220\204f\243pr\346t\224\334",
"\351tt\261\277\350k\200\247a\303l\224\202\200\247t\241 \340\343\235 \352\334",
"\351tt\261\277\215\366r\316void\012",
"\374\351tt\261fo\220\204f\243pr\346t\224\334",
"\256\240\200n\202-pu\244ic \246\203\345c\217lback\264",
"\256a\267g\317INVALID_FUNCTION \266 \250n\202-\306\255\301"
"\256a\267g\316INVALID_FUNCTION \266 \250n\202-\305\347\012",
"\247\254\303\230newl\205e\275bu\201fo\220\204'\211'\012"
#endif
};
@ -377,18 +379,18 @@ static char *fatalmsg[] = {
/*170*/ "assertion failed: %s\n",
/*171*/ "user error: %s\n",
#else
"\256\215a\204from \343le:\354",
"\256writ\200\266 \343le:\354",
"t\276\200ov\210flow:\354",
"\205suf\343ci\216\201\333m\221y\012",
"\307\352se\237l\261\205\227ruc\214\354",
"num\210ic ov\210flow\302\247ce\321\375capaci\251\012",
"\322mpil\232scrip\201\247ce\321\203\235\200\320ximum \333m\221\224\365\200(%l\204bytes\236",
"\266o m\213\224\210r\243\333ssag\274\336\202\200l\205\301",
"\322\230pag\200\320pp\375\343\353\225fo\220d\012",
"\307p\231h:\354",
"\352s\210\214 fail\321: \335",
"\240\261\210r\221: \335"
"\256\215a\204from \342le:\355",
"\256writ\200\266 \342le:\355",
"t\276\200ov\210flow:\355",
"\205suf\342ci\216\201\313m\221y\012",
"\306\364\351\237l\261\205\227ruc\214\355",
"num\210ic ov\210flow\275\247ce\320\205\265capaci\251\012",
"\321mpil\230scrip\201\247ce\320\203\235\200\317ximum \313m\221\224\367\200(%l\204bytes\236",
"\266o m\213\224\210r\243\313ssag\322\335\202\200l\205\370",
"\321\232pag\200\317pp\205\265\342\354\225fo\220d\012",
"\306p\231h:\355",
"\364s\210\214 fail\320: \334",
"\240\261\210r\221: \334"
#endif
};
@ -433,44 +435,44 @@ static char *warnmsg[] = {
/*236*/ "unknown parameter in substitution (incorrect #define pattern)\n",
/*237*/ "coercing functions to and from primitives is unsupported and will be removed in the future\n",
#else
"\327 \305tr\242\231\232\266 %\204\304\206a\313\210\264",
"\215\342i\214 \330\366\213t/\320cro \363",
"nu\237\261\330\273t\203do\274\225\355\304 \342i\214\012",
"\263 \305nev\261\240\321:\354",
"\263 \305a\267gn\232\250\253u\200\235a\201\305nev\261\240\321:\354",
"\215d\220d\213\201\322\230: \366\213\201\323\215\267\336\305z\210o\012",
"\215d\220d\213\201te\227: \366\213\201\323\215\267\336\305n\202-z\210o\012",
"\220k\212w\317#p\241g\320\012",
"\306\344\374\350\265\215s\312\201\240\232bef\221\200\342i\214\302f\221c\375\215p\206s\301",
"\246\234 sho\312\204\215\364r\317\250\253u\301",
"po\267\244\200\240\200\330\263 bef\221\200\205i\207\217iz\315:\354",
"po\267\244\224\220\205t\216\230\204a\267gn\233t\012",
"po\267\244\224\220\205t\216\230\204bit\344s\200\347\315\012",
"\350\265mis\355\304\012",
"po\267\244\224\250\042\366\367\316\341w\345\205t\216\230d:\354",
"\323\215\267\336\310\203\371effe\313\012",
"ne\227\232\322m\233t\012",
"loos\200\205d\216t\315\012",
"\254\204\227y\353pro\266\255\274\240\232\344\374\334\214\373semic\254umn\264",
"loc\373\357\223 s\310dow\203\250\357a\201\250p\215c\321\375level\012",
"\323\215\267\336\344\374\350\265ov\210rid\200\277appe\206 betwe\216 p\206\216\235ese\264",
"label \376m\200\223 s\310dow\203\350\265\376m\301",
"nu\237\261\330\351git\203\247ce\321\203\241\214\373nu\237\261p\215ci\226\202\012",
"\215d\220d\213\201\042\365e\311\042: \341\365\200\305\217way\2031 \363",
"\205\230t\210m\205\231\200\316\365\200\370\042\365e\311\367\323\215\267\336\363",
"\220\215a\304\276\200\322\230\012",
"\250\357\305a\267gn\232\266 itself \363",
"m\221\200\205i\207\217iz\210\203\235\372\216um \343eld\264",
"l\216g\374\330\205i\207\217iz\261\247ce\321\203\365\200\330\235\200\216um \343eld\012",
"\205\230x \350\265mis\355\304 \363",
"\371imple\233t\315 f\243\356\200\223 \370\246\234\302\371f\217l-back\012",
"\356\200speci\343c\315 \336f\221w\206\204\230\337\206\315 \305ig\212\215d\012",
"outpu\201\343\353\305writt\216\302bu\201\344\374\322mpac\201\216\322d\375\351s\276\321\012",
"\356\200\357\223 s\310dow\203\250glob\373\332\301",
"\327 \305m\206k\232\345\230p\215c\231\321: \335",
"pu\244ic \306lack\203f\221w\206\204\230\337\206\315 \363",
"\220k\212w\317p\206a\333t\261\370subs\207\364\214 (\205c\221\215c\201#\342\200p\231t\210n\236",
"\322\210c\375\246\203\266 \360from primi\207v\274\305\220supp\221t\232\360\344ll \314\215mov\232\370\235\200fu\364\215\012"
"\327 \304tr\242\231\230\266 %\204\302\206a\303\210\264",
"\215\341i\214 \330\371\213t/\317cro \365",
"nu\237\261\330\273t\203do\322\225\356\302 \341i\214\012",
"\263 \304nev\261\240\320:\355",
"\263 \304a\267gn\230\250\253u\200\235a\201\304nev\261\240\320:\355",
"\215d\220d\213\201\321\232: \371\213\201\247\326\267\335\304z\210o\012",
"\215d\220d\213\201te\227: \371\213\201\247\326\267\335\304n\202-z\210o\012",
"\220k\212w\316#p\241g\317\012",
"\305\343\235 \350\265\215s\311\201\240\230bef\221\200\341i\214\275f\221c\205\265\215p\206\351\012",
"\246\234 sho\311\204\215\366r\316\250\253u\370",
"po\267\244\200\240\200\330\263 bef\221\200\205i\207\217iz\314:\355",
"po\267\244\224\220\205t\216d\230a\267gn\233t\012",
"po\267\244\224\220\205t\216d\230bit\343s\200\346\314\012",
"\350\265mis\356\302\012",
"po\267\244\224\250\042\371\372\315\340w\345\205t\216\232d:\355",
"\247\326\267\335\307\203\374effe\303\012",
"ne\227\230\321m\233t\012",
"loos\200\205d\216t\314\012",
"\255\204\227y\354pro\266\347\203\240\230\343\235 \333\214\376\351mic\255umn\264",
"loc\376\360\223 s\307dow\203\250\360a\201\250\326c\320\205\265level\012",
"\247\326\267\335\343\235 \350\265ov\210rid\200\277ap\254\206 betwe\216 p\206\216\235e\351\264",
"label nam\200\223 s\307dow\203\350\265na\313\012",
"nu\237\261\330\353git\203\247ce\320\203\241\214\376nu\237\261\326ci\226\202\012",
"\215d\220d\213\201\042\367e\310\042: \340\367\200\304\217way\2031 \365",
"\205\232t\210m\205\231\200\315\367\200\373\042\367e\310\372\247\326\267\335\365",
"\220\215a\302\276\200\321\232\012",
"\250\360\304a\267gn\230\266 it\351lf \365",
"m\221\200\205i\207\217iz\210\203\235\375\216um \342eld\264",
"l\216g\235 \330\205i\207\217iz\261\247ce\320\203\367\200\330\235\200\216um \342eld\012",
"\205\232x \350\265mis\356\302 \365",
"\374imple\233t\314 f\243\357\200\223 \373\246\234\275\374f\217l-back\012",
"\357\200s\254ci\342c\314 \335f\221w\206\204\232\336\206\314 \304ig\212\215d\012",
"outpu\201\342\354\304writt\216\275bu\201\343\235 \321mpac\201\216\321d\205\265\353s\276\320\012",
"\357\200\360\223 s\307dow\203\250glob\376\332\370",
"\327 \304m\206k\230\345\232\326c\231\320: \334",
"pu\244ic \305lack\203f\221w\206\204\232\336\206\314 \365",
"\220k\212w\316p\206a\313t\261\373subs\207\366\214 (\205c\221\215c\201#\341\200p\231t\210n\236",
"\321\210c\205\265\246\203\266 \361from primi\207v\322\304\220supp\221t\230\361\343ll \312\215mov\230\373\235\200fu\366\215\012"
#endif
};

View File

@ -0,0 +1,18 @@
#pragma semicolon 1
methodmap Entity
{
public Entity(const char[] className) {
return Entity:CreateEntityByName(className);
}
property bool IsValid {
public get() {
return IsValidEntity(_:this);
}
}
};
public main()
{
}

View File

@ -2,11 +2,18 @@
#ifndef _sourcepawn_compiler_token_stream_h_
#define _sourcepawn_compiler_token_stream_h_
typedef struct {
int line;
int col;
} token_pos_t;
typedef struct {
int id;
int value;
char str[sLINEMAX + 1];
size_t len;
token_pos_t start;
token_pos_t end;
} full_token_t;
#define MAX_TOKEN_DEPTH 4