当前位置: 首页>>代码示例>>C++>>正文


C++ NextChar函数代码示例

本文整理汇总了C++中NextChar函数的典型用法代码示例。如果您正苦于以下问题:C++ NextChar函数的具体用法?C++ NextChar怎么用?C++ NextChar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NextChar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ASSERT

void TFunctionScanner::SkipString(const TChar*& text)
{
	TChar	terminator = *text;
	ASSERT(terminator == '\'' || terminator == '\"');
	NextChar(text);
	
	TChar previous = 0;
	TChar previous2 = 0;
	
	while (1)
	{
		TChar ch = *text;
		
		if (ch == terminator && (previous != '\\' || previous2 == '\\'))
		{
			NextChar(text);
			break;
		}
	
		previous2 = previous;
		previous = ch;
		NextChar(text);
	}
}
开发者ID:mikevoydanoff,项目名称:zoinks,代码行数:24,代码来源:TFunctionScanner.cpp

示例2: NextChar

bool wxTextInputStream::EatEOL(const wxChar &c)
{
    if (c == wxT('\n')) return true; // eat on UNIX

    if (c == wxT('\r')) // eat on both Mac and DOS
    {
        wxChar c2 = NextChar();
        if(c2 == wxEOT) return true; // end of stream reached, had enough :-)

        if (c2 != wxT('\n')) UngetLast(); // Don't eat on Mac
        return true;
    }

    return false;
}
开发者ID:ACanadianKernel,项目名称:pcsx2,代码行数:15,代码来源:txtstrm.cpp

示例3: NextChar

// Read string up to terminating quote, ignoring embedded double quotes
void Lexer::ScanString(int stringStart)
{
	char ch;
	do
	{
		ch = NextChar();
		if (!ch)
		{
			CompileError(TEXTRANGE(stringStart, CharPosition()), LErrStringNotClosed);
		}
		else
		{
			if (ch == STRINGDELIM)
			{
				// Possible termination or double quotes
				if (PeekAtChar() == STRINGDELIM)
					ch = NextChar();
				else
					break;
			}
			*tp++ = ch;
		}
	} while (ch);
}
开发者ID:brunobuzzi,项目名称:DolphinVM,代码行数:25,代码来源:lexer.cpp

示例4: NextName

bool FarXMLScanner::ParseAttribute (FarXMLNode *node)
{
    FarString attrName = NextName();
  if (attrName.IsEmpty())
    return false;
    SkipWhitespace();
  if (!NextExpectedChar ('='))
    return false;
  SkipWhitespace();

  char valueDelimiter = NextChar();
  if (valueDelimiter != '\'' && valueDelimiter != '\"')
  {
    ReportError ("\" or \'");
    return false;
  }

  FarString attrValue;
  while (1)
  {
    char c = NextChar();
    if (c == valueDelimiter)
      break;
    else if (c == '&')
    {
      int entityValue = ParseEntity();
      if (entityValue == -1)
        return false;
      attrValue += (char) entityValue;
    }
    else
            attrValue += c;
  }
  node->AddAttr (attrName, attrValue);
  return true;
}
开发者ID:Maximus5,项目名称:evil-programmers,代码行数:36,代码来源:FARXml.cpp

示例5: malloc

// creates a new pathame string that is a dup of the input pathname, with the
// extension (if any) replaced by the given extension.
CHAR * NEAR CloneNameAddExt
(
    CHAR * szInputFile,
    CHAR * szExt
)
{
    CHAR * szFile;
    CHAR * pExt;
    CHAR * pch;

    // CONSIDER:
    // assumes the extension is no more than 3 bytes incl '.' (ie non-DBCS)
    // (This is true for the moment - can it ever change???)

    // alloc string with enough space for ".", extension, and null
    szFile = malloc(strlen(szInputFile)+1+3+1);
    strcpy(szFile, szInputFile); 	// start with input file name

    // find "." (if present) that occurs after last \ or /.
    pExt = NULL;
    for (pch = szFile; *pch; NextChar(pch))
	{
	    switch (*pch)
		{
#ifdef	MAC
		case ':':
		case ' ':       // start search over at a space
#else	//MAC
		case '\\':
		case '/':
#endif	//MAC
		    pExt = NULL;
		    break;
		case '.':
		    pExt = pch;
		    break;
		default:
		    ;
		}
	}
    if (pExt == NULL)	// if no extension after last '\', then
	pExt = pch;	// append an extension to the name.

    strcpy (pExt, szExt);	// replace extension (if present) with
				// desired extension

    return szFile;
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:50,代码来源:mktyplib.c

示例6: NextExpectedChar

 bool NextExpectedChar (char expected)
 {
   char c = NextChar();
   if (c != expected)
   {
     if (fErrorSink != NULL)
     {
       char buf [2];
       buf [0] = expected;
       buf [1] = '\0';
       fErrorSink->ReportError (fCurLine, GetCurColumn(), buf);
     }
     return false;
   }
   return true;
 }
开发者ID:Maximus5,项目名称:evil-programmers,代码行数:16,代码来源:FARXml.cpp

示例7: NextChar

bool Parser::ParseKeyword(Statement* statement)
{
	// ["?"]
	if (GetCurrentChar() == '?') {
		NextChar();
		statement->SetType(Statement::kQuery);
	}
	// Keyword
	BString* keyword = fScanner.ScanIdent();
	if (keyword == NULL) {
		Error("Identifier expected");
		return false;
	}
	statement->SetKeyword(keyword);
	return true;
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:16,代码来源:Parser.cpp

示例8: SymName

void SymName (char* S)
/* Read a symbol from the input stream. The first character must have been
** checked before calling this function. The buffer is expected to be at
** least of size MAX_IDENTLEN+1.
*/
{
    unsigned Len = 0;
    do {
        if (Len < MAX_IDENTLEN) {
            ++Len;
            *S++ = CurC;
        }
        NextChar ();
    } while (IsIdent (CurC) || IsDigit (CurC));
    *S = '\0';
}
开发者ID:pmprog,项目名称:cc65,代码行数:16,代码来源:scanner.c

示例9: NextChar

Json* Json::Parser::ParsePrimary(){
	NextChar();
	Kind kind = KindPreview(ch);
	Json* json = NULL;
	switch(kind){
	case kString: { json = ParseString(); break;}
	case kNumber: { json = ParseNumber(); break;}
	case kFalse: { json = ParseFalse(); break; }
	case kTrue: { json = ParseTrue(); break; }
	case kArray: { json = ParseArray(); break; }
	case kObject: { json = ParseObject(); break; }
	case kNull: break;
	default: break;
	};
	return json;
}
开发者ID:JackWyj,项目名称:Json-Parser,代码行数:16,代码来源:Json.cpp

示例10: main

/***********************************************************************
Function  : main

Returns   : zero for successful execution
	    3    if an error is encountered

The main routine allocates buffers for the input and output buffer.
Characters are then read from the input buffer building the line buffer
that will be sent to the filter processor.  Lines are read and filtered
until the end of input is reached.
***********************************************************************/
int main( void )
{
   char c;
   unsigned long core;

   setmode(1,O_BINARY);               /* set output stream to binary mode */
   core = farcoreleft();
   if (core > 64000U)
      BufSize = 64000U;
   else BufSize = (unsigned)core;     /* get available memory */
                                      /* stay under 64K */
   if ((CurInPtr = malloc(BufSize)) == NULL) /* allocate buffer space */
      exit(3);
#if 0
   processor = NULL;                  /* set current processor to none */
#endif

   InBuffer = CurInPtr;               /* input buffer is first half of space */
   BufSize = BufSize/2;               /* output buffer is 2nd half */
   OutBuffer = InBuffer + BufSize;
   CurOutPtr = OutBuffer;             /* set buffer pointers */
   LinePtr = Line;
   CurBufLen = 0;
   Put(PipeId,PipeIdLen);             /* send ID string to message window */
   while ((c = NextChar()) != 0)      /* read characters */
   {
      if ((c == 13) || (c == 10))     /* build until line end */
      {
         *LinePtr = 0;
         ProcessLine(Line);           /* filter the line */
         LinePtr = Line;
      }
      /* characters are added to buffer up to 132 characters max */
      else if ((FP_OFF(LinePtr) - FP_OFF(&Line)) < 132)
      {
         *LinePtr = c;                /* add to line buffer */
         LinePtr++;
      }
   }
   *LinePtr = 0;
   ProcessLine(Line);                 /* filter last line */
   EndMark = MsgEoFile;
   Put(&EndMark,1);                   /* indicate end of input to
                                         the message window */
   flushOut((unsigned)(CurOutPtr-OutBuffer));     /* flush the buffer */
   return 0;                          /* return OK */
}
开发者ID:WiLLStenico,项目名称:TestesEOutrasBrincadeiras,代码行数:58,代码来源:rc2msg.c

示例11: NextChar

/*************************************************************************
Function  : NextChar
Parameters: none
Returns   : next character in input buffer or 0 on end of file

Input from the standard input stream is buffered in a global buffer InBuffer
which is allocated in function main.  The function will return
the next character in the buffer, reading from the input stream when the
buffer becomes empty.
**************************************************************************/
char NextChar(void)
{
  if (CurInPtr < InBuffer+CurBufLen)  /* if buffer is not empty */
  {
    return *(CurInPtr++);             /* return next character */
  }
  else
  {
    CurInPtr = InBuffer;              /* reset pointer to front of buffer */
    lseek(0,InOff,0);                 /* seek to the next section for read */
    InOff += BufSize;                 /* increment pointer to next block */
    if ((CurBufLen = read(0,InBuffer,BufSize)) !=0)
      return NextChar();              /* recursive call merely returns
                                         first character in buffer after read */
    return 0;                         /* return 0 on end of file */
  }
}
开发者ID:WiLLStenico,项目名称:TestesEOutrasBrincadeiras,代码行数:27,代码来源:rc2msg.c

示例12: while

// expect we are not in a C-string.
bool Tokenizer::SkipToOneOfChars(const wxChar* chars, bool supportNesting, bool skipPreprocessor, bool skipAngleBrace)
{
    while (NotEOF() && !CharInString(CurrentChar(), chars))
    {
        MoveToNextChar();

        while (SkipString() || SkipComment())
            ;

        // use 'while' here to cater for consecutive blocks to skip (e.g. sometemplate<foo>(bar)
        // must skip <foo> and immediately after (bar))
        // because if we don't, the next block won't be skipped ((bar) in the example) leading to weird
        // parsing results
        bool done = false;
        while (supportNesting && !done)
        {
            switch (CurrentChar())
            {
                case '#':
                    if (skipPreprocessor)
                        SkipToEOL(true);
                    else
                        done = true;
                    break;
                case '{': SkipBlock('{'); break;
                case '(': SkipBlock('('); break;
                case '[': SkipBlock('['); break;
                case '<': // don't skip if << operator
                    if (skipAngleBrace)
                    {
                        if (NextChar() == '<')
                            MoveToNextChar(2); // skip it and also the next '<' or the next '<' leads to a SkipBlock('<');
                        else
                            SkipBlock('<');
                        break;
                    }

                default: done = true; break;
            }
        }

    }

    return NotEOF();
}
开发者ID:stahta01,项目名称:EmBlocks,代码行数:46,代码来源:tokenizer.cpp

示例13: while

wxString wxTextInputStream::ReadLine()
{
    wxString line;

    while ( !m_input.Eof() )
    {
        wxChar c = NextChar();
        if(c == wxEOT)
            break;

        if (EatEOL(c))
            break;

        line += c;
    }

    return line;
}
开发者ID:erwincoumans,项目名称:wxWidgets,代码行数:18,代码来源:txtstrm.cpp

示例14: CError

static void CError( void )
{
    size_t      len;
    bool        save;

    len = 0;
    while( CurrChar != '\n' && CurrChar != '\r' && CurrChar != EOF_CHAR ) {
        if( len != 0 || CurrChar != ' ' ) {
            Buffer[len++] = CurrChar;
        }
        NextChar();
    }
    Buffer[len] = '\0';
    /* Force #error output to be reported, even with preprocessor */
    save = CompFlags.cpp_output;
    CompFlags.cpp_output = FALSE;
    CErr2p( ERR_USER_ERROR_MSG, Buffer );
    CompFlags.cpp_output = save;
}
开发者ID:Graham-stott,项目名称:open-watcom-v2,代码行数:19,代码来源:cmac2.c

示例15: ReadIdent

static void ReadIdent (void)
/* Read an identifier from the current input position into Ident. Filling SVal
** starts at the current position with the next character in C. It is assumed
** that any characters already filled in are ok, and the character in C is
** checked.
*/
{
    /* Read the identifier */
    do {
        SB_AppendChar (&CurTok.SVal, C);
        NextChar ();
    } while (IsIdChar (C));
    SB_Terminate (&CurTok.SVal);

    /* If we should ignore case, convert the identifier to upper case */
    if (IgnoreCase) {
        UpcaseSVal ();
    }
}
开发者ID:pfusik,项目名称:cc65,代码行数:19,代码来源:scanner.c


注:本文中的NextChar函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。