setClassId() public method

public setClassId ( int v ) : void
v int
return void
/*
 * declOuter presumes that class & type have already been parsed
 * this is done to distinguish between a function declaration and a
 * variable declaration
 */
        void declOuter(Var e)
        {
#if DEBUG
            Console.WriteLine("declOuter1 token=[" + tok + "]\n");
#endif
            e.setName(tok.getValue()); /* use value as the variable name */
            addOuter(e);               /* add this variable */
            emit.FieldDef(e);          /* issue the declaration */
            if (e.getClassId() == Tok.T_DEFCLASS)
            {
                e.setClassId(Tok.T_STATIC); /* make sure it knows its storage class */
            }

            /*
             * loop while there are additional variable names
             */
            while (io.getNextChar() == ',')
            {
                tok.scan();
                if (tok.getFirstChar() != ',')
                {
                    io.Abort("Expected ','");
                }
                tok.scan();
                if (tok.getId() != Tok.T_IDENT)
                {
                    io.Abort("Expected identifier");
                }
                e.setName(tok.getValue()); /* use value as the variable name */
                addOuter(e);               /* add this variable */
                emit.FieldDef(e);          /* issue the declaration */
                if (e.getClassId() == Tok.T_DEFCLASS)
                {
                    e.setClassId(Tok.T_STATIC); /* make sure it knows its storage class */
                }
            }

            /*
             * move beyond end of statement indicator
             */
            tok.scan();
            if (tok.getFirstChar() != ';')
            {
                io.Abort("Expected ';'");
            }
            CommentFill();
            tok.scan();
#if DEBUG
            Console.WriteLine("declOuter2 token=[" + tok + "]\n");
#endif
        }
        VarList paramList()
        {
            VarList v;

            tok.scan();
            if (tok.getFirstChar() != '(')
            {
                io.Abort("Expected '('");
            }

            v = new VarList();  /* init the param list */
            tok.scan();         /* get the next token */
            while (tok.getFirstChar() != ')')
            {
                Var e = new Var();
                e.setClassId(Tok.T_PARAM);     /* mark this as a parameter */
                dataType(e);                   /* get the specified datatype */
                e.setName(tok.getValue());     /* copy the variable name */
                v.add(e);                      /* add parameter to param list */
                tok.scan();
                if (tok.getFirstChar() == ',') /* if more params */
                {
                    tok.scan();                /* get the next token */
                }
            }
            tok.scan(); /* move to the next token */
            return(v);
        }
        void dataClass(Var e)
        {
#if DEBUG
            Console.WriteLine("dataClass1 token=[" + tok + "]\n");
#endif
            int id = tok.getId();
            if (id == Tok.T_EXTERN || id == Tok.T_STATIC || id == Tok.T_AUTO)
            {
                e.setClassId(tok.getId());
                tok.scan();
#if DEBUG
                Console.WriteLine("dataClass2 token=[" + tok + "]\n");
#endif
            }
            else
            {
                e.setClassId(Tok.T_DEFCLASS); /* default to current context */
            }
        }
示例#4
0
void dataClass(Var e)
  {
#if DEBUG
  Console.WriteLine("dataClass1 token=["+tok+"]\n");
#endif
  int id = tok.getId();
  if (id == Tok.T_EXTERN || id == Tok.T_STATIC || id == Tok.T_AUTO)
    {
    e.setClassId(tok.getId());
    tok.scan();
#if DEBUG
    Console.WriteLine("dataClass2 token=["+tok+"]\n");
#endif
    }
  else
    {
    e.setClassId(Tok.T_DEFCLASS); /* default to current context */
    }
  }
示例#5
0
VarList paramList()
  {
  VarList v;
  tok.scan();
  if (tok.getFirstChar() != '(')
    io.Abort("Expected '('");

  v = new VarList();		/* init the param list */
  tok.scan();			/* get the next token */
  while (tok.getFirstChar() != ')')
    {
    Var e = new Var();
    e.setClassId(Tok.T_PARAM);	/* mark this as a parameter */
    dataType(e);		/* get the specified datatype */
    e.setName(tok.getValue()); /* copy the variable name */
    v.add(e);			/* add parameter to param list */
    tok.scan();
    if (tok.getFirstChar() == ',')	/* if more params */
      tok.scan();		/* get the next token */
    }
  tok.scan();		/* move to the next token */
  return v;
  }
示例#6
0
/*
 * declOuter presumes that class & type have already been parsed
 * this is done to distinguish between a function declaration and a
 * variable declaration
 */
void declOuter(Var e)
  {
#if DEBUG
  Console.WriteLine("declOuter1 token=["+tok+"]\n");
#endif
  e.setName(tok.getValue());	/* use value as the variable name */
  addOuter(e);		/* add this variable */
  emit.FieldDef(e);		/* issue the declaration */
  if (e.getClassId() == Tok.T_DEFCLASS)
    e.setClassId(Tok.T_STATIC);	/* make sure it knows its storage class */

  /*
   * loop while there are additional variable names
   */
  while (io.getNextChar() == ',')
    {
    tok.scan();
    if (tok.getFirstChar() != ',')
	io.Abort("Expected ','");
    tok.scan();
    if (tok.getId() != Tok.T_IDENT)
	io.Abort("Expected identifier");
    e.setName(tok.getValue()); /* use value as the variable name */
    addOuter(e);		/* add this variable */
    emit.FieldDef(e);		/* issue the declaration */
    if (e.getClassId() == Tok.T_DEFCLASS)
      e.setClassId(Tok.T_STATIC);	/* make sure it knows its storage class */
    }
  /*
   * move beyond end of statement indicator
   */
  tok.scan();
  if (tok.getFirstChar() != ';')
    io.Abort("Expected ';'");
  CommentFill();
  tok.scan();
#if DEBUG
  Console.WriteLine("declOuter2 token=["+tok+"]\n");
#endif
  }