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

📄 phpbrowser.l

📁 这是一个Linux下的集成开发环境
💻 L
📖 第 1 页 / 共 5 页
字号:
    push_bracket_counter();  }  current_array_bracket_count = 1;  current_array_prefix_incr = 1;  free_head_token(); /* INCREMENT_OPERATORS */  current_array_token = pop_head_token(); /* VARIABLE */  free_head_token(); /* OPEN_BRACKET */}<TOKEN>"VARIABLE OPEN_BRACKET" {#ifdef TOKEN_DEBUG  fprintf(tokenout, "array variable start token %d\n", token_index);#endif  /* This is the start of an array variable.   *   *   $arr[0]   */  if (current_array_bracket_count > 0) {    /* Nested brackets : $arr1[$arr2[0]] */    push_bracket_counter();  }  current_array_bracket_count = 1;  current_array_token = pop_head_token(); /* VARIABLE */  free_head_token(); /* OPEN_BRACKET */}<TOKEN>"CLOSE_BRACKET OPEN_BRACKET" {#ifdef TOKEN_DEBUG  fprintf(tokenout, "array variable array dimension tokens %d\n", token_index);#endif  /* This rule matches the "][" tokens in the following statement:   *   * array["one"]["two"] = 1;   *   * Note that we don't change the current_array_bracket_count here.   */  free_head_token(); /* CLOSE_BRACKET */  free_head_token(); /* OPEN_BRACKET */}<TOKEN>"CLOSE_BRACKET ASSIGNMENT_OPERATOR" {#ifdef TOKEN_DEBUG  fprintf(tokenout, "array variable assignment end token %d\n", token_index);#endif  /* This could be the end of an array variable.   *   *   $arr["num"] = 2;   */  if (current_array_bracket_count > 0) {    if (--current_array_bracket_count == 0) {        emit_var_access(current_array_token, VAR_WRITE);        FreeToken(current_array_token);        current_array_prefix_incr = 0;        pop_bracket_counter();#ifdef TOKEN_DEBUG        fprintf(tokenout, "assignment operator end of array variable\n");#endif    }  }  free_head_token(); /* CLOSE_BRACKET */  free_head_token(); /* ASSIGNMENT_OPERATOR */}<TOKEN>"CLOSE_BRACKET ASSIGNMENT_OPERATORS" {#ifdef TOKEN_DEBUG  fprintf(tokenout, "array variable read/write assignment end token %d\n", token_index);#endif  /* This could be the end of an array variable.   *   *   $arr["num"] += 2;   */  if (current_array_bracket_count > 0) {    if (--current_array_bracket_count == 0) {        emit_var_access(current_array_token, VAR_READWRITE);        FreeToken(current_array_token);        current_array_prefix_incr = 0;        pop_bracket_counter();#ifdef TOKEN_DEBUG        fprintf(tokenout, "assignment operators end of array variable\n");#endif    }  }  free_head_token(); /* CLOSE_BRACKET */  free_head_token(); /* ASSIGNMENT_OPERATORS */}<TOKEN>"CLOSE_BRACKET INCREMENT_OPERATORS" {#ifdef TOKEN_DEBUG  fprintf(tokenout, "array variable post increment end token %d\n", token_index);#endif  /* This could be the end of an array variable increment   *   *   $arr[0]++   */  if (current_array_bracket_count > 0) {    if (--current_array_bracket_count == 0) {        emit_var_access(current_array_token, VAR_READWRITE);        current_array_prefix_incr = 0;        FreeToken(current_array_token);        pop_bracket_counter();#ifdef TOKEN_DEBUG        fprintf(tokenout, "end of array variable post increment\n");#endif    }  }  free_head_token(); /* CLOSE_BRACKET */  free_head_token(); /* INCREMENT_OPERATORS */}<TOKEN>"CLOSE_BRACKET" {#ifdef TOKEN_DEBUG  fprintf(tokenout, "array variable read end token %d\n", token_index);#endif  /* This could be the end of an array variable   *   *   $arr[0] = 2;   *   * Or the end of an array variable that has   * a prefix increment.   *   *   ++$arr[0]   */  if (current_array_bracket_count > 0) {    if (--current_array_bracket_count == 0) {        if (current_array_prefix_incr) {          emit_var_access(current_array_token, VAR_READWRITE);#ifdef TOKEN_DEBUG        fprintf(tokenout, "read/write end of array variable\n");#endif        } else {          emit_var_access(current_array_token, VAR_READ);#ifdef TOKEN_DEBUG        fprintf(tokenout, "read end of array variable\n");#endif        }        current_array_prefix_incr = 0;        FreeToken(current_array_token);        pop_bracket_counter();    }  }  free_head_token(); /* CLOSE_BRACKET */}<TOKEN>"VDOUBLE_QUOTED_STRING" {#ifdef TOKEN_DEBUG  fprintf(tokenout, "ate VDOUBLE_QUOTED_STRING token %d", token_index);#endif  sn_highlight(SN_HIGH_STRING,          tokens_head->start_line, tokens_head->start_column,          tokens_head->end_line, tokens_head->end_column);  emit_var_access_for_dqstring(tokens_head);  free_head_token(); /* VDOUBLE_QUOTED_STRING */}<TOKEN>{token} {  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:          case SINGLE_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(); /* ... */}<TOKEN>" "<TOKEN>.		{#ifdef TOKEN_DEBUG    fprintf(tokenout, "matched unknown character \"%s\"\n", yytext);#endif}<TOKEN><<EOF>> {#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 );    enter_html_mode();    yyterminate();}<HTML_MODE,PHP,COMMENT_MODE,DQSTRING,SQSTRING,HDSTRING><<EOF>> {  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;    case SQSTRING:      emit_sqstring();      break;    case HDSTRING:       emit_hdstring();      break;    case HTML_MODE:      emit_html();      break;  }  /* If no tokens were generated, then quit now */  if (tokens_head == NULL) {#ifdef TOKEN_DEBUG    fprintf(tokenout, "no TOKENs generated\n");#endif    enter_html_mode();    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);    enter_html_mode();    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);}%%/* Return a string that describes the current mode */static char* modestring() {    char* mode = "UNKNOWN";    switch (YY_START) {        case INITIAL:            mode = "INITIAL";            break;        case PHP:            mode = "PHP";            break;        case COMMENT_MODE:            mode = "COMMENT_MODE";            break;        case DQSTRING:            mode = "DQSTRING";            break;        case SQSTRING:            mode = "SQSTRING";            break;        case HDSTRING:            mode = "HDSTRING";            break;        case TOKEN:            mode = "TOKEN";            break;        case HTML_MODE:            mode = "HTML_MODE";            break;    }    return mode;}#if MATCH_DUMP/* Helper method that will print matches as they are made. * This method is typically used in the token generation phase. */static void matched_pattern(char * pattern, char * text) {    char * mode = modestring();    fprintf(stderr, "Matched \"%s\", with text \"%s\", in mode \"%s\" (%d.%d)\n",        pattern, text, mode, sn_line(), sn_column());}#endif /* MATCH_DUMP */static void FreeGlobalEntry(SearchEntry *entry) {}void FreeToken(Token* tok) {    if (tok->strval != NULL) {        ckfree(tok->strval);    }    if (tok->vars != NULL) {        Token* tmp, *next;        for (tmp=tok->vars; tmp; ) {            next = tmp->next;            FreeToken(tmp);            tmp = next;        }    }    ckfree((char *) tok);}void append_dqstring_var_token(char* var,                           long start_line,                           int start_column,                           long end_line,                           int end_column) {    Token* tok;    tok = (Token*) ckalloc(sizeof(Token));    tok->type = VARIABLE;    tok->strval = SN_StrDup(var);    tok->start_line = start_line;    tok->start_column = start_column;    tok->end_line = end_line;    tok->end_column = end_column;    tok->vars = NULL;    tok->next = NULL;    /* append to var token list */    if (embedded_dq_string_vars_tail == NULL) {        embedded_dq_string_vars_head = embedded_dq_string_vars_tail = tok;    } else {        embedded_dq_string_vars_tail->next = tok;        embedded_dq_string_vars_tail = tok;    }}void append_dqstring_token(char* strval,                           long start_line,                           int start_column,                           long end_line,                           int end_column) {    if (embedded_dq_string_vars_head != NULL) {        append_token(VDOUBLE_QUOTED_STRING,                     strval,                     start_line,                     start_column,                     end_line,                     end_column);        tokens_tail->vars = embedded_dq_string_vars_head;        embedded_dq_string_vars_head = NULL;        embedded_dq_string_vars_tail = NULL;    } else {        append_token(DOUBLE_QUOTED_STRING,                     strval,                     start_line,                     start_column,                     end_line,                     end_column);    }}void append_token(TokenType type,                  char* strval,                  long start_line,                  int start_column,                  long end_line,                  int end_column) {    Token* tok;    tok = (Token*) ckalloc(sizeof(Token));    tok->type = type;    if (strval)        tok->strval = SN_StrDup(strval);    else        tok->strval = NULL;    tok->start_line = start_line;    tok->start_column = start_column;    tok->end_line = end_line;    tok->end_column = end_column;

⌨️ 快捷键说明

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