⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exlbrowser.c

📁 这是一个Linux下的集成开发环境
💻 C
📖 第 1 页 / 共 5 页
字号:
#ifdef TOKEN_DEBUG  fprintf(tokenout, "function name is \"%s\"\n", fname);#endif  line = tokens_head->start_line;  /*   * Pass SN_GLOBAL_NAMESPACE if the xref is outside of   * a function, otherwise pass SN_FUNC_DEF.   */     if (current_function == NULL) {    ref_from_scope_type = SN_GLOBAL_NAMESPACE;  } else {    ref_from_scope_type = SN_FUNC_DEF;  }  result = sn_insert_xref(SN_REF_TO_FUNCTION,                 ref_from_scope_type,                 SN_REF_SCOPE_GLOBAL,                 NULL,                 current_function,                 NULL,                 NULL,                 fname,                 NULL,                  sn_current_file(),                 line,                 SN_REF_PASS);  assert(result == 0);  sn_highlight(SN_HIGH_FUNCTION,      tokens_head->start_line, tokens_head->start_column,      tokens_head->end_line, tokens_head->end_column);  free_head_token(); /* SOMEWORD */  free_head_token(); /* OPEN_PAREN */}	YY_BREAKcase 31:YY_RULE_SETUP#line 717 "exlbrowser.l"{  int offset;#ifdef TOKEN_DEBUG  fprintf(tokenout, "variable assignment at token %d\n", token_index);#endif  emit_var_access(tokens_head, VAR_WRITE);  free_head_token(); /* SOMEWORD */  free_head_token(); /* ASSIGNMENT_OPERATOR */}	YY_BREAKcase 32:YY_RULE_SETUP#line 730 "exlbrowser.l"{#ifdef TOKEN_DEBUG  fprintf(tokenout, "variable read at token %d\n", token_index);#endif  emit_var_access(tokens_head, VAR_READ);  free_head_token(); /* SOMEWORD */}	YY_BREAKcase 33:YY_RULE_SETUP#line 740 "exlbrowser.l"{  enum sn_highlights type;#ifdef TOKEN_DEBUG  fprintf(tokenout, "ate token %d %s", token_index,          TokenTypeToString(tokens_head));  if (tokens_head->strval) {      fprintf(tokenout, " \"%s\"", tokens_head->strval);  }  fprintf(tokenout, "\n");#endif  if (highlight_file) {      switch (tokens_head->type) {          case DOUBLE_QUOTED_STRING:              type = SN_HIGH_STRING;              break;          case KEYWORD:              type = SN_HIGH_KEYWORD;              break;          default:              type = 0;      }      if (type != 0) {          sn_highlight(type,                  tokens_head->start_line, tokens_head->start_column,                  tokens_head->end_line, tokens_head->end_column);      }  }  free_head_token(); /* ... */}	YY_BREAKcase 34:YY_RULE_SETUP#line 773 "exlbrowser.l"	YY_BREAKcase 35:YY_RULE_SETUP#line 775 "exlbrowser.l"{#ifdef TOKEN_DEBUG    fprintf(tokenout, "matched unknown character \"%s\"\n", yytext);#endif}	YY_BREAKcase YY_STATE_EOF(TOKEN):#line 781 "exlbrowser.l"{#ifdef TOKEN_DEBUG    fprintf(tokenout, "reached EOF in TOKEN buffer\n");#endif    /* A function closing brace was not found before we hit EOF */    if (current_function) {        current_function_line_end = sn_line();        current_function_column_end = sn_column();#ifdef TOKEN_DEBUG        fprintf(tokenout, "found unfinished function at EOF in %s\n", sn_current_file());#endif        emit_function_declaration();    }    assert(!tokens_head); /* all tokens were processed */    yy_delete_buffer( YY_CURRENT_BUFFER );    yy_switch_to_buffer( original_buffer );    BEGIN(EXAMPLE);    yyterminate();}	YY_BREAKcase YY_STATE_EOF(EXAMPLE):case YY_STATE_EOF(COMMENT_MODE):case YY_STATE_EOF(DQSTRING):#line 806 "exlbrowser.l"{  LongString token_buffer;  char *base;  int i;  Token* tok;  yy_size_t size;  YY_BUFFER_STATE yybs;#ifdef TOKEN_DEBUG  tokenout = fopen("tokens.out", "a");  fprintf(tokenout, "reached EOF in lex input buffer in mode %s\n", modestring());#endif  /* See if we ran off the end of the lex input buffer in a special mode */  switch (YY_START) {    case COMMENT_MODE:      emit_comment();      break;    case DQSTRING:      emit_dqstring();      break;  }  /* If no tokens were generated, then quit now */  if (tokens_head == NULL) {#ifdef TOKEN_DEBUG    fprintf(tokenout, "no TOKENs generated\n");#endif    BEGIN(EXAMPLE);    yyterminate();  }  /*   * If the -T command line option was passed,   * dump all tokens to a file, skip the token   * matching phase and go on to the next file.   */  if (token_dump_file) {    FILE * dump_tokens = fopen(token_dump_file, "a");    for (i=0, tok = tokens_head ; tok ; tok = tok->next, i++) {        fprintf(dump_tokens, "%d %s", i, TokenTypeToString(tok));        if (tok->strval == NULL) {            fprintf(dump_tokens, " \"\"");        } else {            char *x;            fprintf(dump_tokens, " \"");            for (x=tok->strval; *x; x++) {                if (*x == '\n') {                    fprintf(dump_tokens, "\\n");                } else if (*x == '\\') {                    fprintf(dump_tokens, "\\\\");                } else if (*x == '\"') {                    fprintf(dump_tokens, "\\\"");                } else {                    fprintf(dump_tokens, "%c", *x);                }            }            fprintf(dump_tokens, "\"");        }        fprintf(dump_tokens, " %d.%d %d.%d",            tok->start_line,            tok->start_column,            tok->end_line,            tok->end_column        );        fprintf(dump_tokens, "\n");    }    fclose(dump_tokens);    BEGIN(EXAMPLE);    yyterminate();  }  LongStringInit(&token_buffer,0);  /* Print token info to in memory buffer and then reload     the input state machine and start out in the TOKEN mode. */  for (i=0, tok = tokens_head ; tok ; tok = tok->next, i++) {#ifdef TOKEN_DEBUG        fprintf(tokenout, "token %d %s", i, TokenTypeToString(tok));        if (tok->strval) {            fprintf(tokenout, " \"%s\"", tok->strval);        }        fprintf(tokenout, " (%d.%d -> %d.%d)",            tok->start_line,            tok->start_column,            tok->end_line,            tok->end_column        );        fprintf(tokenout, "\n");#endif                token_buffer.append( &token_buffer, TokenTypeToString(tok), -1);        token_buffer.append( &token_buffer, " ", -1);  }#ifdef TOKEN_DEBUG  fprintf(tokenout, "token buffer data is \"%s\"\n", token_buffer.buf);#endif  original_buffer = YY_CURRENT_BUFFER;  yy_switch_to_buffer( yy_scan_string(token_buffer.buf) );  token_buffer.free(&token_buffer);#ifdef TOKEN_DEBUG  fprintf(tokenout, "switching to token mode\n");#endif  BEGIN(TOKEN);}	YY_BREAKcase 36:YY_RULE_SETUP#line 922 "exlbrowser.l"ECHO;	YY_BREAKcase YY_STATE_EOF(INITIAL):	yyterminate();	case YY_END_OF_BUFFER:		{		/* Amount of text matched not including the EOB char. */		int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;		/* Undo the effects of YY_DO_BEFORE_ACTION. */		*yy_cp = yy_hold_char;		YY_RESTORE_YY_MORE_OFFSET		if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )			{			/* We're scanning a new file or input source.  It's			 * possible that this happened because the user			 * just pointed yyin at a new source and called			 * yylex().  If so, then we have to assure			 * consistency between yy_current_buffer and our			 * globals.  Here is the right place to do so, because			 * this is the first action (other than possibly a			 * back-up) that will match for the new input source.			 */			yy_n_chars = yy_current_buffer->yy_n_chars;			yy_current_buffer->yy_input_file = yyin;			yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;			}		/* Note that here we test for yy_c_buf_p "<=" to the position		 * of the first EOB in the buffer, since yy_c_buf_p will		 * already have been incremented past the NUL character		 * (since all states make transitions on EOB to the		 * end-of-buffer state).  Contrast this with the test		 * in input().		 */		if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )			{ /* This was really a NUL. */			yy_state_type yy_next_state;			yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;			yy_current_state = yy_get_previous_state();			/* Okay, we're now positioned to make the NUL			 * transition.  We couldn't have			 * yy_get_previous_state() go ahead and do it			 * for us because it doesn't know how to deal			 * with the possibility of jamming (and we don't			 * want to build jamming into it because then it			 * will run more slowly).			 */			yy_next_state = yy_try_NUL_trans( yy_current_state );			yy_bp = yytext_ptr + YY_MORE_ADJ;			if ( yy_next_state )				{				/* Consume the NUL. */				yy_cp = ++yy_c_buf_p;				yy_current_state = yy_next_state;				goto yy_match;				}			else				{				yy_cp = yy_c_buf_p;				goto yy_find_action;				}			}		else switch ( yy_get_next_buffer() )			{			case EOB_ACT_END_OF_FILE:				{				yy_did_buffer_switch_on_eof = 0;				if ( yywrap() )					{					/* Note: because we've taken care in					 * yy_get_next_buffer() to have set up					 * yytext, we can now set up					 * yy_c_buf_p so that if some total					 * hoser (like flex itself) wants to					 * call the scanner after we return the					 * YY_NULL, it'll still work - another					 * YY_NULL will get returned.					 */					yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;					yy_act = YY_STATE_EOF(YY_START);					goto do_action;					}				else					{					if ( ! yy_did_buffer_switch_on_eof )						YY_NEW_FILE;					}				break;				}			case EOB_ACT_CONTINUE_SCAN:				yy_c_buf_p =					yytext_ptr + yy_amount_of_matched_text;				yy_current_state = yy_get_previous_state();				yy_cp = yy_c_buf_p;				yy_bp = yytext_ptr + YY_MORE_ADJ;				goto yy_match;			case EOB_ACT_LAST_MATCH:				yy_c_buf_p =				&yy_current_buffer->yy_ch_buf[yy_n_chars];				yy_current_state = yy_get_previous_state();				yy_cp = yy_c_buf_p;				yy_bp = yytext_ptr + YY_MORE_ADJ;				goto yy_find_action;			}		break;		}	default:		YY_FATAL_ERROR(			"fatal flex scanner internal error--no action found" );	} /* end of action switch */		} /* end of scanning one token */	} /* end of yylex *//* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: *	EOB_ACT_LAST_MATCH - *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position *	EOB_ACT_END_OF_FILE - end of file */static int yy_get_next_buffer()	{	register char *dest = yy_current_buffer->yy_ch_buf;	register char *source = yytext_ptr;	register int number_to_move, i;	int ret_val;	if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )		YY_FATAL_ERROR(		"fatal flex scanner internal error--end of buffer missed" );	if ( yy_current_buffer->yy_fill_buffer == 0 )		{ /* Don't try to fill the buffer, so this is an EOF. */		if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )			{			/* We matched a single character, the EOB, so			 * treat this as a final EOF.			 */			return EOB_ACT_END_OF_FILE;			}		else			{			/* We matched some text prior to the EOB, first			 * process it.			 */			return EOB_ACT_LAST_MATCH;			}		}	/* Try to read more data. */	/* First move last chars to start of buffer. */	number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;	for ( i = 0; i < number_to_move; ++i )		*(dest++) = *(source++);	if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )		/* don't do the read, it's not guaranteed to return an EOF,		 * just force an EOF		 */		yy_current_buffer->yy_n_chars = yy_n_chars = 0;	else		{		int num_to_read =			yy_current_buffer->yy_buf_size - number_to_move - 1;		while ( num_to_read <= 0 )			{ /* Not enough room in the buffer - grow it. */#ifdef YY_USES_REJECT			YY_FATAL_ERROR("input buffer overflow, can't enlarge buffer because scanner uses REJECT" );#else			/* just a shorter name for the current buffer */			YY_BUFFER_STATE b = yy_current_buffer;			int yy_c_buf_p_offset =				(int) (yy_c_buf_p - b->yy_ch_buf);			if ( b->yy_is_our_buffer )				{				int new_size = b->yy_buf_size * 2;				if ( new_size <= 0 )					b->yy_buf_size += b->yy_buf_size / 8;				else					b->yy_buf_size *= 2;				b->yy_ch_buf = (char *)					/* Include room in for 2 EOB chars. */					yy_flex_realloc( (void *) b->yy_ch_buf,							 b->yy_buf_size + 2 );				}			else				/* Can't grow it, we don't own it. */				b->yy_ch_buf = 0;			if ( ! b->yy_ch_buf )				YY_FATAL_ERROR(				"fatal error - scanner input buffer overflow" );			yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];			num_to_read = yy_current_buffer->yy_buf_size -						number_to_move - 1;#endif			}		if ( num_to_read > YY_READ_BUF_SIZE )			num_to_read = YY_READ_BUF_SIZE;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -