mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 12:52:46 +00:00
Parse id <protocol> and classname <protocol>.
This is needed to allow compile-time protocol conformance checks, though nothing along those lines has been implemented yet. id has been changed from TYPE to OBJECT, required to allow id <proto> to be parsed. OBJECT uses symbol, allowing id to be redefined once suitable work has been done on the parser.
This commit is contained in:
parent
97c89c667d
commit
cd7c53d223
3 changed files with 14 additions and 3 deletions
|
@ -1375,6 +1375,8 @@ init_objective_structs (void)
|
|||
chain_type (&type_obj_super);
|
||||
chain_type (&type_SuperPtr);
|
||||
chain_type (&type_supermsg);
|
||||
|
||||
symtab_addsymbol (current_symtab, new_symbol ("id"));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -281,7 +281,7 @@ static keyword_t keywords[] = {
|
|||
{"int", TYPE, &type_integer, 0, PROG_VERSION, 0},
|
||||
{"unsigned", TYPE, &type_integer, 0, PROG_VERSION, 0},//FIXME
|
||||
{"function", TYPE, &type_function, 0, PROG_VERSION, 0},
|
||||
{"id", TYPE, &type_id, 0, PROG_VERSION, 1},
|
||||
{"id", OBJECT, &type_id, 0, PROG_VERSION, 1},
|
||||
{"Class", TYPE, &type_Class, 0, PROG_VERSION, 1},
|
||||
// {"Protocol", TYPE, &type_Protocol, 0, PROG_VERSION, 0},
|
||||
{"Method", TYPE, &type_obj_method, 0, PROG_VERSION, 1},
|
||||
|
@ -363,6 +363,9 @@ keyword_or_id (char *token)
|
|||
if (keyword->value) {
|
||||
if (keyword->value == STRUCT) {
|
||||
qc_yylval.op = token[0];
|
||||
} else if (keyword->value == OBJECT) {
|
||||
sym = symtab_lookup (current_symtab, token);
|
||||
qc_yylval.symbol = sym;
|
||||
} else {
|
||||
qc_yylval.type = 0;
|
||||
qc_yylval.type = keyword->type;
|
||||
|
|
|
@ -148,7 +148,7 @@ int yylex (void);
|
|||
%token ARGS EXTERN STATIC SYSTEM SIZEOF OVERLOAD
|
||||
%token <op> STRUCT
|
||||
%token <type> TYPE
|
||||
%token <symbol> TYPE_NAME
|
||||
%token <symbol> OBJECT TYPE_NAME
|
||||
%token CLASS DEFS ENCODE END IMPLEMENTATION INTERFACE PRIVATE
|
||||
%token PROTECTED PROTOCOL PUBLIC SELECTOR REFERENCE SELF THIS
|
||||
|
||||
|
@ -462,7 +462,11 @@ type_specifier
|
|||
{
|
||||
$$ = make_spec ($1->type, 0, 0, 0);
|
||||
}
|
||||
| CLASS_NAME
|
||||
| OBJECT protocolrefs
|
||||
{
|
||||
$$ = make_spec (&type_id, 0, 0, 0);
|
||||
}
|
||||
| CLASS_NAME protocolrefs
|
||||
{
|
||||
$$ = make_spec ($1->type, 0, 0, 0);
|
||||
}
|
||||
|
@ -1271,6 +1275,7 @@ identifier
|
|||
if (!($$ = symtab_lookup (current_symtab, "break")))
|
||||
$$ = new_symbol ("break");
|
||||
}
|
||||
| OBJECT
|
||||
| CLASS_NAME
|
||||
| TYPE_NAME
|
||||
;
|
||||
|
@ -1710,6 +1715,7 @@ keywordselector
|
|||
selector
|
||||
: NAME { $$ = $1; }
|
||||
| CLASS_NAME { $$ = $1; }
|
||||
| OBJECT { $$ = new_symbol (qc_yytext); }
|
||||
| TYPE { $$ = new_symbol (qc_yytext); }
|
||||
| TYPE_NAME { $$ = $1; }
|
||||
| reserved_word
|
||||
|
|
Loading…
Reference in a new issue