lex.c
case TNAME:
break;
case AGGR:
case ENUM:
reti(CAST,0);
default:
reti(LP,0);
}
if( saved )
lxchar = saved;
else
get( lchar );
while( ( p = lxcp[ lxchar+1 ] )->lxact == A_WS )
get( lxchar );
saved = lxchar;
switch (lxchar) {
case ':': reti(LP,0); /* (classname::memname */
case '(': break;
deafult: reti(CAST,0);
}
/* here is the real problem:
CAST: ( ini ( * ) ( ) ) p;
LP: ( int ( * p ) )
ignore
( int ( &
and ( int ( [
and ( int ( ( problems
*/
get( lxchar );
while( ( p = lxcp[ lxchar+1 ] )->lxact == A_WS ) get( lxcha
if (lxchar != '*') {
unget(lxchar);
reti(LP,0);
}
get( lxchar );
while( ( p = lxcp[ lxchar+1 ] )->lxact == A_WS ) get( lxcha
unget(lxchar);
unget('*');
if (lxchar == ')') reti(CAST,0);
reti(LP,0);
case A_R:
if (br_level-- <= 0) {
error("unX ') ");
br_level = 0;
}
reti(RP,0);
case A_ASS:
switch (get(lxchar)) {
case '=':
reti(EQUIP,EQ);
in.c
/* %z% %M% %I% %H% %T% */
/*
C++ stream i/o source
in.c
*/
#include <ctype.h>
/*#inlcude <stdio.h>*/
#include "../../incl/stream.h"
#include "../../incl/common.h"
/* the predefined streams */
filebuf cin_file = {
/*base stuff*/0, 0, 0, 0, 0, filebuf__vtbl, /*fd*/0, /*opened*/1
};
istream cin = { /*bp*/(streambuf*)&cin_file, /* tied_to */&cout, /*skipws*/1, /*stat
/* predefined whitespace */
whitespace WS;
/*inline */void eatwhite (istream& is)
{
if (is.tied_to) is.tied_to->flush();
register streambuf *nbp = is.bp;
register char c = nbp->sgetc();
while (isspace(c)) c = nbp->snextc();
}
istream& istream.operator>>(whitespace& w)
{
register char c;
register streambuf *nbp = bp;
&w;
if (state) return *this;
if (tied_to) tied_to->flush();
c = nbp->sgetc();
while (isspace(c)) c = nbp->snextc();
if (c == EOF) state |= _eof;
return *this;
}
istream& istream.operator>>(register char& s)
/*
reads characters NOT very small integers
*/
{
if (skipws) eatwhite(*this);
if (state) {
state |= _fail;
return *this;
}
gram.y
modified_tn = modified_tn->1;
n->lex_level = 0;
}
$$ = $<pb>1->base_adj((Pbase)n->tp);
}
;
/****************** aggregate: returns Pname ******************/
enum_dcl : ENUM LC moe_list RC
{ $$ = end_enum(0,$<pn>3); }
| ENUM tag LC moe_list RC
{ $$ = end_enum($<pn>2,$<pn>4); }
;
moe_list : moe
{ if ($1) $$ = nlist($1); }
| moe_list CM moe
{ if( $3) if ($1) Nadd($1,$3); else $$ = nlistN($3);
;
moe : ID
{ $$ = new name($<s>1); Ntype($$) = moe_type; }
| ID ASSIGN e
{ $$ = new name($<s>1);
Ntype($$) = moe_type;
$<pn>$->n_initializer = $<pe>3;
}
| /* empty */
{ $$ = 0;}
;
class_dcl : class_head mem_list RC
{ end_cl(); }
| class_head mem_list RC TYPE
{ end_cl();
error("`;' or declaratorX afterCD");
lex_unget($4);
/* lex_unget($4); but only one unget, sorry */
}
;
class_head : AGGR LC
{ $$ = start_cl($<t>1,0,0); }
| AGGR tag LC
{ $$ = start_cl($<t>1,$<pn>2,0); }
| AGGR tag COLON tag LC
{ $$ = start_cl($<t>1,$<pn>2,$<pn>4); }
| AGGR tag COLON PUBLIC tag LC
{ $$ = start_cl($<t>1,$<pn>2,$<pn>5);
cc1->pubbase = 1;
}
;
tag : ID
{ $$ = new name($<s>1); }
| TNAME
;
mem_list : cl_mem_list
{ Pname n = Nunlist($1);
if (cc1->is_simple())
cc1->pubmem = n;
else
cc1->privmem = n;
$$ = 0;
}
| cl_mem_list PUBLIC cl_mem_list
{ error("``:'' missing after ``public''");
cc1->pubmem = Nunlist($3);
goto priv;
}
| cl_mem_list PUBLIC COLON cl_mem_list
{ TOK t;
cc1->pubmem = Nunlist($4);
priv:
t = cc1->is_simple();
if (t) error("public in%k",t);
cc1->privmem = Nunlist($1);
$$ = 0;
}
;
cl_mem_list : cl_mem_list cl_mem
{ if ($2) if ($1) Nadd_list($1,$2); else $$ = nlistN(
| %prec EMPTY
{ $$ = 0; }
;
cl_mem : data_dcl
| att_fct_def SM
| att_fct_def
| fct_def SM
| fct_def
| fct_dcl
| tn_list tag SM /* public declaration */
{ Pname n = Ncopy($2);
n->n_qualifier = (Pname)$1;
n->n_list = cc1 \->pubdef;
cc1->pubdef = n;
$$ = 0;
}
;
/************** declarators: returns Pname ************************/