📄 scanner.cpp
字号:
140, 140, 140, 140, 140
} ;
static yyconst short int yy_chk[946] =
{ 0,
0, 1, 1, 1, 1, 22, 42, 42, 22, 1,
43, 43, 1, 1, 176, 45, 45, 1, 2, 2,
2, 2, 175, 174, 173, 172, 2, 46, 46, 2,
2, 45, 171, 170, 2, 24, 24, 169, 24, 24,
24, 168, 167, 46, 166, 24, 24, 24, 26, 26,
165, 26, 26, 26, 164, 163, 162, 161, 26, 26,
26, 28, 28, 160, 28, 28, 28, 159, 158, 157,
156, 28, 28, 28, 30, 30, 155, 30, 30, 30,
154, 153, 152, 151, 30, 30, 30, 32, 32, 150,
32, 32, 32, 149, 148, 147, 146, 32, 32, 32,
34, 34, 145, 34, 34, 34, 137, 136, 135, 134,
34, 34, 34, 36, 36, 40, 36, 36, 36, 35,
33, 31, 29, 36, 36, 36, 37, 37, 37, 27,
25, 23, 21, 20, 17, 15, 14, 12, 11, 10,
9, 3, 0, 0, 0, 0, 37, 38, 38, 0,
38, 38, 38, 0, 0, 0, 0, 38, 38, 38,
39, 39, 39, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
39, 41, 41, 0, 41, 41, 41, 0, 0, 0,
0, 41, 41, 41, 44, 44, 0, 44, 44, 44,
0, 0, 0, 0, 44, 44, 44, 47, 47, 0,
47, 47, 47, 0, 0, 0, 0, 47, 47, 47,
48, 48, 0, 48, 48, 48, 0, 0, 0, 0,
48, 48, 48, 50, 50, 0, 50, 50, 50, 0,
0, 0, 0, 50, 50, 50, 51, 51, 0, 51,
51, 51, 0, 0, 0, 0, 51, 51, 51, 53,
53, 0, 53, 53, 53, 0, 0, 0, 0, 53,
53, 53, 54, 54, 0, 54, 54, 54, 0, 0,
0, 0, 54, 54, 54, 56, 56, 0, 56, 56,
56, 0, 0, 0, 0, 56, 56, 56, 57, 57,
0, 57, 57, 57, 0, 0, 0, 0, 57, 57,
57, 59, 59, 0, 59, 59, 59, 0, 0, 0,
0, 59, 59, 59, 60, 60, 0, 60, 60, 60,
0, 0, 0, 0, 60, 60, 60, 62, 62, 0,
62, 62, 62, 0, 0, 0, 0, 62, 62, 62,
63, 63, 0, 63, 63, 63, 0, 0, 0, 0,
63, 63, 63, 65, 65, 0, 65, 65, 65, 0,
0, 0, 0, 65, 65, 65, 66, 66, 0, 66,
66, 66, 0, 0, 0, 0, 66, 66, 66, 68,
68, 0, 68, 68, 68, 0, 0, 0, 0, 68,
68, 68, 69, 69, 0, 69, 69, 69, 0, 0,
0, 0, 69, 69, 69, 71, 71, 0, 71, 71,
71, 0, 0, 0, 0, 71, 71, 71, 72, 72,
0, 72, 72, 72, 0, 0, 0, 0, 72, 72,
72, 74, 74, 0, 74, 74, 74, 0, 0, 0,
0, 74, 74, 74, 75, 75, 0, 75, 75, 75,
0, 0, 0, 0, 75, 75, 75, 77, 77, 0,
77, 77, 77, 0, 0, 0, 0, 77, 77, 77,
78, 78, 0, 78, 78, 78, 0, 0, 0, 0,
78, 78, 78, 80, 80, 0, 80, 80, 80, 0,
0, 0, 0, 80, 80, 80, 81, 81, 0, 81,
81, 81, 0, 0, 0, 0, 81, 81, 81, 83,
83, 0, 83, 83, 83, 0, 0, 0, 0, 83,
83, 83, 84, 84, 0, 84, 84, 84, 0, 0,
0, 0, 84, 84, 84, 86, 86, 0, 86, 86,
86, 0, 0, 0, 0, 86, 86, 86, 87, 87,
0, 87, 87, 87, 0, 0, 0, 0, 87, 87,
87, 89, 89, 0, 89, 89, 89, 0, 0, 0,
0, 89, 89, 89, 90, 90, 0, 90, 90, 90,
0, 0, 0, 0, 90, 90, 90, 92, 92, 0,
92, 92, 92, 0, 0, 0, 0, 92, 92, 92,
93, 93, 0, 93, 93, 93, 0, 0, 0, 0,
93, 93, 93, 95, 95, 0, 95, 95, 95, 0,
0, 0, 0, 95, 95, 95, 96, 96, 0, 96,
96, 96, 0, 0, 0, 0, 96, 96, 96, 98,
98, 0, 98, 98, 98, 0, 0, 0, 0, 98,
98, 98, 99, 99, 0, 99, 99, 99, 0, 0,
0, 0, 99, 99, 99, 101, 101, 0, 101, 101,
101, 0, 0, 0, 0, 101, 101, 101, 102, 102,
0, 102, 102, 102, 0, 0, 0, 0, 102, 102,
102, 104, 104, 0, 104, 104, 104, 0, 0, 0,
0, 104, 104, 104, 105, 105, 0, 105, 105, 105,
0, 0, 0, 0, 105, 105, 105, 107, 107, 0,
107, 107, 107, 0, 0, 0, 0, 107, 107, 107,
108, 108, 0, 108, 108, 108, 0, 0, 0, 0,
108, 108, 108, 110, 110, 0, 110, 110, 110, 0,
0, 0, 0, 110, 110, 110, 111, 111, 0, 111,
111, 111, 0, 0, 0, 0, 111, 111, 111, 114,
114, 0, 114, 114, 114, 0, 0, 0, 0, 114,
114, 114, 116, 116, 0, 116, 116, 116, 0, 0,
0, 0, 116, 116, 116, 118, 118, 0, 118, 118,
118, 0, 0, 0, 0, 118, 118, 118, 120, 120,
0, 120, 120, 120, 0, 0, 0, 0, 120, 120,
120, 122, 122, 0, 122, 122, 122, 0, 0, 0,
0, 122, 122, 122, 124, 124, 0, 124, 124, 124,
0, 0, 0, 0, 124, 124, 124, 126, 126, 0,
126, 126, 126, 0, 0, 0, 0, 126, 126, 126,
128, 128, 0, 128, 128, 128, 0, 0, 0, 0,
128, 128, 128, 130, 130, 0, 130, 130, 130, 0,
0, 0, 0, 130, 130, 130, 132, 132, 0, 132,
132, 132, 0, 0, 0, 0, 132, 132, 132, 141,
141, 141, 142, 0, 142, 143, 143, 143, 144, 144,
144, 140, 140, 140, 140, 140, 140, 140, 140, 140,
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
140, 140, 140, 140, 140
} ;
static yy_state_type yy_last_accepting_state;
static char *yy_last_accepting_cpos;
/* The intent behind this definition is that it'll catch
* any uses of REJECT which flex missed.
*/
#define REJECT reject_used_but_not_detected
#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
#define INITIAL 0
#include "stdafx.h"
#include "resource.h"
#include <io.h>
#include "SearchExpr.h"
#include "scanner.h"
#include "parser.hpp"
#include "OtherFunctions.h"
#include "ED2KLink.h"
#include "StringConversion.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif //_DEBUG
#define YY_NEVER_INTERACTIVE 1
extern int yyerror(const char* errstr);
#ifdef _UNICODE
extern int yyerror(LPCTSTR errstr);
#endif
#define ECHO TRACE
#define YY_INPUT ReadLexBuff
#define YY_FATAL_ERROR FatalLexError
static void ReadLexBuff(char* pcBuff, int& riResult, size_t uMaxSize);
static void FatalLexError(yyconst char msg[]);
static CStringA _strInputBuff;
static LPCSTR _pszLexBuff;
/* Macros after this point can all be overridden by user definitions in
* section 1.
*/
#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
extern "C" int yywrap YY_PROTO(( void ));
#else
extern int yywrap YY_PROTO(( void ));
#endif
#endif
#ifndef YY_NO_UNPUT
static void yyunput YY_PROTO(( int c, char *buf_ptr ));
#endif
#ifndef yytext_ptr
static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen YY_PROTO(( yyconst char * ));
#endif
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput YY_PROTO(( void ));
#else
static int input YY_PROTO(( void ));
#endif
#endif
#if YY_STACK_USED
static int yy_start_stack_ptr = 0;
static int yy_start_stack_depth = 0;
static int *yy_start_stack = 0;
#ifndef YY_NO_PUSH_STATE
static void yy_push_state YY_PROTO(( int new_state ));
#endif
#ifndef YY_NO_POP_STATE
static void yy_pop_state YY_PROTO(( void ));
#endif
#ifndef YY_NO_TOP_STATE
static int yy_top_state YY_PROTO(( void ));
#endif
#else
#define YY_NO_PUSH_STATE 1
#define YY_NO_POP_STATE 1
#define YY_NO_TOP_STATE 1
#endif
#ifdef YY_MALLOC_DECL
YY_MALLOC_DECL
#else
#if __STDC__
#ifndef __cplusplus
#include <stdlib.h>
#endif
#else
/* Just try to get by without declaring the routines. This will fail
* miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
* or sizeof(void*) != sizeof(int).
*/
#endif
#endif
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#endif
/* Copy whatever the last rule matched to the standard output. */
#ifndef ECHO
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
* is returned in "result".
*/
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
if ( yy_current_buffer->yy_is_interactive ) \
{ \
int c = '*', n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
if ( c == '\n' ) \
buf[n++] = (char) c; \
if ( c == EOF && ferror( yyin ) ) \
YY_FATAL_ERROR( "input in flex scanner failed" ); \
result = n; \
} \
else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
&& ferror( yyin ) ) \
YY_FATAL_ERROR( "input in flex scanner failed" );
#endif
/* No semi-colon after return; correct usage is to write "yyterminate();" -
* we don't want an extra ';' after the "return" because that will cause
* some compilers to complain about unreachable statements.
*/
#ifndef yyterminate
#define yyterminate() return YY_NULL
#endif
/* Number of entries by which start-condition stack grows. */
#ifndef YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#endif
/* Report a fatal error. */
#ifndef YY_FATAL_ERROR
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
#endif
/* Default declaration of generated scanner - a define so the user can
* easily add parameters.
*/
#ifndef YY_DECL
#define YY_DECL int yylex YY_PROTO(( void ))
#endif
/* Code executed at the beginning of each rule, after yytext and yyleng
* have been set up.
*/
#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif
/* Code executed at the end of each rule. */
#ifndef YY_BREAK
#define YY_BREAK break;
#endif
#define YY_RULE_SETUP \
YY_USER_ACTION
YY_DECL
{
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
if ( yy_init )
{
yy_init = 0;
#ifdef YY_USER_INIT
YY_USER_INIT;
#endif
if ( ! yy_start )
yy_start = 1; /* first start state */
if ( ! yyin )
yyin = stdin;
if ( ! yyout )
yyout = stdout;
if ( ! yy_current_buffer )
yy_current_buffer =
yy_create_buffer( yyin, YY_BUF_SIZE );
yy_load_buffer_state();
}
while ( 1 ) /* loops until end-of-file is reached */
{
yy_cp = yy_c_buf_p;
/* Support of yytext. */
*yy_cp = yy_hold_char;
/* yy_bp points to the position in yy_ch_buf of the start of
* the current run.
*/
yy_bp = yy_cp;
yy_current_state = yy_start;
yy_match:
do
{
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
if ( yy_accept[yy_current_state] )
{
yy_last_accepting_state = yy_current_state;
yy_last_accepting_cpos = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 141 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
while ( yy_base[yy_current_state] != 922 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
if ( yy_act == 0 )
{ /* have to back up */
yy_cp = yy_last_accepting_cpos;
yy_current_state = yy_last_accepting_state;
yy_act = yy_accept[yy_current_state];
}
YY_DO_BEFORE_ACTION;
do_action: /* This label is used only to access EOF actions. */
switch ( yy_act )
{ /* beginning of action switch */
case 0: /* must back up */
/* undo the effects of YY_DO_BEFORE_ACTION */
*yy_cp = yy_hold_char;
yy_cp = yy_last_accepting_cpos;
yy_current_state = yy_last_accepting_state;
goto yy_find_action;
case 1:
YY_RULE_SETUP
{ /* Skip blanks. */ }
YY_BREAK
case 2:
YY_RULE_SETUP
{ return TOK_OR; }
YY_BREAK
case 3:
YY_RULE_SETUP
{ return TOK_AND; }
YY_BREAK
case 4:
YY_RULE_SETUP
{ return TOK_NOT; }
YY_BREAK
case 5:
YY_RULE_SETUP
{
CString strError;
try
{
USES_CONVERSION;
CED2KLink* pLink = CED2KLink::CreateLinkFromUrl(A2T(yytext));
if (pLink && pLink->GetKind() == CED2KLink::kFile)
{
CED2KFileLink* pFileLink = pLink->GetFileLink();
if (pFileLink)
{
yylval.pstr = new CStringA;
yylval.pstr->Format("ed2k::%s", md4strA(pFileLink->GetHashKey()));
delete pLink;
return TOK_ED2K_LINK;
}
}
delete pLink;
}
catch(CString strEd2kLinkError)
{
strError = strEd2kLinkError;
}
if (strError.IsEmpty())
strError = _T("Invalid eD2K file link");
yyerror(strError);
yylval.pstr = new CStringA(yytext);
return TOK_STRING;
}
YY_BREAK
case 6:
YY_RULE_SETUP
{
yylval.pstr = new CStringA(yytext);
return TOK_ED2K_LINK;
}
YY_BREAK
case 7:
YY_RULE_SETUP
{
yylval.pstr = new CStringA(yytext);
return TOK_STRING;
}
YY_BREAK
case 8:
YY_RULE_SETUP
{
int l = 128;
char* psz = (char*)malloc(l);
int i = 0;
int c;
while ((c = yyinput()) != '\"')
{
if (c == EOF || c == '\n'){
unput(c);
yyerror(GetResString(IDS_SEARCH_UNTERMSTRING));
break;
}
if (c == '\\'){ /*Escape sequence*/
switch (c = yyinput())
{
case '\n':
continue;
case 't': /*Tab*/
c = '\t';
break;
case 'n': /*Linefeed*/
c = '\n';
break;
case 'f': /*Formfeed*/
c = '\f';
break;
case 'r': /*Carriage return*/
c = '\r';
break;
case '\\': /*Backslash*/
c = '\\';
break;
case '"': /*Double quotation mark*/
c = '\"';
break;
case '\'': /*Single quotation mark*/
c = '\'';
break;
case '?': /*Question mark*/
c = '\?';
break;
case 'v': /*Vertical Tab*/
c = '\v';
break;
case 'a': /*Alert*/
c = '\a';
break;
case 'b': /*Backspace*/
c = '\b';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -