setName() public method

public setName ( String s ) : void
s String
return void
コード例 #1
0
        void declFunc(Var e)
        {
#if DEBUG
            Console.WriteLine("declFunc token=[" + tok + "]\n");
#endif
            CommentHolder();           // start new comment
            e.setName(tok.getValue()); /* value is the function name */
            if (e.getName().Equals("main"))
            {
                if (Io.gendll)
                {
                    io.Abort("Using main entrypoint when generating a DLL");
                }
                mainseen = true;
            }
            staticvar.add(e);         /* add function name to static VarList */
            paramvar = paramList();   // track current param list
            e.setParams(paramvar);    // and set it in func var
            localvar = new VarList(); // track new local parameters
            CommentFillPreTok();

            emit.FuncBegin(e);
            if (tok.getFirstChar() != '{')
            {
                io.Abort("Expected '{'");
            }
            blockOuter(null, null);
            emit.FuncEnd();
            emit.IL();
            if (Io.genlist)
            {
                emit.LIST();
            }
            emit.Finish();
        }
コード例 #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
/*
 * 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
  }
コード例 #4
0
void declFunc(Var e)
  {
#if DEBUG
  Console.WriteLine("declFunc token=["+tok+"]\n");
#endif
  CommentHolder();	// start new comment
  e.setName(tok.getValue()); /* value is the function name */
  if (e.getName().Equals("main"))
    {
    if (Io.gendll)
      io.Abort("Using main entrypoint when generating a DLL");
    mainseen = true;
    }
  staticvar.add(e);		/* add function name to static VarList */
  paramvar = paramList();	// track current param list
  e.setParams(paramvar);	// and set it in func var
  localvar = new VarList();	// track new local parameters
  CommentFillPreTok();

  emit.FuncBegin(e);
  if (tok.getFirstChar() != '{')
    io.Abort("Expected '{'");
  blockOuter(null, null);
  emit.FuncEnd();
  emit.IL();
  if (Io.genlist)
    emit.LIST();
  emit.Finish();
  }
コード例 #5
0
/*
 * parse an inner declaration
 */
void declInner()
  {
  while (tok.IsDeclKeyword())
    {
    Var e = new Var();
#if DEBUG
    Console.WriteLine("declInner1 token=["+tok+"]\n");
#endif

    CommentHolder();	/* mark comment position in insn stream */

    dataClass(e);		// parse the data class (static, auto, etc)
    dataType(e);		// parse the type (int, unsigned, etc)
    e.setName(tok.getValue()); // save the name in var
#if DEBUG
    Console.WriteLine("declInner2.0 token=["+tok+"]\n");
    Console.WriteLine("declInner2.0 e=["+e+"]\n");
#endif
    addInner(e);			/* add this variable */
    /*
     * 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 */
#if DEBUG
      Console.WriteLine("declInner2.1 token=["+tok+"]\n");
      Console.WriteLine("declInner2.1 e=["+e+"]\n");
#endif
      addInner(e);		/* reuse the class & type */
      }
    /*
     * move beyond end of statement indicator
     */
    tok.scan();
    if (tok.getFirstChar() != ';')
	io.Abort("Expected ';'");
    CommentFill();
    tok.scan();		/* get token ready nor next parser step */
#if DEBUG
    Console.WriteLine("declInner3 token=["+tok+"]\n");
#endif
    }
  }