setClassId() публичный Метод

public setClassId ( int v ) : void
v int
Результат void
Пример #1
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
        }
Пример #2
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);
        }
Пример #3
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 */
            }
        }
Пример #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
  }