📄 phpbrowser.l
字号:
#if MATCH_DUMP matched_pattern("\\*+[^\\*/\\n]*\\n", yytext); #endif #if COMMENT_DUMP fprintf(stderr, "comment(4) \"%s\", %d\n", yytext, yyleng); #endif mode_buff.append( &mode_buff, yytext, yyleng ); sn_advance_line(); sn_reset_column(); } "*"+"/" { #if MATCH_DUMP matched_pattern("\\*+/", yytext); #endif /* Include multiple '*' characters in the comment */ if (yyleng > 2) { int to_append = yyleng; char *comment = (char *) yytext + yyleng - 1; assert(*comment == '/'); comment--; assert(*comment == '*'); *comment = '0'; to_append -= 2; mode_buff.append( &mode_buff, yytext, to_append ); } emit_comment(); sn_advance_column(yyleng); BEGIN(PHP); } /* Uncomment the next rule if you want to check to make sure * the above rules cover all possible input. A warning * "rule cannot be matched" should be printed by flex. */ /*. {}*/}<PHP>\"\" {#if MATCH_DUMP matched_pattern("\\\"\\\"", yytext);#endif /* FIXME: Can we pass NULL instead of "" after length issues worked out ? */ append_dqstring_token("", sn_line(), sn_column(), sn_line(), sn_column() + yyleng); sn_advance_column(yyleng);}<PHP>\" {#if MATCH_DUMP matched_pattern("\\\"", yytext);#endif#if DQSTRING_DUMP fprintf(stderr, "dqstring started at (%d.%d)\n", sn_line(), sn_column());#endif LongStringInit(&mode_buff,0); mode_start_line = sn_line(); mode_start_column = sn_column(); embedded_dq_string_vars_head = NULL; embedded_dq_string_vars_tail = NULL; sn_advance_column(yyleng); BEGIN(DQSTRING);}<DQSTRING>{ [^\"\n\\\$]* { #if MATCH_DUMP matched_pattern("[^\\\"\\n\\\\]*", yytext); #endif #if DQSTRING_DUMP fprintf(stderr, "dqstring(1) \"%s\", %d\n", yytext, yyleng); #endif mode_buff.append( &mode_buff, yytext, yyleng ); sn_advance_column(yyleng); } [^\"\n\\\$]*\n { #if MATCH_DUMP matched_pattern("[^\\\"\\n\\\\]*\\n", yytext); #endif #if DQSTRING_DUMP fprintf(stderr, "dqstring(2) \"%s\", %d\n", yytext, yyleng); #endif mode_buff.append( &mode_buff, yytext, yyleng ); sn_advance_line(); sn_reset_column(); } (\\\")+ { #if MATCH_DUMP matched_pattern("(\\\")+", yytext); #endif #if DQSTRING_DUMP fprintf(stderr, "dqstring(3) \"%s\", %d\n", yytext, yyleng); #endif mode_buff.append( &mode_buff, yytext, yyleng ); sn_advance_column(yyleng); } \\ { #if MATCH_DUMP matched_pattern("\\", yytext); #endif #if DQSTRING_DUMP fprintf(stderr, "dqstring(4) \"%s\", %d\n", yytext, yyleng); #endif mode_buff.append( &mode_buff, yytext, yyleng ); sn_advance_column(yyleng); } \${varname} { #if MATCH_DUMP matched_pattern("${varname}", yytext); #endif append_dqstring_var_token(yytext+1, sn_line(), sn_column(), sn_line(), sn_column() + yyleng); mode_buff.append( &mode_buff, yytext, yyleng ); sn_advance_column(yyleng); } \$ { #if MATCH_DUMP matched_pattern("$", yytext); #endif mode_buff.append( &mode_buff, yytext, yyleng ); sn_advance_column(yyleng); } \" { #if MATCH_DUMP matched_pattern("\\\"", yytext); #endif sn_advance_column(yyleng); emit_dqstring(); BEGIN(PHP); } /* Uncomment the next rule if you want to check to make sure * the above rules cover all possible input. A warning * "rule cannot be matched" should be printed by flex. */ /*. {}*/}<PHP>\'\' {#if MATCH_DUMP matched_pattern("\\\'\\\'", yytext);#endif /* FIXME: Can we pass NULL instead of "" after length issues worked out ? */ append_token(SINGLE_QUOTED_STRING, "", sn_line(), sn_column(), sn_line(), sn_column() + yyleng); sn_advance_column(yyleng);}<PHP>\' {#if MATCH_DUMP matched_pattern("\\\'", yytext);#endif#if SQSTRING_DUMP fprintf(stderr, "sqstring started at (%d.%d)\n", sn_line(), sn_column());#endif LongStringInit(&mode_buff,0); mode_start_line = sn_line(); mode_start_column = sn_column(); sn_advance_column(yyleng); BEGIN(SQSTRING);}<SQSTRING>{ [^\'\n\\]* { #if MATCH_DUMP matched_pattern("[^\\\'\\n\\\\]*", yytext); #endif #if SQSTRING_DUMP fprintf(stderr, "sqstring(1) \"%s\", %d\n", yytext, yyleng); #endif mode_buff.append( &mode_buff, yytext, yyleng ); sn_advance_column(yyleng); } [^\'\n\\]*\n { #if MATCH_DUMP matched_pattern("[^\\\'\\n\\\\]*\\n", yytext); #endif #if SQSTRING_DUMP fprintf(stderr, "sqstring(2) \"%s\", %d\n", yytext, yyleng); #endif mode_buff.append( &mode_buff, yytext, yyleng ); sn_advance_line(); sn_reset_column(); } (\\\')+[^\'/\n\\]* { #if MATCH_DUMP matched_pattern("\\\'+[^\\\'/\\n\\\\]*", yytext); #endif #if SQSTRING_DUMP fprintf(stderr, "sqstring(3) \"%s\", %d\n", yytext, yyleng); #endif mode_buff.append( &mode_buff, yytext, yyleng ); sn_advance_column(yyleng); } (\\\')+[^\'\n\\]*\n { #if MATCH_DUMP matched_pattern("\\\'+[^\\\'\\n\\\\]*\\n", yytext); #endif #if SQSTRING_DUMP fprintf(stderr, "sqstring(4) \"%s\", %d\n", yytext, yyleng); #endif mode_buff.append( &mode_buff, yytext, yyleng ); sn_advance_line(); sn_reset_column(); } \\ { #if MATCH_DUMP matched_pattern("\\\\", yytext); #endif #if SQSTRING_DUMP fprintf(stderr, "sqstring(5) \"%s\", %d\n", yytext, yyleng); #endif mode_buff.append( &mode_buff, yytext, yyleng ); sn_advance_column(yyleng); } \' { #if MATCH_DUMP matched_pattern("\\\'", yytext); #endif sn_advance_column(yyleng); emit_sqstring(); BEGIN(PHP); } /* Uncomment the next rule if you want to check to make sure * the above rules cover all possible input. A warning * "rule cannot be matched" should be printed by flex. */ /*. {}*/}<PHP>"<<<"{ws}*{heredoc-id}\n { char *x = yytext; char *y;#if MATCH_DUMP matched_pattern("<<<{ws}*{heredoc-id}\\n", yytext);#endif mode_start_line = sn_line(); mode_start_column = sn_column(); x += 3; while(*x == ' ' || *x == '\t') { x++; } y = x; while(*y != '\n') { y++; } *y = 0; LongStringInit(&mode_buff,0); mode_buff.append( &mode_buff, x, -1 ); mode_buff.append( &mode_buff, ";\n", -1 ); heredoc_id = SN_StrDup(mode_buff.buf); mode_buff.free(&mode_buff);#if HDSTRING_DUMP fprintf(stderr, "hdstring started at (%d.%d)\n", sn_line(), sn_column()); fprintf(stderr, "hdstring id is \"%s\"\n", heredoc_id);#endif LongStringInit(&mode_buff,0); embedded_dq_string_vars_head = NULL; embedded_dq_string_vars_tail = NULL; sn_advance_line(); sn_reset_column(); BEGIN(HDSTRING);}<HDSTRING>{ ^{heredoc-id};\n { #if MATCH_DUMP matched_pattern("^{heredoc-id};\n", yytext); #endif #if HDSTRING_DUMP fprintf(stderr, "hdstring(1) \"%s\", %d\n", yytext, yyleng); #endif if (strcmp(yytext, heredoc_id) == 0) { #if HDSTRING_DUMP fprintf(stderr, "hdstring end matched\n"); #endif sn_advance_column(yyleng-2); /* advance to ; */ emit_hdstring(); sn_advance_line(); sn_reset_column(); BEGIN(PHP); } else { mode_buff.append( &mode_buff, yytext, yyleng ); } } [^\$\n]+ { #if MATCH_DUMP matched_pattern("[^;$\n]+", yytext); #endif #if HDSTRING_DUMP fprintf(stderr, "hdstring(2) \"%s\", %d\n", yytext, yyleng); #endif mode_buff.append( &mode_buff, yytext, yyleng ); sn_advance_column(yyleng); } [^\$\n]*\n { #if MATCH_DUMP matched_pattern("[^;$\n]*\n", yytext); #endif #if HDSTRING_DUMP fprintf(stderr, "hdstring(3) \"%s\", %d\n", yytext, yyleng); #endif mode_buff.append( &mode_buff, yytext, yyleng ); sn_advance_line(); sn_reset_column(); } \${varname} { #if MATCH_DUMP matched_pattern("${varname}", yytext); #endif #if HDSTRING_DUMP fprintf(stderr, "hdstring(4) \"%s\", %d\n", yytext, yyleng); #endif append_dqstring_var_token(yytext+1, sn_line(), sn_column(), sn_line(), sn_column() + yyleng); mode_buff.append( &mode_buff, yytext, yyleng ); sn_advance_column(yyleng); } \$ { #if MATCH_DUMP matched_pattern("$", yytext); #endif #if HDSTRING_DUMP fprintf(stderr, "hdstring(5) \"%s\", %d\n", yytext, yyleng); #endif mode_buff.append( &mode_buff, yytext, yyleng ); sn_advance_column(yyleng); } /* Uncomment the next rule if you want to check to make sure * the above rules cover all possible input. A warning * "rule cannot be matched" should be printed by flex. */ /*. {}*/}<PHP>"(" {#if MATCH_DUMP matched_pattern("(", yytext);#endif append_token(OPEN_PAREN, NULL, sn_line(), sn_column(), sn_line(), sn_column() + yyleng); sn_advance_column(yyleng);}<PHP>")" {#if MATCH_DUMP matched_pattern(")", yytext);#endif append_token(CLOSE_PAREN, NULL, sn_line(), sn_column(), sn_line(), sn_column() + yyleng); sn_advance_column(yyleng);}<PHP>"[" {#if MATCH_DUMP matched_pattern("[", yytext);#endif append_token(OPEN_BRACKET, NULL, sn_line(), sn_column(), sn_line(), sn_column() + yyleng); sn_advance_column(yyleng);}<PHP>"]" {#if MATCH_DUMP matched_pattern("]", yytext);#endif append_token(CLOSE_BRACKET, NULL, sn_line(), sn_column(), sn_line(), sn_column() + yyleng); sn_advance_column(yyleng);}<PHP>"{" {#if MATCH_DUMP matched_pattern("{", yytext);#endif append_token(OPEN_BRACE, NULL, sn_line(), sn_column(), sn_line(), sn_column() + yyleng); sn_advance_column(yyleng);}<PHP>"}" {#if MATCH_DUMP matched_pattern("}", yytext);#endif append_token(CLOSE_BRACE, NULL, sn_line(), sn_column(), sn_line(), sn_column() + yyleng); sn_advance_column(yyleng);}<PHP>";" {#if MATCH_DUMP matched_pattern("}", yytext);#endif append_token(SEMICOLON, NULL, sn_line(), sn_column(), sn_line(), sn_column() + yyleng); sn_advance_column(yyleng);}<PHP>"." {#if MATCH_DUMP matched_pattern(".", yytext);#endif append_token(PERIOD, NULL, sn_line(), sn_column(), sn_line(), sn_column() + yyleng); sn_advance_column(yyleng);}<PHP>"," {#if MATCH_DUMP matched_pattern(",", yytext);#endif append_token(COMMA, NULL, sn_line(),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -