示例#1
0
/*  This puts a character back into the input queue for the input File.
 *  Up to two characters may be ungotten.
 */
extern void cppUngetc (const int c)
{
	Assert (Cpp.ungetch2 == '\0');
	Cpp.ungetch2 = Cpp.ungetch;
	Cpp.ungetch = c;
	if (collectingSignature)
		vStringChop (signature);
}
示例#2
0
文件: go.c 项目: 15ramky/geany
static void parseFunctionOrMethod (tokenInfo *const token)
{
	// FunctionDecl = "func" identifier Signature [ Body ] .
	// Body         = Block.
	//
	// MethodDecl   = "func" Receiver MethodName Signature [ Body ] .
	// Receiver     = "(" [ identifier ] [ "*" ] BaseTypeName ")" .
	// BaseTypeName = identifier .

	// Skip over receiver.
	readToken (token);
	if (isType (token, TOKEN_OPEN_PAREN))
		skipToMatched (token);

	if (isType (token, TOKEN_IDENTIFIER))
	{
		vString *argList;
		tokenInfo *functionToken = copyToken (token);

		// Start recording signature
		signature = vStringNew ();

		// Skip over parameters.
		readToken (token);
		skipToMatchedNoRead (token);

		vStringStripLeading (signature);
		vStringStripTrailing (signature);
		argList = signature;
		signature = vStringNew ();

		readToken (token);

		// Skip over result.
		skipType (token);

		// Remove the extra { we have just read
		vStringStripTrailing (signature);
		vStringChop (signature);

		vStringStripLeading (signature);
		vStringStripTrailing (signature);
		makeTag (functionToken, GOTAG_FUNCTION, NULL, GOTAG_UNDEFINED, argList->buffer, signature->buffer);
		deleteToken (functionToken);
		vStringDelete(signature);
		vStringDelete(argList);

		// Stop recording signature
		signature = NULL;

		// Skip over function body.
		if (isType (token, TOKEN_OPEN_CURLY))
			skipToMatched (token);
	}
}
示例#3
0
static inline void ungetcAndCollect (int c)
{
	ungetcToInputFile (c);
	if (collectingSignature)
		vStringChop (signature);
}