📄 yydef.h
字号:
#ifndef __yydef_h
#define __yydef_h
///////////////////////////////////////////////////////////////////////////////
// $Header: /shorthand/src/yydef.h 5 1/09/03 7:14p Arm $
//-----------------------------------------------------------------------------
// Project: ShortHand interpreter
// Author: Andrei Remenchuk <andrei@remenchuk.com>
//-----------------------------------------------------------------------------
// value.cpp: ShortHand parser and scaner common definitions
///////////////////////////////////////////////////////////////////////////////
#include "FlexLexer.h"
#include "mstream.h"
#include "cstring.h"
#include "mman.h"
#define YYERROR_VERBOSE 1
#ifndef YYLSP_NEEDED
#define YYLSP_NEEDED 1
#endif
/////////////////////////////////////////////////////////////////
// definitions for C++ lexer
/////////////////////////////////////////////////////////////////
#define yyinit true
/*
#ifdef YYPURE
#define YY_DECL int yylex(void *yylval)
#define TOKEN ((YYSTYPE*)yylval)
#define RETURN_TOKEN(f) return (((YYSTYPE*)yylval)->num=f)
#else
#define YY_DECL int yylex()
#define TOKEN (&yylval)
#define RETURN_TOKEN(f) return (yylval.num=f)
#endif
*/
#define YYPARSE_PARAM parser_module
#define YYDEBUG 3
#ifdef YYLTYPE
#undef YYLTYPE
#endif
struct yyltype
{
int first_line;
int first_column;
int last_line;
int last_column;
int offset;
int length;
char* text;
};
#define YYLTYPE yyltype
int yyparse(void* param);
/*
void yyinitscan();
const char* flush_html();
extern int yydebug;
*/
class TiModule;
/**
* ShortHand lexer obejct.
*/
class ShortHandLexer : public yyFlexLexer
{
protected:
mstream& m_input; // input stream
memory m_scratch; // scratch memory
string m_html_buffer; // html buffer
public:
int yyline; // current line (one-based)
int yypos; // current position (one-based)
YYLTYPE yylloc; // current location
void* yylval; // current return value for parser
int tag; // type of the current escape tag
bool need_extra_eof;
int override_ident_type;
int escape; // type of escape tag
protected:
int LexerInput(char* buf, int max_size);
void LexerOutput( const char* buf, int size );
void LexerError( const char* msg );
public:
ShortHandLexer(mstream& input);
const char* flush_html();
void append_html(const char* s);
void append_html(char ch);
friend class TiModule;
friend class yyFlexLexer;
};
#endif // __yydef_h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -