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

C++ parseIdentifier函数代码示例

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

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



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

示例1: peekChar

// Parse one simple selector, e.g.: `type#id.class1.class2.class3`
SimpleSelector CSSParser::parseSimpleSelector(){
    QString tagName;
    QString id;
    QVector<QString> classes;
    if(!eof()){
        QChar c = peekChar();
        if(c == '#'){
            consumeChar('#');
            id = parseIdentifier();
            qDebug() << "#";
        } else if(c == '.') {
            consumeChar('.');
            classes.append(parseIdentifier());
            qDebug() << ".";
        } else if(c == '*'){
            consumeChar('*');//TODO
            qDebug() << "*";
        } else if(isVaidIdentifier(c)){
            //h1 div.note
            tagName = parseIdentifier();
        }
    }
    SimpleSelector ret{tagName, id, classes};
#ifdef CSS_DEBUG
    qDebug() << Q_FUNC_INFO;
#endif /* CSS_DEBUG */
    return ret;

}
开发者ID:longwei,项目名称:toyBrowser,代码行数:30,代码来源:cssparser.cpp


示例2: parseCommands

static std::vector<AlterMetaDataCommand> parseCommands( const std::string& source)
{
	std::vector<AlterMetaDataCommand> rt;
	std::string::const_iterator si = source.begin(), se = source.end();

	for (si = skipSpaces( si, se); si != se; si = skipSpaces( si, se))
	{
		std::string cmd( parseIdentifier( si, se, _TXT("command name")));
		if (strus::utils::caseInsensitiveEquals( cmd, "Alter"))
		{
			std::string name( parseIdentifier( si, se, _TXT("old element name")));
			std::string newname( parseIdentifier( si, se, _TXT("new element name")));
			std::string type( parseIdentifier( si, se, _TXT("new element type")));

			rt.push_back( AlterMetaDataCommand::AlterElement( name, newname, type));
		}
		else if (strus::utils::caseInsensitiveEquals( cmd, "Add"))
		{
			std::string name( parseIdentifier( si, se, _TXT("element name")));
			std::string type( parseIdentifier( si, se, _TXT("element type name")));

			rt.push_back( AlterMetaDataCommand::AddElement( name, type));
		}
		else if (strus::utils::caseInsensitiveEquals( cmd, "Rename"))
		{
			std::string name( parseIdentifier( si, se, _TXT("old element name")));
			std::string newname( parseIdentifier( si, se, _TXT("new element name")));

			rt.push_back( AlterMetaDataCommand::RenameElement( name, newname));
		}
		else if (strus::utils::caseInsensitiveEquals( cmd, "Delete"))
		{
			std::string name( parseIdentifier( si, se, _TXT("element name")));

			rt.push_back( AlterMetaDataCommand::DeleteElement( name));
		}
		else if (strus::utils::caseInsensitiveEquals( cmd, "Clear"))
		{
			std::string name( parseIdentifier( si, se, _TXT("element name")));
			
			rt.push_back( AlterMetaDataCommand::ClearValue( name));
		}
		si = skipSpaces( si, se);
		if (si == se)
		{
			break;
		}
		else if (*si == ';')
		{
			++si;
		}
		else
		{
			std::string str( si, si+30);
			throw strus::runtime_error( _TXT( "semicolon expected as separator of commands at '..."), str.c_str());
		}
	}
	return rt;
}
开发者ID:andreasbaumann,项目名称:strusUtilities,代码行数:59,代码来源:strusAlterMetaData.cpp


示例3: parseIdentifier

bool
PluginIdentifier::areIdentifiersSimilar(QString id1, QString id2)
{
    QString type1, type2, soName1, soName2, label1, label2;

    parseIdentifier(id1, type1, soName1, label1);
    parseIdentifier(id2, type2, soName2, label2);

    if (type1 != type2 || label1 != label2)
        return false;

    bool similar = (soName1.section('/', -1).section('.', 0, 0) ==
                    soName2.section('/', -1).section('.', 0, 0));

    return similar;
}
开发者ID:EQ4,项目名称:RosegardenW,代码行数:16,代码来源:PluginIdentifier.cpp


示例4: parseIdentifier

  //----------------------------------------------------------------------------
  bool XmlConfig::setParameter( const std::string& key,
                                const std::string& val,
                                const std::string& type )
  {
    if( !_config )
      return false;

    std::cout << "setParameter(key = " << key
                         << ", val = " << val
                         << ", type = " << type
                         << ")"
                         << std::endl;

    //resolve parts of identifier (Renderer:FeatureX) and find in config
    std::string valname;
    TiXmlNode* container = parseIdentifier(key, valname, true);

    if( key.length() > valname.length() + 1 )
    {
      std::string component_name =
        key.substr(0, key.length() - valname.length() - 1);
      Configurable* comp = findComponent(component_name);
      if( !comp )
        LOG_ERROR("No such component: " << component_name);
      else
        comp->setParameter(valname, val, type);
    }

    //check if exists
    TiXmlNode* node = container->FirstChild(valname);
    TiXmlElement* arg = 0;
    if( node )
    {
      arg = node->ToElement();

      //check if it matches
      int res = checkTypeMatch(key, arg, type);
      if(res == 1)
        arg->SetAttribute("type", type);
      else if(res == 0)
        return false;

    }
    else
    {
      //create new one
      arg = new TiXmlElement( valname );
      container->LinkEndChild(arg);
      arg->SetAttribute("type", type);
    }

    arg->SetAttribute("val", val);

    _dirty_write = true;

    saveFile(); // TODO check if multiple variables changed within small
                //      time window

    return true;
  }
开发者ID:Caleydo,项目名称:visuallinks,代码行数:61,代码来源:xmlconfig.cpp


示例5: assert

  //----------------------------------------------------------------------------
  XmlConfig::NodePtr XmlConfig::parseIdentifier( const std::string& identifier,
                                                 size_t pos,
                                                 NodePtr container,
                                                 std::string& valname,
                                                 bool create )
  {
    size_t p = identifier.find_first_of(':', pos);
    if(p == std::string::npos)
    {
      valname = identifier.substr(pos);
      return container;
    }

    assert(container);

    std::string containername = identifier.substr(pos, p-pos);
    TiXmlElement* child = 0;
    TiXmlNode* node = container->FirstChild(containername);
    if( !node )
    {
      if( !create )
        return 0;

      child = new TiXmlElement( containername );
      container->LinkEndChild(child);
    }
    else
      child = node->ToElement();

    return parseIdentifier(identifier, p+1, child, valname, create);
  }
开发者ID:Caleydo,项目名称:visuallinks,代码行数:32,代码来源:xmlconfig.cpp


示例6: parseSimpleTag

static void parseSimpleTag (const unsigned char *cp, erlangKind kind)
{
	vString *const identifier = vStringNew ();
	parseIdentifier (cp, identifier);
	makeSimpleTag (identifier, ErlangKinds, kind);
	vStringDelete (identifier);
}
开发者ID:simlrh,项目名称:ctags,代码行数:7,代码来源:erlang.c


示例7: lookForNextToken

char *OpenDDLParser::parseName( char *in, char *end, Name **name ) {
    *name = ddl_nullptr;
    if( ddl_nullptr == in || in == end ) {
        return in;
    }

    // ignore blanks
    in = lookForNextToken( in, end );
    if( *in != '$' && *in != '%' ) {
        return in;
    }

    NameType ntype( GlobalName );
    if( *in == '%' ) {
        ntype = LocalName;
    }
    in++;
    Name *currentName( ddl_nullptr );
    Text *id( ddl_nullptr );
    in = parseIdentifier( in, end, &id );
    if( id ) {
        currentName = new Name( ntype, id );
        if( currentName ) {
            *name = currentName;
        }
    }

    return in;
}
开发者ID:1vanK,项目名称:Urho3D,代码行数:29,代码来源:OpenDDLParser.cpp


示例8: parseFunctionTag

static void parseFunctionTag (const unsigned char *cp, vString *const module)
{
	vString *const identifier = vStringNew ();
	parseIdentifier (cp, identifier);
	makeMemberTag (identifier, K_FUNCTION, module);
	vStringDelete (identifier);
}
开发者ID:simlrh,项目名称:ctags,代码行数:7,代码来源:erlang.c


示例9: visit

    boost::any visit( FunctionDeclaration functionDeclaration ) {

        extractToken( TokenType::KeywordFunction );

        functionDeclaration->identifier = parseIdentifier();

        extractToken( TokenType::PunctuatorOpeningParenthesis );

        while( !currentTokenIs(TokenType::PunctuatorClosingParenthesis) ) {

            if( !functionDeclaration->arguments.empty() )
                extractToken( TokenType::PunctuatorComma );

            functionDeclaration->arguments.emplace_back(
                parse<_FunctionArgument>() );
        }

        extractToken( TokenType::PunctuatorClosingParenthesis );

        if( !currentTokenIs(TokenType::PunctuatorOpeningBrace) )
            functionDeclaration->returnType = parse<_Type>();

        functionDeclaration->block = parse<_Block>();

        return boost::any();
    }
开发者ID:vanderlokken,项目名称:8b,代码行数:26,代码来源:Parser.cpp


示例10: skipWhitespace

    Token Lexer::parseNext() {
        //skip whitespace of the current character
        skipWhitespace();

        //return eof if we are at the end
        if (curChar() == '\0') {
            return Token::Eof;
        }

        Token ret;

        //first check if it is a keyword and return it
        ret = parseKeyword();
        if (ret != Token::None)
            return ret;
        ret = parseSymbol();
        if (ret != Token::None)
            return ret;
        ret = parseIdentifier();
        if (ret != Token::None)
            return ret;
        ret = parseNumeric();
        if (ret != Token::None)
            return ret;

        //if nothing was able to parse it, it must be a character and we return it
        value.character = eatChar();
        return Token::Character;
    }
开发者ID:citiral,项目名称:Ola,代码行数:29,代码来源:lexer.cpp


示例11: parseDirective

/*
 * Directives are of the form:
 * def defp
 * defmacro defmacrop
 * defrecord
 * defmodule
 * defprotocol
 * defimpl
 */
static void parseDirective (const unsigned char *cp, vString *const module)
{
    vString *const directive = vStringNew ();
    const char *const drtv = vStringValue (directive);
    cp = parseIdentifier (cp, directive);
    skipWhitespace (&cp);
    /* if (*cp == '(') */
    /*     ++cp; */

    if (strcmp (drtv, "def") == 0 || strcmp (drtv, "defp") == 0)
        parseSimpleTag (cp, K_FUNCTION);
    else if (strcmp (drtv, "defmacro") == 0 || strcmp (drtv, "defmacrop") == 0)
        parseSimpleTag (cp, K_MACRO);
    else if (strcmp (drtv, "defrecord") == 0)
        parseSimpleTag (cp, K_RECORD);
    else if (strcmp (drtv, "defmodule") == 0)
        parseSimpleTag (cp, K_MODULE);
    else if (strcmp (drtv, "defprotocol") == 0)
        parseSimpleTag(cp, K_PROTOCOL);
    else if (strcmp (drtv, "defimpl") == 0)
        parseSimpleTag(cp, K_IMPL);
    /* Otherwise, it was an import, require, etc. */

    vStringDelete (directive);
}
开发者ID:jsvisa,项目名称:ctags,代码行数:34,代码来源:elixir.c


示例12: parseDirective

/*
 * Directives are of the form:
 * -module(foo)
 * -define(foo, bar)
 * -record(graph, {vtab = notable, cyclic = true}).
 * -type some_type() :: any().
 * -opaque some_opaque_type() :: any().
 */
static void parseDirective (const unsigned char *cp, vString *const module)
{
	/*
	 * A directive will be either a record definition or a directive.
	 * Record definitions are handled separately
	 */
	vString *const directive = vStringNew ();
	const char *const drtv = vStringValue (directive);
	cp = parseIdentifier (cp, directive);
	cp = skipSpace (cp);
	if (*cp == '(')
		++cp;

	if (strcmp (drtv, "record") == 0)
		parseSimpleTag (cp, K_RECORD);
	else if (strcmp (drtv, "define") == 0)
		parseSimpleTag (cp, K_MACRO);
	else if (strcmp (drtv, "type") == 0)
		parseSimpleTag (cp, K_TYPE);
	else if (strcmp (drtv, "opaque") == 0)
		parseSimpleTag (cp, K_TYPE);
	else if (strcmp (drtv, "module") == 0)
		parseModuleTag (cp, module);
	/* Otherwise, it was an import, export, etc. */
	
	vStringDelete (directive);
}
开发者ID:simlrh,项目名称:ctags,代码行数:35,代码来源:erlang.c


示例13: parseMarkupDescriptions

std::vector<MarkupDescription> parseMarkupDescriptions( const std::string& src)
{
	char const* si = src.c_str();
	try
	{
		std::vector<MarkupDescription> rt;
		while (*si)
		{
			si = skipNextNonSpace( si);
			if (!isDigit(*si)) throw std::runtime_error("position number expected as 1st argument of markup description)");
			unsigned int position = parseUintValue( si);
			si = skipNextNonSpace( si);
			unsigned int offset = parseUintValue( si);
			si = skipNextNonSpace( si);
			char type = *si++;
			if (type != '>' && type != '<' && type != '@') throw std::runtime_error("expected '<' or '>' or '@' as type (2nd argument of markup description)");
			si = skipNextNonSpace( si);
			if (!isAlpha(*si)) throw std::runtime_error("identifier expected as 3rd argument of markup description");
			std::string name = parseIdentifier( si);
			si = skipNextNonSpace( si);
			char const* expr = si;
			si = skipEoln( si);
			std::string value( expr, si - expr);
			rt.push_back( MarkupDescription( position, offset, type, name, value));
			++si;
		}
		return rt;
	}
	catch (const std::runtime_error& err)
	{
		std::ostringstream msg;
		msg << "error on line " << getLine( src.c_str(), si) << " of markup description file: " << err.what();
		throw std::runtime_error( msg.str());
	}
}
开发者ID:andreasbaumann,项目名称:strusAnalyzer,代码行数:35,代码来源:testMarkupTextwolf.cpp


示例14: parseAtom

QVariant
parseAtom(ParserState &st)
{
    checkEndOfFile(st);

    if (isalpha(*st.ptr))
    {
        return parseIdentifier(st);
    }
    else if (isdigit(*st.ptr))
    {
        return parseNumber(st);
    }
    else if (*st.ptr == '-')
    {
        st.ptr++;
        return -parseNumber(st);
    }
    else if (*st.ptr == '"')
    {
        return parseString(st);
    }
    else
    {
        throw ParserError(QString("unexpected character '%1'").arg(*st.ptr));
    }
}
开发者ID:Disasm,项目名称:vlsi-craft,代码行数:27,代码来源:parser.cpp


示例15: parseIdentifier

PARSENODE_PTR SQLParser::parseExpression() {
    PARSENODE_PTR columnNode = parseIdentifier();
    PARSENODE_PTR opNode = parseOperator();
    PARSENODE_PTR valueNode = parseLiteral();
    opNode->children.push_back(columnNode);
    opNode->children.push_back(valueNode);
    return opNode;
}
开发者ID:LLLLKKKK,项目名称:miniSQL,代码行数:8,代码来源:SQLParser.cpp


示例16: parse

  bool parse(const char *subEngineString) {
    // Ignore whitespaces
    subEngineString = parseWhitespaces(subEngineString);

    // Extract engine identifier. It can be empty at this point
    const char *beginOfIdentifier = subEngineString;
    subEngineString = parseIdentifier(subEngineString);
    engineName.assign(beginOfIdentifier, subEngineString - beginOfIdentifier);

    // Ignore whitespaces
    subEngineString = parseWhitespaces(subEngineString);

    // String termination is allowed at this place
    if (!*subEngineString)
        return true;

    // Otherwise colon must be specified and engine identifier cannot be empty
    if (!engineName.length() ||  (*subEngineString != ':')
            ||  (*(subEngineString+1) == '\0'))
        LOG(FATAL) << "Wrong engine specification";

    // Process sub engines
    subEngineString++;
    while (true) {
      // Ignore separators
      subEngineString = parseSeparators(subEngineString);

      // String termination is allowed at this place
      if (!*subEngineString)
          return true;

      // Extract sub engine identifier
      const char *beginOfIdentifier = subEngineString;
      subEngineString = parseIdentifier(subEngineString);

      // Identifier can not be empty nor contain invalid characters
      if (beginOfIdentifier == subEngineString)
          return false;

      // Collect all valid sub engine names
      std::string subEngineName;
      subEngineName.assign(beginOfIdentifier,
              subEngineString - beginOfIdentifier);
      subEngines.push_back(subEngineName);
    }
  }
开发者ID:intel,项目名称:caffe,代码行数:46,代码来源:engine_parser.hpp


示例17: parseIdentifier

Unit CSSParser::parseUnit(){
    QString u = parseIdentifier().toLower();
    if (u == "px") {
        return Unit::Px;
    } else {
        qDebug() << "Unrecognized unit";
        return Unit::Undefined;
    }
}
开发者ID:longwei,项目名称:toyBrowser,代码行数:9,代码来源:cssparser.cpp


示例18: factor

FactorPtr Parser::parseFactor()
{
    FactorPtr factor(new Factor);

    if (m_curToken.tokenType() == TokenType::Number) {
        factor->number = parseNumber();
        if (m_errorCode > ErrorCodes::NoError) {
            panic(factorFollow, factorFollowSize);
            return FactorPtr();
        }

        return factor;
    } else if (m_curToken.tokenType() == TokenType::LParen) {
        match(TokenType::LParen);

        ExpressionPtr expr = parseExpression();
        if (m_errorCode > ErrorCodes::NoError) {
            panic(factorFollow, factorFollowSize);
            return FactorPtr();
        }

        if (!match(TokenType::RParen)) {
            reportError(ErrorCodes::ExpectedRParen);

            panic(factorFollow, factorFollowSize);
            return FactorPtr();
        }

        factor->expression = expr;
        return factor;
    } else if (m_curToken.tokenType() == TokenType::Not) {
        match(TokenType::Not);

        factor->negatedFactor = parseFactor();
        if (m_errorCode > ErrorCodes::NoError) {
            panic(factorFollow, factorFollowSize);
            return FactorPtr();
        }

        return factor;
    }

    IdentifierPtr identifier = parseIdentifier();
    if (m_errorCode > ErrorCodes::NoError) {
        panic(factorFollow, factorFollowSize);
        return FactorPtr();
    }

    parseFactor_p(identifier);
    if (m_errorCode > ErrorCodes::NoError) {
        panic(factorFollow, factorFollowSize);
        return FactorPtr();
    }

    factor->id = identifier;
    return factor;
}
开发者ID:asgeir,项目名称:old-school-projects,代码行数:57,代码来源:Parser.cpp


示例19: parseInput

bool CVarConsole::parseInput(char* input) {
	if(strlen(input) == 0) return true;

	if(parseAssignment(input)) return true;
	if(parseCommand(input)) return true;
	if(parseIdentifier(input)) return true;

	return false;
}
开发者ID:AlexanderDzhoganov,项目名称:Icebreaker,代码行数:9,代码来源:cvar_console.cpp


示例20: parseObject

bool parseObject(File& file, Object& out_obj)
{
	file.str++; // consume '{'

	skipWhitespaces(file);

	while(*file.str != '}')
	{
		std::string key;

		uint32_t key_line_num = file.current_line_num;

		if(!parseIdentifier(file, key))
		{
			std::cout << "Line " << key_line_num << ": Error parsing identifier!\n";
			return false;
		}
		else if(key.empty())
		{
			std::cout << "Line " << key_line_num << ": Identifier can't be an empty string!\n";
			return false;
		}

		if(out_obj[key] != nullptr)
		{
			std::cout << "Line " << key_line_num << ": Key '" << key << "' already exists!\n";
			return false;
		}

		skipWhitespaces(file);

		if(*file.str != '=')
		{
			std::cout << "Line " << file.current_line_num << ": Expected '=' not found!\n";
			return false;
		}

		file.str++; //consume '='

		skipWhitespaces(file);

		Value value;

		if(!parseValue(file, value))
			return false;

		out_obj.insert(std::move(key), std::move(value), key_line_num);

		skipWhitespaces(file);
	}

	//consume '}'
	file.str++;

	return true;
}
开发者ID:tiagovcosta,项目名称:aquaengine,代码行数:56,代码来源:sjson.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ parseInput函数代码示例发布时间:2022-05-30
下一篇:
C++ parseHeader函数代码示例发布时间: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