本文整理汇总了C++中scanner函数的典型用法代码示例。如果您正苦于以下问题:C++ scanner函数的具体用法?C++ scanner怎么用?C++ scanner使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scanner函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: generateFakeArchive
rc_t generateFakeArchive(LogArchiver::ArchiveDirectory* dir,
unsigned bytesPerRun, unsigned runCount, unsigned& total)
{
total = 0;
LogFactory factory(true, // sorted
1, // start with this page ID
10, // new page ID every 10 logrecs
1 // increment max pade ID one by one
);
logrec_t lr;
unsigned runsGen = 0;
// create LogScanner to know which logrecs are ignored
LogScanner scanner(BLOCK_SIZE);
LogArchiver::initLogScanner(&scanner);
LogArchiver::BlockAssembly assemb(dir);
while (runsGen < runCount) {
unsigned bytesGen = 0;
assemb.start(runsGen);
while (bytesGen < bytesPerRun) {
factory.next(&lr);
if (scanner.isIgnored(lr.type())) {
continue;
}
assert(lr.valid_header(lr.lsn_ck()));
if (!assemb.add(&lr)) {
assemb.finish();
assemb.start(runsGen);
bool worked = assemb.add(&lr);
EXPECT_TRUE(worked);
}
bytesGen += lr.length();
total++;
}
assemb.finish();
runsGen++;
}
assemb.shutdown();
return RCOK;
}
开发者ID:shemmer,项目名称:zero,代码行数:49,代码来源:test_logarchiver.cpp
示例2: ParseUMapInfo
int ParseUMapInfo(int lumpnum)
{
FScanner scanner(lumpnum);
unsigned int i;
while (scanner.GetToken())
{
scanner.TokenMustBe(TK_Map);
UMapEntry parsed;
ParseMapEntry(scanner, &parsed);
// Endpic overrides level exits.
if (parsed.endpic[0])
{
parsed.nextmap[0] = parsed.nextsecret[0] = 0;
if (parsed.endpic[0] == '!') parsed.endpic[0] = 0;
}
/*
else if (!parsed.nextmap[0] && !parsed.endpic[0])
{
if (!parsed.MapName.CompareNoCase("MAP30")) uppercopy(parsed.endpic, "$CAST");
else if (!parsed.MapName.CompareNoCase("E1M8")) uppercopy(parsed.endpic, gameinfo.creditPages.Last());
else if (!parsed.MapName.CompareNoCase("E2M8")) uppercopy(parsed.endpic, "VICTORY");
else if (!parsed.MapName.CompareNoCase("E3M8")) uppercopy(parsed.endpic, "$BUNNY");
else if (!parsed.MapName.CompareNoCase("E4M8")) uppercopy(parsed.endpic, "ENDPIC");
else if (gameinfo.gametype == GAME_Chex && !parsed.MapName.CompareNoCase("E1M5")) uppercopy(parsed.endpic, "CREDIT");
else
{
parsed.nextmap[0] = 0; // keep previous setting
}
}
*/
// Does this property already exist? If yes, replace it.
for(i = 0; i < Maps.Size(); i++)
{
if (!parsed.MapName.Compare(Maps[i].MapName))
{
Maps[i] = parsed;
return 1;
}
}
// Not found so create a new one.
Maps.Push(parsed);
}
return 1;
}
开发者ID:coelckers,项目名称:gzdoom,代码行数:49,代码来源:umapinfo.cpp
示例3: QFileInfo
QVariant Driver::parse(const QString &filename) {
QString filePath = QFileInfo(filename).canonicalFilePath();
Scanner scanner(filePath);
Driver driver(filePath, scanner);
Parser parser(driver);
parser.parse();
if (!driver.rootCtx()->m_errors.isEmpty()) {
throw ErrorParserException(driver.rootCtx()->m_errors.join("\n"));
}
QVariantMap resProps;
resProps[NODE_KEY_VERSION] = 1;
resProps[NODE_KEY_MEMBERS] = driver.m_localElts;
resProps[NODE_KEY_NODE_TYPE] = TYPE_NODE_FRAGMENT;
return resProps;
}
开发者ID:mbedsys,项目名称:NodeBus,代码行数:15,代码来源:driver.cpp
示例4: indigoGetInstance
Reaction & IndigoCdxReaction::getReaction ()
{
if (!_loaded)
{
Indigo &self = indigoGetInstance();
BufferScanner scanner(_data);
ReactionCdxLoader loader(scanner);
loader.stereochemistry_options = self.stereochemistry_options;
loader.ignore_bad_valence = self.ignore_bad_valence;
loader.loadReaction(_rxn);
_loaded = true;
}
return _rxn;
}
开发者ID:epam,项目名称:Indigo,代码行数:15,代码来源:indigo_loaders.cpp
示例5: lista_declaraciones_init
void lista_declaraciones_init() {
if (sbol->codigo == CIDENT) {
strcpy(inf_id->nbre,sbol->lexema);
scanner();
} else {
error_handler(16); // falta identificador
}
tipo_global = inf_id->ptr_tipo;
inf_id->clase = CLASVAR;
declarador_init();
if (!insertarTS()) {
error_handler(9);
}
while (sbol->codigo == CCOMA) {
scanner();
if (sbol->codigo == CIDENT) {
strcpy(inf_id->nbre,sbol->lexema);
inf_id->ptr_tipo = tipo_global;
inf_id->clase = CLASVAR;
scanner();
} else {
error_handler(16); // falta identificador
}
declarador_init();
if (!insertarTS()) {
error_handler(9);
}
}
}
开发者ID:dnoseda,项目名称:alto-publisher,代码行数:36,代码来源:parser.c
示例6: scanner
PluralFormsCalculator* PluralFormsCalculator::make(const char* s)
{
PluralFormsCalculator* calculator = new PluralFormsCalculator;
if (s != NULL)
{
PluralFormsScanner scanner(s);
PluralFormsParser p(scanner);
if (!p.parse(*calculator))
{
delete calculator;
return NULL;
}
}
return calculator;
}
开发者ID:AdeebNqo,项目名称:poedit,代码行数:15,代码来源:pl_evaluate.cpp
示例7: scanner
void RingoFastIndex::_decompressRowid (const Array<char> &stored, OraRowidText &rid)
{
BufferScanner scanner(stored.ptr() + 2, stored[1]);
RowIDLoader loader(_context.context().context().rid_dict, scanner);
QS_DEF(Array<char>, rowid);
loader.loadRowID(rowid);
if (rowid.size() != 18)
throw Error("rowid size=%d?", rowid.size());
memcpy(rid.ptr(), rowid.ptr(), 18);
rid.ptr()[18] = 0;
}
开发者ID:mojca,项目名称:indigo,代码行数:15,代码来源:ringo_fast_index.cpp
示例8: _ext_scan_at
cmark_bufsize_t _ext_scan_at(cmark_bufsize_t (*scanner)(const unsigned char *),
const char *s, cmark_bufsize_t offset)
{
cmark_bufsize_t res;
cmark_bufsize_t len = strlen(s);
unsigned char *ptr = (unsigned char *)s;
if (ptr == NULL || offset > len) {
return 0;
} else {
res = scanner(ptr + offset);
}
return res;
}
开发者ID:gdesmott,项目名称:hotdoc,代码行数:15,代码来源:cmark_gtkdoc_scanner.c
示例9: stat_f
//<stat> -> <in> | <out> | <block> | <if> | <loop> | <assign>
node_t* stat_f() {
node_t *p = getNode("<stat>");
if (tk.tokenId == SCAN_tk) { // <in>
p->child1 = getNode("SCAN");
tk = scanner(fp, lineNum);
p->child2 = in_f();
return p;
} else if (tk.tokenId == PRINT_tk) { // <out>
p->child1 = getNode("PRINT");
tk = scanner(fp, lineNum);
p->child2 = out_f();
return p;
} else if (tk.name == "{") { // <block>
//don't need to put delimiters in the tree
p->child1 = block_f();
return p;
} else if (tk.tokenId == IF_tk) { // <if>
p->child1 = getNode("IF");
tk = scanner(fp, lineNum);
p->child2 = if_f();
return p;
} else if (tk.tokenId == LOOP_tk) { // <loop>
p->child1 = getNode("LOOP");
tk = scanner(fp, lineNum);
p->child2 = loop_f();
return p;
} else if (tk.tokenId == IDENT_tk) { // <assign>
p->child1 = assign_f();
return p;
} else {
error("Got token " + tk.name + ", expected SCAN, PRINT, {, IF, LOOP, or IDENTIFIER token\n");
}
return p;
}
开发者ID:ncivili,项目名称:CS4280Compilers,代码行数:37,代码来源:parser.cpp
示例10: prog_f
//<program> -> PROGRAM <var> <block>
node_t* prog_f() {
node_t *p = getNode("<program>");
if(tk.tokenId == PROG_tk) { // PROGRAM
p->child1 = getNode("PROGRAM");
tk = scanner(fp, lineNum);
p->child2 = var_f();
p->child3 = block_f();
return p;
} else {
error("Got token " + tk.name + ", expected PROGRAM token\n");
}
return p;
}
开发者ID:ncivili,项目名称:CS4280Compilers,代码行数:16,代码来源:parser.cpp
示例11: compile
sim::Llvm_library compile(ast::Node_if const& ast_root,
std::string const& defaultname) {
ir::Library<Llvm_impl> rv;
rv.name = defaultname;
rv.ns = std::make_shared<sim::Llvm_namespace>();
ast::Ast_printer printer(std::cout);
ast_root.accept(printer);
Llvm_namespace_scanner scanner(*rv.ns);
ast_root.accept(scanner);
return rv;
}
开发者ID:five-elephants,项目名称:cell,代码行数:15,代码来源:compile.cpp
示例12: TEST
TEST(HttpMultipartScannerTest, Reset) {
HttpMultipartScanner scanner("foo", true);
scanner.Execute("abcdefg---\r\n--foo\r\n");
EXPECT_TRUE(scanner.IsDone());
EXPECT_EQ(scanner.GetSkipped(), "abcdefg---\r\n--foo\r\n");
scanner.Reset(true);
EXPECT_FALSE(scanner.IsDone());
scanner.SetBoundary("bar");
scanner.Execute("--foo\r\n--bar\r\n");
EXPECT_TRUE(scanner.IsDone());
EXPECT_EQ(scanner.GetSkipped(), "--foo\r\n--bar\r\n");
}
开发者ID:AustinShalit,项目名称:allwpilib,代码行数:15,代码来源:HttpUtilTest.cpp
示例13: scanner
void KNNTest::run() {
Scanner scanner("cpp/ml/test/TestKNNInput.txt");
Writer writer("cpp/ml/test/TestKNNOutput.txt");
KNN kNN(3);
DatasetClassification dataset("cpp/ml/test/TestKNNData.txt");
CrossValidatorParameter parameter;
while (scanner.hasNext()) {
parameter.testingDataRatio = scanner.nextDouble();
CrossValidatorClassification validator(&kNN, &dataset, ¶meter);
validator.validate();
double testingErr = validator.getTestingError();
writer.println(testingErr);
}
writer.close();
}
开发者ID:ycgsb,项目名称:Gaea,代码行数:15,代码来源:KNNTest.cpp
示例14: _ringoRegisterReaction
bool _ringoRegisterReaction (OracleEnv &env, const char *rowid,
const Array<char> &reaction_buf,
RingoOracleContext &context,
RingoIndex &index,
BingoFingerprints &fingerprints)
{
QS_DEF(Array<char>, data);
QS_DEF(Array<char>, compressed_rowid);
ArrayOutput output(data);
output.writeChar(0); // 0 -- present, 1 -- removed from index
ArrayOutput rid_output(compressed_rowid);
RowIDSaver rid_saver(context.context().rid_dict, rid_output);
rid_saver.saveRowID(rowid);
output.writeByte((byte)compressed_rowid.size());
output.writeArray(compressed_rowid);
TRY_READ_TARGET_RXN
{
BufferScanner scanner(reaction_buf);
try
{
index.prepare(scanner, output, NULL);
}
catch (CmfSaver::Error &e)
{
if (context.context().reject_invalid_structures)
throw; // Rethrow this exception further
env.dbgPrintf(bad_reaction_warning_rowid, rowid, e.message());
return false;
}
catch (CrfSaver::Error &e)
{
if (context.context().reject_invalid_structures)
throw; // Rethrow this exception further
env.dbgPrintf(bad_reaction_warning_rowid, rowid, e.message());
return false;
}
}
CATCH_READ_TARGET_RXN_ROWID(rowid, {
if (context.context().reject_invalid_structures)
throw; // Rethrow this exception further
return false;
});
开发者ID:equilion,项目名称:indigo,代码行数:48,代码来源:ringo_oracle_index.cpp
示例15: main
int main(int argc, const char * argv[])
{
/******************************************
This is not a correct implementation, you will need to modfy this
so that it satisfies the project problem. Currently, this just
prints every token and then deletes every token.
*****************************************/
Token *token = NULL;
char source_name[MAX_FILE_NAME_LENGTH];
char date[DATE_STRING_LENGTH];
FILE *source_file = init_lister(argv[1], source_name, date);
Print print(source_name, date);
Scanner scanner(source_file, source_name, date, print);
////
Token* identifierSearchTreeHead = NULL;
////
do
{
//token: "Token* token"
token = scanner.getToken();
print.printToken(token);
if (token->getCode() != PERIOD && token->getCode() != END_OF_FILE)
{
//?????????????????TODO: add identifiers to binary tree and add line numbers where
// the identifier shows up to a linked list stored in the identifier token
if(token->getCode() == IDENTIFIER){
Token::addTokenNodeToBinarySearchTree(identifierSearchTreeHead, token, scanner.getLineNumber());
}else if(token->getCode() != PERIOD && token->getCode() != END_OF_FILE){
delete token;
}
}
}
while (token->getCode() != PERIOD && token->getCode() != END_OF_FILE);
//print line number info for identifier tokens
cout << "\nCross Reference Information\n";
cout << "Identifier\t\tLine Numbers\n";
cout << "-----------\t\t------------\n";
cout << Token::getBinarySearchTreeLinesStringsInOrder(identifierSearchTreeHead);
delete token;
delete identifierSearchTreeHead;
fclose(source_file);
return 0;
}
开发者ID:rgonza26,项目名称:4thLab,代码行数:48,代码来源:main.cpp
示例16: indigoGetInstance
const char * IndigoRdfReaction::getName ()
{
if (_loaded)
return _rxn.name.ptr();
Indigo &self = indigoGetInstance();
BufferScanner scanner(_data);
scanner.readLine(self.tmp_string, true);
if (strcmp(self.tmp_string.ptr(), "$RXN") != 0)
throw IndigoError("IndigoRdfReaction::getName(): unexpected first line in the files with reactions."
"'%s' has been found but '$RXN' has been expected.");
// Read next line with the name
scanner.readLine(self.tmp_string, true);
return self.tmp_string.ptr();
}
开发者ID:cambDI,项目名称:camb,代码行数:16,代码来源:indigo_loaders.cpp
示例17: checkSpelling
/*
* Function: checkSpelling
* --------------------
* This program checks the spelling of words in an input file.
*/
void checkSpelling(void) {
std::ifstream infile;
askUserForInputFile("Enter file name: ", infile);
Lexicon dictionary("Resources/dictionary2.txt");
TokenScanner scanner(infile);
while(scanner.hasMoreTokens()) {
std::string word = scanner.nextToken();
if (isAllAlpha(word) && !dictionary.contains(word)) {
cout << word << ": is not in the dictionary" << endl;
}
}
infile.close();
}
开发者ID:mahmoudmheisen91,项目名称:Programing_Abstractions,代码行数:21,代码来源:chapterFourProblems.cpp
示例18: main
int main(void)
{
STATUS status = STATUS_OK;
do
{
std::cout<<"> ";
std::string buf;
std::getline(std::cin, buf);
//std::cout<<buf<<std::endl;
Scanner scanner(buf);
Parser parser(scanner);
parser.Parse();
std::cout<<parser.Calculate()<<std::endl;
} while (status != STATUS_QUIT);
return 0;
}
开发者ID:SunLightJuly,项目名称:code_repository,代码行数:16,代码来源:main.cpp
示例19: proposicion_e_s
void proposicion_e_s() {
switch(sbol->codigo) {
case CIN: {
scanner();
if (sbol->codigo == CSHR) {
scanner();
} else {
error_handler(28); // falta >>
}
variable();
while (sbol->codigo == CSHR) {
scanner();
variable();
}
if (sbol->codigo == CPYCOMA) {
scanner();
} else {
error_handler(22); // falta ;
}
break;
}
case COUT: {
scanner();
if (sbol->codigo == CSHL) {
scanner();
} else {
error_handler(29); // falta <<
}
expresion();
while (sbol->codigo == CSHL) {
scanner();
expresion();
}
if (sbol->codigo == CPYCOMA) {
scanner();
} else {
error_handler(22); // falta ;
}
break;
}
default:
error_handler(30); // %& //falta << o >>
}
}
开发者ID:dnoseda,项目名称:alto-publisher,代码行数:45,代码来源:parser.c
示例20: scanner
void Monitor::send_leaks() {
// get zone
Zone *zone = (Zone *)strtoul(_args[2], NULL, 0);
// run a FULL collection first.
// auto_collect((auto_zone_t *)zone, AUTO_COLLECTION_FULL_COLLECTION, NULL);
// scan from threads
LeakScanner scanner(zone, _stack_bottom);
scanner.scan();
// send response
print("leaks %s\n", _args[1]);
send_leaks_visitor visitor(this);
BlockIterator<send_leaks_visitor> iterator(zone, visitor);
iterator.visit();
print("\\leaks\n");
// clear marks
zone->reset_all_marks_and_pending();
}
开发者ID:Sophrinix,项目名称:iphone-macruby,代码行数:17,代码来源:AutoMonitor.cpp
注:本文中的scanner函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论