• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ readIdentifier函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: tagNonTerminal

void CompilationEngine::compileClassVarDec()
{
    /* ('static' | 'field') type varName (',' varName)* ';' */

    tagNonTerminal("classVarDec");

    if (jt.keyword() == Keyword::kFIELD)
        readKeyword("field", Keyword::kFIELD);
    else
        readKeyword("static", Keyword::kSTATIC);

    nextToken();
    readType();
    nextToken();
    readIdentifier();
    nextToken();

    while (jt.tokenType() == TokenType::kSYMBOL && jt.symbol() == ',') {
        readSymbol(',');
        nextToken();
        readIdentifier();
        nextToken();
    }

    readSymbol(';');
    untagNonTerminal("classVarDec");
    nextToken();
}
开发者ID:npat1126,项目名称:nand2tetris,代码行数:28,代码来源:CompilationEngine.cpp


示例2: readIdentifier

void CompilationEngine::compileSubroutineCall(string subName)
{
    /*
        subroutineName '(' expressionList ')' |
        (className | varName) '.' subroutineName '(' expression ')'
    */

    string oldTok = jt.getToken();
    jt.setToken(subName);
    readIdentifier();
    jt.setToken(oldTok);

    if (jt.tokenType() == TokenType::kSYMBOL && jt.symbol() == '(') {

        readSymbol('(');
        nextToken();
        compileExpressionList();
        readSymbol(')');

    } else {

        readSymbol('.');
        nextToken();
        readIdentifier();
        nextToken();
        readSymbol('(');
        nextToken();
        compileExpressionList();
        readSymbol(')');

    }

    nextToken();
}
开发者ID:npat1126,项目名称:nand2tetris,代码行数:34,代码来源:CompilationEngine.cpp


示例3: findSchemeTags

static void findSchemeTags (void)
{
	vString *name = vStringNew ();
	const unsigned char *line;

	while ((line = readLineFromInputFile ()) != NULL)
	{
		const unsigned char *cp = line;

		if (cp [0] == '(' &&
			(cp [1] == 'D' || cp [1] == 'd') &&
			(cp [2] == 'E' || cp [2] == 'e') &&
			(cp [3] == 'F' || cp [3] == 'f'))
		{
			while (*cp != '\0'  &&  !isspace (*cp))
				cp++;
			/* Skip over open parens and white space */
			do {
				while (*cp != '\0' && (isspace (*cp) || *cp == '('))
					cp++;
				if (*cp == '\0')
					cp = line = readLineFromInputFile ();
				else
					break;
			} while (line);
			if (line == NULL)
				break;
			readIdentifier (name, cp);
			makeSimpleTag (name, SchemeKinds, K_FUNCTION);
		}
		if (cp [0] == '(' &&
			(cp [1] == 'S' || cp [1] == 's') &&
			(cp [2] == 'E' || cp [2] == 'e') &&
			(cp [3] == 'T' || cp [3] == 't') &&
			(cp [4] == '!') &&
			(isspace (cp [5]) || cp[5] == '\0'))
		{
			cp += 5;
			/* Skip over white space */
			do {
				while (*cp != '\0' && isspace (*cp))
					cp++;
				if (*cp == '\0')
					cp = line = readLineFromInputFile ();
				else
					break;
			} while (line);
			if (line == NULL)
				break;
			readIdentifier (name, cp);
			makeSimpleTag (name, SchemeKinds, K_SET);
		}
	}
	vStringDelete (name);
}
开发者ID:qzhuyan,项目名称:ctags,代码行数:55,代码来源:scheme.c


示例4: directiveDefine

static int directiveDefine (const int c, bool undef)
{
	int r = CORK_NIL;

	if (cppIsident1 (c))
	{
		bool parameterized;
		int nc;

		readIdentifier (c, Cpp.directive.name);
		nc = getcAndCollect ();
		parameterized = (nc == '(');
		if (parameterized)
		{
			cppStartCollectingSignature ();
			while (nc != EOF)
			{
				int lastC = nc;
				nc = getcAndCollect ();
				if (nc == '\n' && lastC != '\\')
					break;
			}
			cppStopCollectingSignature ();
		}
		ungetcAndCollect (nc);
		if (! isIgnore ())
			makeDefineTag (vStringValue (Cpp.directive.name), parameterized, undef);
	}
	Cpp.directive.state = DRCTV_NONE;
	return r;
}
开发者ID:StefanOberhumer,项目名称:geany,代码行数:31,代码来源:lcpp.c


示例5: switch

void CompilationEngine::readType()
{
    if (jt.tokenType() == TokenType::kKEYWORD) {

        switch (jt.keyword()) {

            case Keyword::kINT:
                readKeyword("int", Keyword::kINT);
                break;

            case Keyword::kCHAR:
                readKeyword("char", Keyword::kCHAR);
                break;

            case Keyword::kBOOLEAN:
                readKeyword("boolean", Keyword::kBOOLEAN);
                break;

            default:
                break;
        }

    } else {
        readIdentifier();
    }
}
开发者ID:npat1126,项目名称:nand2tetris,代码行数:26,代码来源:CompilationEngine.cpp


示例6: findVerilogTags

static void findVerilogTags (void)
{
	vString *const name = vStringNew ();
	volatile bool newStatement = true;
	volatile int c = '\0';
	exception_t exception = (exception_t) setjmp (Exception);

	if (exception == ExceptionNone) while (c != EOF)
	{
		c = vGetc ();
		switch (c)
		{
			case ';':
			case '\n':
				newStatement = true;
				break;

			case ' ':
			case '\t':
				break;

			default:
				if (newStatement && readIdentifier (name, c))
					findTag (name);
				newStatement = false;
				break;
		}
	}
	vStringDelete (name);
}
开发者ID:ParrotSec,项目名称:geany,代码行数:30,代码来源:verilog.c


示例7: processTypedef

static void processTypedef (tokenInfo *const token)
{
	/*Note: At the moment, only identifies typedef name and not its contents */
	int c;

	/* Get identifiers */
	c = skipWhite (vGetc ());
	while (isIdentifierCharacter (c))
	{
		readIdentifier (token, c);
		c = skipWhite (vGetc ());
	}

	/* Skip bus width definition */
	if (c == '[')
	{
		skipPastMatch ("[]");
		c = skipWhite (vGetc ());
	}

	/* Skip typedef contents */
	if (c == '{')
	{
		skipPastMatch ("{}");
		c = skipWhite (vGetc ());
	}

	/* Skip past class parameter override */
	if (c == '#')
	{
		c = skipWhite (vGetc ());
		if (c == '(')
		{
			skipPastMatch ("()");
		}
		c = skipWhite (vGetc ());
	}

	/* Read new typedef identifier */
	if (isIdentifierCharacter (c))
	{
		readIdentifier (token, c);
	}

	/* Use last identifier to create tag */
	createTag (token);
}
开发者ID:shunlir,项目名称:ctags,代码行数:47,代码来源:verilog.c


示例8: searchChild

QString NSParser::readVar(Symbol* symbol)
{
	QString varName;
	Symbol* identifier = searchChild(symbol, SYM_IDENTIFIER);
	if (identifier)
		varName = readIdentifier(identifier);

	return varName;
}
开发者ID:axd1967,项目名称:PC,代码行数:9,代码来源:NSParser_BasicTypes.cpp


示例9: tagNameList

static void tagNameList (const vhdlKind kind, int c)
{
    Assert (isIdentifierCharacter (c));
	if (isIdentifierCharacter (c))
	{
		readIdentifier (TagName, c);
		makeSimpleTag (TagName, VhdlKinds, kind);
	}
}
开发者ID:Fordi,项目名称:geany,代码行数:9,代码来源:vhdl.c


示例10: findVerilogTags

static void findVerilogTags (void)
{
	tokenInfo *const token = newToken ();
	int c = '\0';
	currentContext = newToken ();

	while (c != EOF)
	{
		c = vGetc ();
		c = skipWhite (c);
		switch (c)
		{
			/* Store current block name whenever a : is found
			 * This is used later by any tag type that requires this information
			 * */
			case ':':
				vStringCopy (currentContext->blockName, token->name);
				break;
			/* Skip interface modport port declarations */
			case '(':
				if (currentContext && currentContext->lastKind == K_MODPORT)
				{
					skipPastMatch ("()");
				}
				break;
			/* Drop context on prototypes because they don't have an end
			 * statement */
			case ';':
				if (currentContext->scope && currentContext->scope->prototype)
				{
					verbose ("Dropping context %s\n", vStringValue (currentContext->name));
					currentContext = popToken (currentContext);
					currentContext->prototype = FALSE;
				}
				/* Prototypes end at the end of statement */
				if (currentContext->prototype)
				{
					currentContext->prototype = FALSE;
				}
				break;
			default :
				if (isIdentifierCharacter (c))
				{
					readIdentifier (token, c);
					updateKind (token);
					findTag (token);
				}
		}
	}

	deleteToken (token);
	pruneTokens (currentContext);
	currentContext = NULL;
}
开发者ID:Luoben,项目名称:ctags,代码行数:54,代码来源:verilog.c


示例11: findTag

static void findTag (vString *const name)
{
	int c = '\0';
	vhdlKind kind;
    vStringCopyToLower (Keyword, name);
    kind = (vhdlKind)lookupKeyword (vStringValue (Keyword), Lang_vhdl);
    if (kind == K_UNDEFINED)
	{
		c = skipWhite (vGetc ());
		vStringCopyS(Lastname,vStringValue(name));
			if (c == ':')
			{
				c = skipWhite (vGetc ());
				if (isIdentifierCharacter (c))
				{
					readIdentifier (name, c);
					vStringCopyToLower (Keyword, name);
					lookupKeyword (vStringValue (Keyword), Lang_vhdl);
					kind = (vhdlKind)lookupKeyword (vStringValue (Keyword), Lang_vhdl);
					if (kind == K_PROCESS || kind == K_BLOCK || kind == K_PORT)
					{
						makeSimpleTag (Lastname, VhdlKinds, kind);
					}
				}
			} else {
				vUngetc (c);
			}
	}
	else
	{
		if (kind == K_SIGNAL) {
			while (c!=':') {
				c = skipWhite (vGetc ());
				if (c==',')
					c = vGetc ();
				if (isIdentifierCharacter (c))
					tagNameList (kind, c);
				else
					break;
				c = vGetc ();
			}
		}
		else if (kind == K_PROCESS || kind == K_BLOCK) {
			vStringCopyS(TagName,"unnamed");
			makeSimpleTag (TagName, VhdlKinds, kind);
		} else {
			c = skipWhite (vGetc ());
			if (c=='\"')
				c = vGetc ();
			if (isIdentifierCharacter (c))
				tagNameList (kind, c);
		}
	}
}
开发者ID:Fordi,项目名称:geany,代码行数:54,代码来源:vhdl.c


示例12: directivePragma

static void directivePragma (int c)
{
	if (cppIsident1 (c))
	{
		readIdentifier (c, Cpp.directive.name);
		if (stringMatch (vStringValue (Cpp.directive.name), "weak"))
		{
			/* generate macro tag for weak name */
			do
			{
				c = getcAndCollect ();
			} while (c == SPACE);
			if (cppIsident1 (c))
			{
				readIdentifier (c, Cpp.directive.name);
				makeDefineTag (vStringValue (Cpp.directive.name), NULL, false);
			}
		}
	}
	Cpp.directive.state = DRCTV_NONE;
}
开发者ID:StefanOberhumer,项目名称:geany,代码行数:21,代码来源:lcpp.c


示例13: skipMacro

static int skipMacro (int c)
{
	tokenInfo *token = newToken ();;

	if (c == '`')
	{
		/* Skip keyword */
		if (isIdentifierCharacter (c = vGetc ()))
		{
			readIdentifier (token, c);
			c = vGetc ();
			/* Skip next keyword if macro is `ifdef or `ifndef or `elsif*/
			if (strcmp (vStringValue (token->name), "ifdef") == 0 ||
			    strcmp (vStringValue (token->name), "ifndef") == 0 ||
				strcmp (vStringValue (token->name), "elsif") == 0)
			{
				verbose ("%c\n", c);
				c = skipWhite (c);
				readIdentifier (token, c);
				c = vGetc ();
				verbose ("Skipping conditional macro %s\n", vStringValue (token->name));
			}
			/* Skip macro functions */
			else
			{
				c = skipWhite (c);
				if (c == '(')
				{
					c = skipPastMatch ("()");
				}
			}
		}
	}
	deleteToken (token);
	return c;
}
开发者ID:shunlir,项目名称:ctags,代码行数:36,代码来源:verilog.c


示例14: findBlockName

static boolean findBlockName (tokenInfo *const token)
{
	int c;

	c = skipWhite (vGetc ());
	if (c == ':')
	{
		c = skipWhite (vGetc ());
		readIdentifier (token, c);
		return (boolean) (vStringLength (token->name) > 0);
	}
	else
		vUngetc (c);
	return FALSE;
}
开发者ID:shunlir,项目名称:ctags,代码行数:15,代码来源:verilog.c


示例15: processFunction

static void processFunction (tokenInfo *const token)
{
	int c;
	tokenInfo *classType;

	/* Search for function name
	 * Last identifier found before a '(' or a ';' is the function name */
	c = skipWhite (vGetc ());
	do
	{
		readIdentifier (token, c);
		c = skipWhite (vGetc ());
		/* Identify class type prefixes and create respective context*/
		if (isLanguage (Lang_systemverilog) && c == ':')
		{
			c = vGetc ();
			if (c == ':')
			{
				verbose ("Found function declaration with class type %s\n", vStringValue (token->name));
				classType = newToken ();
				vStringCopy (classType->name, token->name);
				classType->kind = K_CLASS;
				createContext (classType);
				currentContext->classScope = TRUE;
			}
			else
			{
				vUngetc (c);
			}
		}
	} while (c != '(' && c != ';' && c != EOF);

	if ( vStringLength (token->name) > 0 )
	{
		verbose ("Found function: %s\n", vStringValue (token->name));

		/* Create tag */
		createTag (token);

		/* Get port list from function */
		processPortList (c);
	}
}
开发者ID:Luoben,项目名称:ctags,代码行数:43,代码来源:verilog.c


示例16: tagNameList

static void tagNameList (const verilogKind kind, int c)
{
	vString *name = vStringNew ();
	bool repeat;
	Assert (isIdentifierCharacter (c));
	do
	{
		repeat = false;
		if (isIdentifierCharacter (c))
		{
			readIdentifier (name, c);
			makeSimpleTag (name, VerilogKinds, kind);
		}
		else
			break;
		c = skipWhite (vGetc ());
		if (c == '[')
			c = skipPastMatch ("[]");
		c = skipWhite (c);
		if (c == '=')
		{
			c = skipWhite (vGetc ());
			if (c == '{')
				skipPastMatch ("{}");
			else
			{
				do
					c = vGetc ();
				while (c != ','  &&  c != ';');
			}
		}
		if (c == ',')
		{
			c = skipWhite (vGetc ());
			repeat = true;
		}
		else
			repeat = false;
	} while (repeat);
	vStringDelete (name);
	vUngetc (c);
}
开发者ID:ParrotSec,项目名称:geany,代码行数:42,代码来源:verilog.c


示例17: findTag

static void findTag (vString *const name)
{
	const verilogKind kind = (verilogKind) lookupKeyword (vStringValue (name), Lang_verilog);
	if (kind == K_CONSTANT && vStringItem (name, 0) == '`')
	{
		/* Bug #961001: Verilog compiler directives are line-based. */
		int c = skipWhite (vGetc ());
		readIdentifier (name, c);
		makeSimpleTag (name, VerilogKinds, kind);
		/* Skip the rest of the line. */
		do {
			c = vGetc();
		} while (c != '\n');
		vUngetc (c);
	}
	else if (kind != K_UNDEFINED)
	{
		int c = skipWhite (vGetc ());

		/* Many keywords can have bit width.
		*   reg [3:0] net_name;
		*   inout [(`DBUSWIDTH-1):0] databus;
		*/
		if (c == '(')
			c = skipPastMatch ("()");
		c = skipWhite (c);
		if (c == '[')
			c = skipPastMatch ("[]");
		c = skipWhite (c);
		if (c == '#')
		{
			c = vGetc ();
			if (c == '(')
				c = skipPastMatch ("()");
		}
		c = skipWhite (c);
		if (isIdentifierCharacter (c))
			tagNameList (kind, c);
	}
}
开发者ID:ParrotSec,项目名称:geany,代码行数:40,代码来源:verilog.c


示例18: findVhdlTags

static void findVhdlTags (void)
{
    volatile boolean newStatement = TRUE;
    volatile int c = '\0';
    exception_t exception = (exception_t) setjmp (Exception);
	Name = vStringNew ();
    Lastname = vStringNew ();
    Keyword = vStringNew ();
    TagName = vStringNew ();

    if (exception == ExceptionNone) while (c != EOF)
    {
		c = vGetc ();
		switch (c)
		{
			case ';':
			case '\n':
			newStatement = TRUE;
			break;

			case ' ':
			case '\t':
			break;

			default:
			if (newStatement && readIdentifier (Name, c)) {
				findTag (Name);
				}
			newStatement = FALSE;
			break;
		}
    }
    vStringDelete (Name);
    vStringDelete (Lastname);
    vStringDelete (Keyword);
    vStringDelete (TagName);
}
开发者ID:Fordi,项目名称:geany,代码行数:37,代码来源:vhdl.c


示例19: processFunction

static void processFunction (tokenInfo *const token)
{
	int c;

	/* Search for function name
	 * Last identifier found before a '(' or a ';' is the function name */
	c = skipWhite (vGetc ());
	do
	{
		readIdentifier (token, c);
		c = skipWhite (vGetc ());
	} while (c != '(' && c != ';' && c != EOF);

	if ( vStringLength (token->name) > 0 )
	{
		verbose ("Found function: %s\n", vStringValue (token->name));

		/* Create tag */
		createTag (token);

		/* Get port list from function */
		processPortList (c);
	}
}
开发者ID:shunlir,项目名称:ctags,代码行数:24,代码来源:verilog.c


示例20: findMakeTags

static void findMakeTags (void)
{
    stringList *identifiers = stringListNew ();
    boolean newline = TRUE;
    boolean in_define = FALSE;
    boolean in_rule = FALSE;
    boolean variable_possible = TRUE;
    int c;

    while ((c = nextChar ()) != EOF)
    {
        if (newline)
        {
            if (in_rule)
            {
                if (c == '\t' || (c = skipToNonWhite (c)) == '#')
                {
                    skipLine ();  /* skip rule or comment */
                    c = nextChar ();
                }
                else if (c != '\n')
                    in_rule = FALSE;
            }
            stringListClear (identifiers);
            variable_possible = (boolean)(!in_rule);
            newline = FALSE;
        }
        if (c == '\n')
            newline = TRUE;
        else if (isspace (c))
            continue;
        else if (c == '#')
            skipLine ();
        else if (variable_possible && c == '?')
        {
            c = nextChar ();
            ungetcToInputFile (c);
            variable_possible = (c == '=');
        }
        else if (variable_possible && c == ':' &&
                 stringListCount (identifiers) > 0)
        {
            c = nextChar ();
            ungetcToInputFile (c);
            if (c != '=')
            {
                unsigned int i;
                for (i = 0; i < stringListCount (identifiers); i++)
                    newTarget (stringListItem (identifiers, i));
                stringListClear (identifiers);
                in_rule = TRUE;
            }
        }
        else if (variable_possible && c == '=' &&
                 stringListCount (identifiers) == 1)
        {
            newMacro (stringListItem (identifiers, 0));
            skipLine ();
            in_rule = FALSE;
        }
        else if (variable_possible && isIdentifier (c))
        {
            vString *name = vStringNew ();
            readIdentifier (c, name);
            stringListAdd (identifiers, name);

            if (stringListCount (identifiers) == 1)
            {
                if (in_define && ! strcmp (vStringValue (name), "endef"))
                    in_define = FALSE;
                else if (in_define)
                    skipLine ();
                else if (! strcmp (vStringValue (name), "define"))
                {
                    in_define = TRUE;
                    c = skipToNonWhite (nextChar ());
                    vStringClear (name);
                    /* all remaining characters on the line are the name -- even spaces */
                    while (c != EOF && c != '\n')
                    {
                        vStringPut (name, c);
                        c = nextChar ();
                    }
                    if (c == '\n')
                        ungetcToInputFile (c);
                    vStringTerminate (name);
                    vStringStripTrailing (name);
                    newMacro (name);
                }
                else if (! strcmp (vStringValue (name), "export"))
                    stringListClear (identifiers);
                else if (! strcmp (vStringValue (name), "include")
                         || ! strcmp (vStringValue (name), "sinclude")
                         || ! strcmp (vStringValue (name), "-include"))
                {
                    boolean optional = (vStringValue (name)[0] == 'i')? FALSE: TRUE;
                    while (1)
                    {
                        c = skipToNonWhite (nextChar ());
                        readIdentifier (c, name);
//.........这里部分代码省略.........
开发者ID:jonthn,项目名称:ctags,代码行数:101,代码来源:make.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ readImage函数代码示例发布时间:2022-05-30
下一篇:
C++ readHeader函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap