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


C++ Scanner类代码示例

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


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

示例1: highlightImport

void Highlighter::highlightImport(Scanner &scanner)
{
    FormatToken tk;
    while ((tk = scanner.read()).format() != Format_EndOfBlock)
    {
        Format format = tk.format();
        if (tk.format() == Format_IDENTIFIER)
            format = Format_IMPORTED_MODULE;
        setFormat(tk.begin(), tk.length(), _formats[format]);
    }
}
开发者ID:sergey-shambir,项目名称:sergey-shambir-sandbox,代码行数:11,代码来源:highlighter.cpp

示例2: parseMnemoGcnAtomic

Inst parseMnemoGcnAtomic(unsigned opCode, Scanner& scanner, Brigantine& bw, int*)
{
    unsigned  const atomicOperation = scanner.eatToken(EMAtomicOp);
    OptionalU const segment         = scanner.tryEatToken(EMSegment);
    unsigned  const memoryOrder     = scanner.eatToken(EMMemoryOrder);
    unsigned  const memoryScope     = scanner.eatToken(EMMemoryScope);
    OptionalU const equivClass      = tryParseEquiv(scanner);
    unsigned  const type            = scanner.eatToken(EMType);
    
    scanner.eatToken(EMNone);

    InstAtomic res = bw.addInst<InstAtomic>(opCode,type);

    res.atomicOperation() = atomicOperation;
    res.segment()         = BrigSegment(segment.isInitialized() ? segment.value() : BRIG_SEGMENT_AMD_GCN);
    res.equivClass()      = equivClass.isInitialized() ? equivClass.value() : 0;
    res.memoryOrder()     = memoryOrder;
    res.memoryScope()     = memoryScope;
    return res;
}
开发者ID:HSAFoundation,项目名称:HSAIL-Tools,代码行数:20,代码来源:gcn.cpp

示例3: take_cloud

  void take_cloud(Scanner& scanner)
  {
    cuda::DeviceArray<Point> cloud = scanner.tsdf().fetchCloud(cloud_buffer);
    cuda::DeviceArray<Normal> normal;
    cuda::DeviceArray<RGB> color;

    scanner.tsdf().fetchNormals(cloud, normal);
    //scanner.tsdf().fetchTangentColors(cloud, color);
    scanner.tsdf().fetchVertexColors(cloud, color);

    cv::Mat cloud_host(1, (int)cloud.size(), CV_32FC4);
    cv::Mat normal_host(1, (int)normal.size(), CV_32FC4);
    cv::Mat color_host(1, (int)cloud.size(), CV_8UC4);

    cloud.download(cloud_host.ptr<Point>());
    normal.download(normal_host.ptr<Normal>());
    color.download(color_host.ptr<RGB>());

    viz.showWidget("Colored Cloud", cv::viz::WCloud(cloud_host, color_host, normal_host));
  }
开发者ID:pntripathi9417,项目名称:VogueMirror,代码行数:20,代码来源:vm_scanner.cpp

示例4: parseInt

    bool LineParser::parseInt (int value, const TokenLoc& loc, Scanner& scanner)
    {
        if (mAllowExpression && mState==BeginState)
        {
            scanner.putbackInt (value, loc);
            parseExpression (scanner, loc);
            return true;
        }

        return Parser::parseInt (value, loc, scanner);
    }
开发者ID:ChairGraveyard,项目名称:TES3MP,代码行数:11,代码来源:lineparser.cpp

示例5: highlightImport

void LuaHighlighter::highlightImport(Scanner& scanner)
{
	FormatToken tk;
	while((tk = scanner.read()).format() != Format_EndOfBlock)
	{
		Format format = tk.format();
		if(format == Format_Identifier)
			format = Format_RequiredModule;
		setFormat(tk.begin(), tk.length(), formatForCategory(format));
	}
}
开发者ID:EssGeeEich,项目名称:LuaEditor,代码行数:11,代码来源:luahighlighter.cpp

示例6: main

int main( int argc, char* argv[] ) {
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);	
	#endif

	/*
	freopen("input-nn.txt","w",stdout);
	cout<<1<<endl;
	int n=100000;
	cout<<n<<endl;
	set<pii> s;
	rep(i,n){
	int x=rand();
	int y=rand();
	pii p=mp(x,y);
	if(s.count(p)){i--; continue;}
	s.insert(p);			
	cout<<x<<" "<<y<<endl;
	}
	exit(0);
	*/

	Scanner sc;
	int testCases = sc.nextInt();
	for(int testCase=1;testCase<=testCases;testCase++){
		int n = sc.nextInt();
		vpii p(n);
		rep(i,n){
			p[i].first = sc.nextInt();
			p[i].second= sc.nextInt();
		}

		buildTree(0, n, &(vpii(p)[0]));

		//fprintf(stderr,"time=%.3lfsec\n",0.001*(clock()-start));

		rep(i,n){
			findNearestNeighbour(n, p[i].first, p[i].second);
			printf("%lld\n", closestDist);			
		}
开发者ID:Aakash1996,项目名称:spoj-1,代码行数:41,代码来源:MLE.cpp

示例7: main

int main(int argc, const char* argv[])
{
	std::string userInput; // Variable to hold user input
	Scanner *scanner = new Scanner();

	const int NUMBER_OF_FILES = 2;
	string testFiles[NUMBER_OF_FILES] = { "test.txt", "test1.txt" };
	fstream sourceFile;
	PreProcessor *preProcessor = new PreProcessor();

	Parser *parser = new Parser();

	if (argc > 1)
	{
		ProcessCommands(std::string(argv[1]));
		string temp = argv[1];
		if (temp.compare("-h") != 0 && ProcessCommands(temp))
		{
			Load(argv[1], sourceFile);
			scanner->Load(preProcessor->Process(sourceFile));
			parser->Parse(scanner->Tokenize());
			parser->PrintReport();
		}
	}
	else
	{
		for (int i = 0; i < NUMBER_OF_FILES; i++)
		{
			Load(testFiles[i], sourceFile);
			scanner->Load(preProcessor->Process(sourceFile));
			parser->Parse(scanner->Tokenize());
			parser->PrintReport();
		}
	}

	do
	{
		std::cout << ">> ";
		getline(std::cin, userInput);
		if (userInput.compare("-h") != 0 && ProcessCommands(userInput))
		{
			scanner->Load(userInput);
			scanner->Tokenize();
			scanner->PrintReport();
		}
	} while (ProcessCommands(userInput));

	delete preProcessor, scanner, parser;

	return 0;
}
开发者ID:Zanion,项目名称:ZRuby-Compiler,代码行数:51,代码来源:main.cpp

示例8: save_mesh

  void save_mesh(Scanner& scanner)
  {   
    cuda::DeviceArray<Point> cloud = scanner.tsdf().fetchCloud(cloud_buffer);
    cuda::DeviceArray<RGB> tangent_color;
    cuda::DeviceArray<RGB> vertex_color;

    scanner.tsdf().fetchVertexColors(cloud, vertex_color);
    scanner.tsdf().fetchTangentColors(cloud, tangent_color);

    cv::Mat cloud_host(1, (int)cloud.size(), CV_32FC4);
    cv::Mat vertex_color_host(1, (int)vertex_color.size(), CV_8UC4);
    cv::Mat tangent_color_host(1, (int)tangent_color.size(), CV_8UC4);

    cloud.download(cloud_host.ptr<Point>());
    vertex_color.download(vertex_color_host.ptr<RGB>());
    tangent_color.download(tangent_color_host.ptr<RGB>());
    
    cv::viz::writeCloud("model_color.ply", cloud_host, vertex_color_host);
    cv::viz::writeCloud("model_tangent.ply", cloud_host, tangent_color_host);
    combine_mesh();
  }
开发者ID:pntripathi9417,项目名称:VogueMirror,代码行数:21,代码来源:vm_scanner.cpp

示例9: main

int main()
{
  Scanner scanner;

  if (!scanner.scan()) {
    std::cout << "scan fail" << std::endl;
    std::cout << scanner.get_root() << std::endl;
    return 0;
  }
  
  std::map<std::string, std::string> uri_class_table = scanner.get_uri_class_table();
  std::map<std::pair<std::string, std::string>, std::string> uri_method_table = scanner.get_uri_method_table();
  std::map<std::string, std::string>::iterator iter = uri_class_table.begin();
  std::map<std::pair<std::string, std::string>, std::string>::iterator it = uri_method_table.begin();

  for (; iter != uri_class_table.end(); iter++)
    std::cout << "URI:" << iter->first << "\tCLASS:" << iter->second << std::endl;

  for (; it != uri_method_table.end(); it++)
    std::cout << "PATH: " << it->first.first << "  METHOD: " << it->first.second << "  FUNCTION:" << it->second << std::endl;
}
开发者ID:buaaspy,项目名称:iou,代码行数:21,代码来源:test_scanner.cpp

示例10: hornclause

void hornclause(Scanner & s)
{
	if (s.Peek().token_type == TOKENS::LABEL)
	{
		head(s);
		x_1(s);
	}
	else
	{
		oops("hornclause", s, "LABEL");
	}
}
开发者ID:BazzalSeed,项目名称:Programming-Systems-and-Languages,代码行数:12,代码来源:cse425_lab0.cpp

示例11: loadLexerState

int CodeFormatter::tokenizeBlock(const QTextBlock &block)
{
    int startState = loadLexerState(block.previous());
    if (block.blockNumber() == 0)
        startState = 0;
    Q_ASSERT(startState != -1);

    Scanner tokenize;
    tokenize.setScanComments(true);

    m_currentLine = block.text();
    // to determine whether a line was joined, Tokenizer needs a
    // newline character at the end
    m_currentLine.append(QLatin1Char('\n'));
    m_tokens = tokenize(m_currentLine, startState);

    const int lexerState = tokenize.state();
    QTextBlock saveableBlock(block);
    saveLexerState(&saveableBlock, lexerState);
    return lexerState;
}
开发者ID:ProDataLab,项目名称:qt-creator,代码行数:21,代码来源:qmljscodeformatter.cpp

示例12: body

void body(Scanner & s)
{
	if (s.Peek().token_type == TOKENS::LABEL)
	{
		predicate(s);
		x_2(s);
	}
	else
	{
		oops("body", s, "LABEL");
	}
}
开发者ID:BazzalSeed,项目名称:Programming-Systems-and-Languages,代码行数:12,代码来源:cse425_lab0.cpp

示例13: predicate

void predicate(Scanner & s)
{
	if (s.Peek().token_type == TOKENS::LABEL)
	{
		name(s);
		x_3(s);
	}
	else
	{
		oops("predicate", s, "LABEL");
	}
}
开发者ID:BazzalSeed,项目名称:Programming-Systems-and-Languages,代码行数:12,代码来源:cse425_lab0.cpp

示例14: head

void head(Scanner & s)
{
	if (s.Peek().token_type == TOKENS::LABEL)
	{
		predicate(s);
		x_6(s);
	}
	else
	{
		oops("head", s, "LABEL");
	}
}
开发者ID:BazzalSeed,项目名称:Programming-Systems-and-Languages,代码行数:12,代码来源:cse425_lab0.cpp

示例15: cleanEquation

string CompiledModelGenerator::substituteTerms(const string& reactionName, const string& inputEquation, bool bFixAmounts)
{
    string equation = cleanEquation(inputEquation);
    if (equation.size() < 1)
    {
        return string("0");
    }

     Scanner s;
     stringstream ss;
     ss<<equation;

     s.AssignStream(ss);
     s.startScanner();
     s.nextToken();
     CodeBuilder sb;

    try
    {
        while (s.token() != CodeTypes::tEndOfStreamToken)
        {
            substituteToken(reactionName, bFixAmounts, s, sb);
            s.nextToken();
        }
    }
    catch (const Exception& e)
    {
       throw Exception(e.Message());
    }
    return sb.ToString();
}
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:31,代码来源:rrCompiledModelGenerator.cpp


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