您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ yylex_destroy函数代码示例

51自学网 2021-06-03 11:55:09
  C++
这篇教程C++ yylex_destroy函数代码示例写得很实用,希望能帮到您。

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

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

示例1: jsgf_parse_string

jsgf_t *jsgf_parse_string(const char *string, jsgf_t * parent){    yyscan_t yyscanner;    jsgf_t *jsgf;    int yyrv;    YY_BUFFER_STATE buf;    yylex_init(&yyscanner);    buf = yy_scan_string(string, yyscanner);    jsgf = jsgf_grammar_new(parent);    if (!parent)        jsgf_set_search_path(jsgf, NULL);    yyrv = yyparse(yyscanner, jsgf);    if (yyrv != 0) {        E_ERROR("Failed to parse JSGF grammar from input string/n");        jsgf_grammar_free(jsgf);        yy_delete_buffer(buf, yyscanner);        yylex_destroy(yyscanner);        return NULL;    }    yy_delete_buffer(buf, yyscanner);    yylex_destroy(yyscanner);    return jsgf;}
开发者ID:Amponti,项目名称:SpeechRecognition_DE1-SOC,代码行数:28,


示例2: jsgf_parse_file

jsgf_t *jsgf_parse_file(const char *filename, jsgf_t *parent){    yyscan_t yyscanner;    jsgf_t *jsgf;    int yyrv;    FILE *in = NULL;    yylex_init(&yyscanner);    if (filename == NULL) {        yyset_in(stdin, yyscanner);    }    else {        in = fopen(filename, "r");        if (in == NULL) {            E_ERROR_SYSTEM("Failed to open %s for parsing", filename);            return NULL;        }        yyset_in(in, yyscanner);    }    jsgf = jsgf_grammar_new(parent);    yyrv = yyparse(yyscanner, jsgf);    if (yyrv != 0) {        E_ERROR("Failed to parse JSGF grammar from '%s'/n", filename ? filename : "(stdin)");        jsgf_grammar_free(jsgf);        yylex_destroy(yyscanner);        return NULL;    }    if (in)        fclose(in);    yylex_destroy(yyscanner);    return jsgf;}
开发者ID:AaronZhangL,项目名称:pocketsphinx.js,代码行数:35,


示例3: create_graph

int create_graph(FILE* input){	yylex_destroy();	__click_modules = alloc_resource(sizeof(List));	__click_symbol_table = alloc_resource(sizeof(Map));	__click_edges = alloc_resource(sizeof(List));	init_list(__click_modules);	init_map(__click_symbol_table);	init_list(__click_edges);	yyset_in(input);	int ret = yyparse();	yylex_destroy();	int k;	for(k=0; k<__click_modules->len; k++)	{		Node* node = (Node*)__click_modules->list[k];		assert(node->type == Node_MODULE);		Module* module = (Module*)node->payload;		printf("%s::/t", module->name->payload);		ArgList* arglist = (ArgList*)module->args->payload;		int j;		for(j=0; j<arglist->len; j++)		{			Node* eacharg = (Node*)arglist->list[j];			if(eacharg == NULL)			{				printf("NULL ");			}			else if(eacharg->type == Node_VALUE_LIST)			{				ValueList* valuelist = (ValueList*)eacharg->payload;				int i;				for(i=0; i<valuelist->len; i++)				{					Node* eachval = (Node*)valuelist->list[i];					printf("%s ", eachval->payload);				}				printf(", ");			}			else			{				assert(0);			}		}		printf("/n");	}	clear_resource();	__click_modules = 0;	__click_symbol_table = 0;	__click_edges = 0;	return ret;}
开发者ID:leeopop,项目名称:click-parser,代码行数:57,


示例4: main

int main(int argc, char *argv[]){    /* instantiate and init calculator data */    CalcData calc_data;    if (yylex_init(&calc_data.scaninfo))    {        fprintf(stderr, "Fail initing scanner/n");        return(EXIT_FAILURE);    }    calc_data.symt = new SymbolTable;    /* set up input stream */    yyset_in(stdin, calc_data.scaninfo);    /* call the parser */    printf("> "); fflush(stdout);    int ret;    while ((ret=yyparse(&calc_data)) != 0)    {        printf("  = %g/n", calc_data.ast->eval());        printf("> "); fflush(stdout);    }    printf("/n");    /* clean up and quit */    yylex_destroy(calc_data.scaninfo);    delete calc_data.ast;    delete calc_data.symt;    return 0;}
开发者ID:pbmartins,项目名称:LFA,代码行数:32,


示例5: fsqlf_format_bytes

void fsqlf_format_bytes(fsqlf_kwmap_t kwmap,    const char *bytes_in, int len, char **bytes_out){    struct fsqlf_formatter_state f_state;    FSQLF_stack_init(&f_state.lexstate_stack, sizeof(int));    FSQLF_stack_init(&f_state.sub_openings, sizeof(pair));    FSQLF_tokque_init(&f_state.tqueue);    f_state.currindent = 0;    f_state.left_p = 0;    f_state.right_p = 0;    f_state.kwall = kwmap;    f_state.bout.len_used = 0;    f_state.bout.len_alloc = len * 1.5;    f_state.bout.buffer = malloc(f_state.bout.len_alloc);    yyscan_t scanner;    yylex_init(&scanner);    yy_scan_bytes(bytes_in, len, scanner);    yyset_extra(&f_state, scanner);    yylex(scanner);    *bytes_out = f_state.bout.buffer;    yylex_destroy(scanner);}
开发者ID:dnsmkl,项目名称:fsqlf,代码行数:26,


示例6: runCommand

/** * @function    runCommand * * @abstract    Parses and executes a command given a NULL terminated string. * @discussion  Parses the command and adds it to the history if it is *              nontrivial. * * @param       cmd_buffer      Pointer to NULL terminated string containing *                              the user input. * @result      Returns nothing, but runs a command, most likely printing to *              the terminal. */void runCommand(char* cmd_buffer) {    Command *command = NULL;    yyscan_t scanner;    YY_BUFFER_STATE state;    // Check if there is anything in the line.  It is useless to store    // a history of empty lines.  If it is not empty, then add it to our    // history.  Also don't want to record line rerun calls.    if ((cmd_buffer[0] != 0) && (cmd_buffer[0] != '!')) {        add_history(cmd_buffer);    }    state = yy_scan_string(cmd_buffer);    if (yyparse(&command, scanner)) {        printf("Error in parsing command./n");        deleteCommand(command);        return;    }    executeCommand(command, -1);    deleteCommand(command);    // Wait on all child processes    while (wait(NULL) > 0) {}    yy_delete_buffer(state);    yylex_destroy();    return;}
开发者ID:jerryxzhang,项目名称:Kernel-Sanders,代码行数:44,


示例7: source_parse_file

int source_parse_file(source *src, const char *filename, const char *modname){  YY_BUFFER_STATE bufstate;  int r;  if (NULL == (yyin = fopen(filename,"r"))) {    perror(filename);    return -1;  }  yyfilename = filename;  yyfileno = add_parsedfile(src,filename);    ////yyfileno is the index in the src->parsedfiles  yylloc.first_line = 1;  bufstate = yy_create_buffer(yyin,YY_BUF_SIZE);  yy_switch_to_buffer(bufstate);  parse_src = src;  parse_modname = modname ? modname : "";  r = yyparse();  yy_delete_buffer(bufstate);#if HAVE_YYLEX_DESTROY  yylex_destroy();#endif  if (yyin)    fclose(yyin);  return r;}
开发者ID:amirsalah,项目名称:cs2007,代码行数:29,


示例8: getAST

ltl_formula *getAST (const char *input){  ltl_formula *formula;  yyscan_t scanner;  YY_BUFFER_STATE state;  if (yylex_init (&scanner))    {      // couldn't initialize      return NULL;    }  state = yy_scan_string (input, scanner);  if (yyparse (&formula, scanner))    {      // error parsing      return NULL;    }  yy_delete_buffer (state, scanner);  yylex_destroy (scanner);  return formula;}
开发者ID:juzer10,项目名称:FSE-2014-Aalta,代码行数:25,


示例9: main

int main( int argc, const char *argv[] ) {    void *scanner;    FILE *input;    if( argc >= 2 ) input = fopen( argv[1], "r" );    else            input = stdin;    if( input == NULL ) {        perror( "cannot open input file" );        exit( 1 );    }    if( argc >= 3 )  {        mkparent( argv[2] );        FILE *res = freopen( argv[2], "w", stdout );        if( res == NULL ) {            perror( "cannot open output file" );            exit( 1 );        }    }    yylex_init( &scanner );    yyset_in( input, scanner );    yyparse( scanner );    yylex_destroy( scanner );    exit(0);}
开发者ID:austinhofmann,项目名称:School,代码行数:28,


示例10: do_range_expand

range* do_range_expand(range_request* rr, const char* text){    yyscan_t scanner;    struct range_extras extra;    int result;    if (text == NULL) {        range* r = range_new(rr);        range_request_set(rr, r);        return r;    }    current_rr = rr;    extra.rr = rr;    yylex_init(&scanner);    yyset_extra(&extra, scanner);    yy_scan_string(text, scanner);    result = yyparse(scanner);    yylex_destroy(scanner);    current_rr = NULL;    if (result != 0) {        range* r = range_new(rr);        range_request_warn(rr, "parsing [%s]", text);        range_request_set(rr, r);        return r;    }    range_request_set(rr, range_evaluate(rr, extra.theast));    return range_request_results(rr);}
开发者ID:anthonybishopric,项目名称:libcrange,代码行数:31,


示例11: yylex_init

bool InteractiveParser::parse(FILE *file, const std::string *filename, parser::ProgramNode &programStmts, stmtFunction callback) const {    yydebug = DEBUG_PARSER;    yyscan_t scanner;    yylex_init(&scanner);    bool interactive = (stdin == file);#ifndef OS_WINDOWS    interactive = interactive && (isatty(fileno(file)) == 1);#endif    yyset_debug(DEBUG_LEXER, scanner);    LexerContext lexerCtx(&programStmts, filename, interactive, callback);    yylex_init_extra(&lexerCtx, &scanner);    lexerCtx.scanner = scanner;    lexerCtx.interactive = interactive;#ifndef OS_WINDOWS    if(stdin == file){        rl_instream = stdin;    }#endif    if(interactive){        std::cout << "Welcome to the sugar interactive shell" << std::endl;        std::cout << "Use 'quit' or 'exit' to quit this shell" << std::endl;    }    yy_push_state(lex_state_newline, scanner);    yyset_in( file, scanner );    bool succeed = (yyparse(&lexerCtx) == 0);    yylex_destroy(scanner);    fclose(file);    return succeed && (interactive || !lexerCtx.hasError);}
开发者ID:SamuelDeal,项目名称:Sugar,代码行数:34,


示例12: read_config

int read_config(const char * file){    FILE * f;    f = fopen(file, "r");    if (f == NULL) {        fprintf(stderr, "%s: can't open config file /"%s/": %s/n",                progname, file, strerror(errno));        return -1;    }    lineno = 1;    infile = file;    yyin   = f;    yyparse();#ifdef HAVE_YYLEX_DESTROY    /* reset lexer and free any allocated memory */    yylex_destroy();#endif    fclose(f);    return 0;}
开发者ID:firew0rks,项目名称:avrdude-android,代码行数:26,


示例13: vcx_parser_parse_file

vcx_ast_module*vcx_parser_parse_file(const char* filename){    vcx_parse_ctx ctx;    int r;    FILE* stream;    stream = fopen(filename, "r");    if (stream == NULL) {        vcx_util_errorf("could not open source file: %s", filename);        return NULL;    }    yylex_init(&ctx.scanner);    yyset_extra(&ctx, ctx.scanner);    yyset_in(stream, ctx.scanner);    r = yyparse(&ctx);    yylex_destroy(ctx.scanner);    fclose(stream);    if (r == 0) {        return ctx.root;    }    else {        vcx_ast_module_delete(ctx.root);        return NULL;    }}
开发者ID:thomaslee,项目名称:vcx,代码行数:28,


示例14: fopen

Chunk *make(char *file) {    // TODO - make non-global    filename = file;    FILE *fp = fopen(file, "r");    if (!fp) {        printf("Could not open input file '%s'./n", file);        exit(EXIT_FAILURE);    }    yyin = fp;    yyparse();    yylex_destroy();    fclose(fp);    resolve(program);    if (numerrors > 0) {        exit(EXIT_FAILURE);    }    Chunk *chunk = compile(program);    free_expr(program);    return chunk;}
开发者ID:kwiskia,项目名称:chinnu,代码行数:27,


示例15: compile_string

/* Compile a string */void compile_string(compiler_type *comp_void, char *str, bool include_baselib) {  compiler_core_type *compiler = (compiler_core_type *)comp_void;  ins_stream_type *baselib = 0; /* TODO: should be gc root */  char path[PATH_MAX];  /* Actually parse the input stream. */  yylex_init_extra(compiler, &(compiler->scanner));  yy_scan_string(str, compiler->scanner);  /* TODO: Need a better way to handle GC than leaking */  gc_protect(compiler->gc);  /* Inject include for base library */  if (include_baselib) {    strcpy(path, compiler->home);    strcat(path, "/lib/baselib.scm");    STREAM_NEW(baselib, string, path);    setup_include(compiler, baselib);   }    parse_internal(compiler, compiler->scanner);    gc_unprotect(compiler->gc);  yylex_destroy(compiler->scanner);}
开发者ID:arlaneenalra,项目名称:insomniac,代码行数:28,


示例16: block

void ESDLcompiler::Process(){    CriticalBlock block(m_critSect);    yyInitESDLGlobals(this);    Owned<IException> parseException;    yyrestart (yyin);    try    {        yyparse();    }    catch(IException* e)    {        parseException.setown(e);    }    if (nCommentStartLine > -1)    {        char tempBuf[256];        sprintf(tempBuf, "The comment that started at line %d is not ended yet", nCommentStartLine);        yyerror(tempBuf);    }    if(!parseException)        write_esxdl();    fclose(yyin);    if (gOutfile > 0)        close (gOutfile);    yyCleanupESDLGlobals();    yylex_destroy();    if(parseException)        throw parseException.getLink();}
开发者ID:miguelvazq,项目名称:HPCC-Platform,代码行数:34,


示例17: cleanup

static void cleanup(void){    ir_destroy();    node_destroy(root);    stack_destroy(&stack);    yylex_destroy();}
开发者ID:edvardsp,项目名称:kompilates,代码行数:7,


示例18: main

int main(int argc, char const *argv[]) {  if(argc!=2){    printf("USAGE: %s FILE/n", argv[0]);    return EXIT_FAILURE;  }  FILE* f = fopen(argv[1], "r");  if(!f){    perror("Failed to open file: ");    return EXIT_FAILURE;  }  atexit(clean_matrix);  yyin = f;  yyparse();  fclose(f);  yylex_destroy();  build_starts();  link_matrix();  struct MATRIX *matrix = get_matrix();  int result = forkx(matrix);  free(matrix);  if(!result){    wait_for_children();  }  return EXIT_SUCCESS;}
开发者ID:draringi,项目名称:ECSE420-project,代码行数:25,


示例19: do_test

/* Does the action for the -test command */int do_test (int argc, const char ** argv) {  int i, val, size = 0;  char * buffer;    for (i=0; i<argc; i++) size += strlen(argv[i]) + 1;  buffer = (char*) malloc(sizeof(char) * size);  strcpy(buffer, argv[0]);  for (i=1; i<argc; i++) {    strcat(buffer, " ");    strcat(buffer, argv[i]);  }    yy_scan_string(buffer);  yylex();  yyparse ();  if (result == NULL) return;  val = eval(result);  /* printf("%d/n", val); */  free_ast(result);  free(buffer);  yylex_destroy();  return val;}
开发者ID:remyzorg,项目名称:cl_projet1,代码行数:33,


示例20: yyparse

pt_node *buildAST(const char *expr) {	extern int yyparse(pt_node **, yyscan_t);	FILE *file;	yyscan_t scanner;	pt_node *node = NULL;	YY_BUFFER_STATE state;	if(yylex_init(&scanner)) {		fprintf(stderr, "Failed to initialize parser./n");		exit(-1);	}	file = fopen(expr, "r");	if(file == NULL) {		perror("fopen");		exit(-1);	}	state = yy_create_buffer(file, 1024, scanner);	yy_switch_to_buffer(state, scanner);	if(yyparse(&node, scanner)) {		fprintf(stderr, "Error parsing input./n");		exit(-1);	}	yy_delete_buffer(state, scanner);	yylex_destroy(scanner);	return node;}
开发者ID:Winter-M,项目名称:Trot,代码行数:32,


示例21: como_ast_create

int como_ast_create(const char *filename){    ast_node* statements;    yyscan_t scanner;    YY_BUFFER_STATE state;    char* text;    text = file_get_contents(filename);    if(!text) {        printf("file '%s' not found/n", filename);        return 1;    }        if(yylex_init(&scanner)) {        como_error_noreturn("yylex_init returned NULL");    }    state = yy_scan_string(text, scanner);    if(yyparse(&statements, scanner)) {        como_error_noreturn("yyparse returned NULL");    }    yy_delete_buffer(state, scanner);    yylex_destroy(scanner);    como_compile_ast(statements, filename);    return 0;}
开发者ID:rmccullagh,项目名称:como-lang,代码行数:32,


示例22: main

intmain ( int argc, char **argv ){    outputStage = 12;    options ( argc, argv );    /* In order to only scan the tokens we call yylex() directly */    if ( outputStage == 1 ) {        do { } while ( yylex() ); // "Token files"        exit(0);    }    /* The parser calls yylex(), match the rules and builds the abstract syntax tree */    // "BuildTree files"    yyparse();    if ( outputStage == 2 ) {        exit(0); // Exit if we are only printing this stages debug information. "BuildTree files"    }    /* Print the abstract syntax tree */    if ( outputStage == 3 ) {        node_print ( stderr, root, 0 ); // "Tree files"        exit(0);    }    destroy_subtree ( stderr, root );    yylex_destroy(); // Free internal data structures of the scanner.    exit ( EXIT_SUCCESS );}
开发者ID:stoutbeard,项目名称:ntnu,代码行数:33,


示例23: yy_scan_string

ModuleNode *getAST(const char *expr){    ModuleNode *expression;    yyscan_t scanner;    YY_BUFFER_STATE state;    if (yylex_init(&scanner)) {        // couldn't initialize        return NULL;    }    state = yy_scan_string(expr, scanner);    yydebug = 0;    if (yyparse(&expression, scanner)) {        // error parsing        return NULL;    }    yy_delete_buffer(state, scanner);    yylex_destroy(scanner);    return expression;}
开发者ID:Groterik,项目名称:dlang-ast,代码行数:25,


示例24: ml

void Equation::save(QXmlStreamWriter &s) {  s.writeStartElement(staticTypeTag);  // Reparse the equation, then write it back out in text so that we can update  // any vectors or scalars that had name changes, but we don't get affected by  // the optimizer  if (!_equation.isEmpty()) {    QMutexLocker ml(&Equations::mutex());    yylex_destroy();    yy_scan_string(parseableEquation());    ParsedEquation = 0L;    int rc = yyparse(store());    Equations::Node *en = static_cast<Equations::Node*>(ParsedEquation);    if (rc == 0 && en) {      if (!en->takeVectors(VectorsUsed)) {        Debug::self()->log(i18n("Equation [%1] failed to find its vectors when saving.  Resulting Kst file may have issues.").arg(_equation), Debug::Warning);      }      QString etext = en->text();      s.writeAttribute("expression", etext);    }    delete en;    ParsedEquation = 0L;  }  if (_xInVector) {    s.writeAttribute("xvector", _xInVector->Name());  }  if (_doInterp) {    s.writeAttribute("interpolate", "true");  }  saveNameInfo(s, VNUM|ENUM|XNUM);  s.writeEndElement();}
开发者ID:lnickers2004,项目名称:kst,代码行数:32,


示例25: qDebug

const QString Equation::reparsedEquation() const {  QString etext;  if (!_equation.isEmpty()) {    if (!Equations::mutex().tryLock()) {      qDebug() << "Don't reparse equation while it is being reparsed...";      return (_equation);    }    yylex_destroy();    yy_scan_string(parseableEquation());    ParsedEquation = 0L;    int rc = yyparse(store());    Equations::Node *en = static_cast<Equations::Node*>(ParsedEquation);    if (rc == 0 && en) {      if (!en->takeVectors(VectorsUsed)) {        Debug::self()->log(i18n("Equation [%1] failed to find its vectors when reparsing.").arg(_equation), Debug::Warning);      }      etext = en->text();    }    delete en;    ParsedEquation = 0L;    Equations::mutex().unlock();    //etext.replace("atanx(", "atan2(");    //etext.replace("atanxd(", "atan2d(");  }  return (readableEquation(etext));}
开发者ID:lnickers2004,项目名称:kst,代码行数:28,


示例26: parse_css

int parse_css(FILE *fh) {    // Set up the scanner    yyscan_t scanner;    yylex_init(&scanner);    yyset_in(fh, scanner);    // Set up the parser    void *css_parser = ParseAlloc(malloc);    int lexCode;    do {        lexCode = yylex(scanner);        printf("Got %i/n", lexCode);        Parse(css_parser, lexCode, yyget_text(scanner));    } while (lexCode > 0);    // Finish the job.    Parse(css_parser, 0, NULL);    if (-1 == lexCode) {        fprintf(stderr, "The scanner encountered an error./n");        return 0;    }    // Cleanup the scanner and parser    yylex_destroy(scanner);    ParseFree(css_parser, free);    return 1;}
开发者ID:theory,项目名称:mecssy,代码行数:31,


示例27: parse_context_delete

voidparse_context_delete (parse_context *self){  yylex_destroy (self->scanner);  pt_node_unref_ornull (self->unit);  mem_free (self, sizeof *self);}
开发者ID:pippijn,项目名称:reflect,代码行数:8,


示例28: main

int main(int argc, char **argv){    var_init();    yyparse();    var_destroy();    yylex_destroy();    return (0);}
开发者ID:KokaKiwi,项目名称:minicalc,代码行数:8,


示例29: val_parse_forall

void val_parse_forall(char *s, val_callback_t callback) {  yyscan_t scanner;  if (yylex_init(&scanner)) die("yylex_init error");  YY_BUFFER_STATE buf = s ? yy_scan_string(s, scanner) : 0;  if (yyparse(scanner, callback)) die("parse error");  yy_delete_buffer(buf, scanner);  yylex_destroy(scanner);}
开发者ID:blynn,项目名称:symple,代码行数:8,


示例30: main

int main(int ac, char** av){	instr_t*	imem;	int		imem_size;	int		yyparse();	int		yylex_destroy();	progname = av[0];	output = stdout;	init_func();	init_instr();	init_stmt();	init_sim();	params(ac, av);	if (yyin == NULL) {		warning("no input file");		exit(0);		}			if (cfg_fp == NULL)		yyparse();		fclose(yyin);	yylex_destroy();	opt();	if (cfg_fp != NULL)		exit(0);	imem = stmt2instr(&imem_size);	free_func();	deinit_symtab();	deinit_sym();	set_dmem_size(100000);	set_imem(imem, imem_size);	set_regs(32);	run(); 	print_stats();			free_sim();	if (output != NULL)		fclose(output);	if (yyin != NULL)		fclose(yyin);	return 0;}
开发者ID:Fredrik89,项目名称:eda230,代码行数:57,



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


C++ yyprintf函数代码示例
C++ yylex函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。