1. tars2cpp support tarsgateway; 2.AppProtocal add totalResponse for all protocal.

This commit is contained in:
marklightning 2020-06-14 19:58:11 +08:00
parent 84aa9eb90e
commit 43de9b6ad1
7 changed files with 2625 additions and 2562 deletions

View File

@ -563,6 +563,140 @@ public:
return TC_NetWorkBuffer::PACKET_FULL;
}
template <uint32_t iMinLength, uint32_t iMaxLength>
static TC_NetWorkBuffer::PACKET_TYPE totalResponseLen(TC_NetWorkBuffer &in, ResponsePacket &rsp)
{
uint32_t len = (uint32_t)in.getBufferLength();
//收到的字节数太少, 还需要继续接收
if (len < sizeof(uint32_t))
return TC_NetWorkBuffer::PACKET_LESS;
//获取包总体长度
uint32_t iHeaderLen = in.getValueOf4();
//做一下保护,长度大于10M
if (iHeaderLen < iMinLength || iHeaderLen > iMaxLength)
{
throw TarsDecodeException("packet length too long or too short,len:" + TC_Common::tostr(iHeaderLen));
}
//包没有接收全
if (len < iHeaderLen)
{
//看看包头是否正确
static const uint32_t head = 20;
if (len >= head)
{
string buffer;
in.getHeader(head, buffer);
TarsInputStream<BufferReader> is;
is.setBuffer(buffer.c_str() + sizeof(tars::Int32), head);
// ResponsePacket rsp;
is.read(rsp.iVersion, 1, false);
if (rsp.iVersion != TARSVERSION && rsp.iVersion != TUPVERSION && rsp.iVersion != JSONVERSION)
{
throw TarsDecodeException("version not correct, version:" + TC_Common::tostr(rsp.iVersion));
}
is.read(rsp.cPacketType, 2, false);
if (rsp.cPacketType != TARSNORMAL)
{
throw TarsDecodeException("packettype not correct, packettype:" + TC_Common::tostr((int)rsp.cPacketType));
}
is.read(rsp.iRequestId, 3, false);
is.read(rsp.iMessageType, 4, false);
is.read(rsp.iRet, 5, false);
if (rsp.iRet < TARSSERVERUNKNOWNERR)
{
throw TarsDecodeException("response value not correct, value:" + TC_Common::tostr(rsp.iRet));
}
}
return TC_NetWorkBuffer::PACKET_LESS;
}
else
{
//看看包头是否正确
static const uint32_t head = 20;
string buffer;
in.getHeader(head, buffer);
TarsInputStream<BufferReader> is;
is.setBuffer(buffer.c_str() + sizeof(tars::Int32), head);
is.read(rsp.iVersion, 1, false);
if (rsp.iVersion == TUPVERSION)
{
vector<char> buffer;
buffer.resize(iHeaderLen);
in.getHeader(iHeaderLen, buffer);
TarsInputStream<BufferReader> is;
is.setBuffer(buffer.data() + sizeof(tars::Int32), buffer.size() - sizeof(tars::Int32));
//TUP的响应包其实也是返回包
RequestPacket req;
req.readFrom(is);
if (req.cPacketType != TARSNORMAL)
{
throw TarsDecodeException("packettype not correct, packettype:" + TC_Common::tostr((int)req.cPacketType));
}
rsp.cPacketType = req.cPacketType;
rsp.iMessageType = req.iMessageType;
rsp.iRequestId = req.iRequestId;
rsp.iVersion = req.iVersion;
rsp.context = req.context;
//tup的响应包直接放入到sBuffer里面
rsp.sBuffer = buffer;
in.moveHeader(iHeaderLen);
}
else if (rsp.iVersion == TARSVERSION || rsp.iVersion == JSONVERSION)
{
vector<char> buffer;
bool ret = in.parseBufferOf4(buffer, iMinLength, iMaxLength);
if (!ret)
{
throw TarsDecodeException("parse buffer exception");
}
TarsInputStream<BufferReader> is;
is.setBuffer(buffer.data(), buffer.size());
rsp.readFrom(is);
if (rsp.cPacketType != TARSNORMAL)
{
throw TarsDecodeException("packettype not correct, packettype:" + TC_Common::tostr((int)rsp.cPacketType));
}
if (rsp.iRet < TARSSERVERUNKNOWNERR)
{
throw TarsDecodeException("response value not correct, value:" + TC_Common::tostr(rsp.iRet));
}
}
else
{
throw TarsDecodeException("===>version not correct, version:" + TC_Common::tostr(rsp.iVersion));
}
}
return TC_NetWorkBuffer::PACKET_FULL;
}
public:
request_protocol requestFunc;

View File

@ -129,16 +129,16 @@ int main(int argc, char* argv[])
t2c.setXmlSupport(true, vXmlIntf);
}
if (option.hasParam("json"))
{
t2c.setJsonSupport(true);
string sJson = tars::TC_Common::trim(option.getValue("json"));
sJson = tars::TC_Common::trimleft(tars::TC_Common::trimright(sJson, "]"), "[");
if (!sJson.empty())
{
t2c.setJsonSupport(tars::TC_Common::sepstr<string>(sJson, ",", false));
}
}
// if (option.hasParam("json"))
// {
// t2c.setJsonSupport(true);
// string sJson = tars::TC_Common::trim(option.getValue("json"));
// sJson = tars::TC_Common::trimleft(tars::TC_Common::trimright(sJson, "]"), "[");
// if (!sJson.empty())
// {
// t2c.setJsonSupport(tars::TC_Common::sepstr<string>(sJson, ",", false));
// }
// }
t2c.setTarsMaster(option.hasParam("tarsMaster"));

View File

@ -1576,7 +1576,8 @@ string Tars2Cpp::generateServantDispatch(const OperationPtr& pPtr, const string&
s << TAB << "}" << endl;
// 支持JSON协议分发
if (_bJsonSupport && tars::TC_Common::matchPeriod(pPtr->getId(), _vJsonIntf))
//if (_bJsonSupport && tars::TC_Common::matchPeriod(pPtr->getId(), _vJsonIntf))
if (_bJsonSupport)
{
s << TAB << "else if (_current->getRequestVersion() == JSONVERSION)" << endl;
s << TAB << "{" << endl;
@ -1664,7 +1665,7 @@ string Tars2Cpp::generateServantDispatch(const OperationPtr& pPtr, const string&
s << TAB << "{" << endl;
INC_TAB;
s << TAB << "if (_current->getRequestVersion() == TUPVERSION )" << endl;
s << TAB << "if (_current->getRequestVersion() == TUPVERSION)" << endl;
s << TAB << "{" << endl;
INC_TAB;
@ -1674,6 +1675,7 @@ string Tars2Cpp::generateServantDispatch(const OperationPtr& pPtr, const string&
{
string sEnum2Int = (EnumPtr::dynamicCast(pPtr->getReturnPtr()->getTypePtr())) ? "(" + _namespace + "::Int32)" : "";
s << TAB << "tarsAttr.put(\"\", " << sEnum2Int << "_ret);" << endl;
s << TAB << "tarsAttr.put(\"tars_ret\", " << sEnum2Int << "_ret);" << endl;
}
for (size_t i = 0; i < vParamDecl.size(); i++)
{
@ -1690,7 +1692,8 @@ string Tars2Cpp::generateServantDispatch(const OperationPtr& pPtr, const string&
s << TAB << "}" << endl;
// 支持JSON协议分发
if (_bJsonSupport && tars::TC_Common::matchPeriod(pPtr->getId(), _vJsonIntf))
if (_bJsonSupport)
//if (_bJsonSupport && tars::TC_Common::matchPeriod(pPtr->getId(), _vJsonIntf))
{
s << TAB << "else if (_current->getRequestVersion() == JSONVERSION)" << endl;
s << TAB << "{" << endl;
@ -1705,14 +1708,17 @@ string Tars2Cpp::generateServantDispatch(const OperationPtr& pPtr, const string&
}
}
if (pPtr->getReturnPtr()->getTypePtr())
{
BuiltinPtr retPtr = BuiltinPtr::dynamicCast(pPtr->getReturnPtr()->getTypePtr());
if (retPtr->kind() >= Builtin::KindBool && retPtr->kind() <= Builtin::KindLong)
{
s << TAB << "_p->value[\"ret\"] = "<< _namespace << "::JsonOutput::writeJson(" << pPtr->getReturnPtr()->getId() << ");" << endl;
}
s << TAB << "_p->value[\"tars_ret\"] = "<< _namespace << "::JsonOutput::writeJson(_ret);" << endl;
// BuiltinPtr retPtr = BuiltinPtr::dynamicCast(pPtr->getReturnPtr()->getTypePtr());
// if (retPtr->kind() >= Builtin::KindBool && retPtr->kind() <= Builtin::KindLong)
// {
// s << TAB << "_p->value[\"tars_ret\"] = "<< _namespace << "::JsonOutput::writeJson(" << pPtr->getReturnPtr()->getId() << ");" << endl;
// }
}
s << TAB << _namespace << "::TC_Json::writeValue(_p, _sResponseBuffer);" << endl;
DEL_TAB;
@ -2141,6 +2147,7 @@ string Tars2Cpp::generateH(const OperationPtr& pPtr, bool bVirtual, const string
{
string sEnum2Int = (EnumPtr::dynamicCast(pPtr->getReturnPtr()->getTypePtr())) ? "(" + _namespace + "::Int32)" : "";
s << TAB << "tarsAttr.put(\"\", " << sEnum2Int << "_ret);" << endl;
s << TAB << "tarsAttr.put(\"tars_ret\", " << sEnum2Int << "_ret);" << endl;
}
for(size_t i = 0; i < vParamDecl.size(); i++)
{
@ -2158,6 +2165,44 @@ string Tars2Cpp::generateH(const OperationPtr& pPtr, bool bVirtual, const string
DEL_TAB;
s << TAB << "}" << endl;
if (_bJsonSupport)
{
s << TAB << "else if (current->getRequestVersion() == JSONVERSION)" << endl;
s << TAB << "{" << endl;
INC_TAB;
s << TAB << _namespace << "::JsonValueObjPtr _p = new " << _namespace << "::JsonValueObj();" << endl;
for (size_t i = 0; i < vParamDecl.size(); i++)
{
string sParamName = vParamDecl[i]->getTypeIdPtr()->getId();
if (vParamDecl[i]->isOut())
{
s << TAB << "_p->value[\"" << sParamName << "\"] = " << _namespace << "::JsonOutput::writeJson(" << sParamName << ");" << endl;
}
}
if (pPtr->getReturnPtr()->getTypePtr())
{
s << TAB << "_p->value[\"tars_ret\"] = " << _namespace << "::JsonOutput::writeJson(_ret);" << endl;
// BuiltinPtr retPtr = BuiltinPtr::dynamicCast(pPtr->getReturnPtr()->getTypePtr());
// if (retPtr && retPtr->kind() >= Builtin::KindBool && retPtr->kind() <= Builtin::KindLong)
// {
// s << TAB << "_p->value[\"tars_ret\"] = " << _namespace << "::JsonOutput::writeJson(" << pPtr->getReturnPtr()->getId() << ");" << endl;
// //s << TAB << "_p->value[\"\"] = " << _namespace << "::JsonOutput::writeJson(" << pPtr->getReturnPtr()->getId() << ");" << endl;
// }
}
s << TAB << "vector<char> sJsonResponseBuffer;" << endl;
s << TAB << _namespace << "::TC_Json::writeValue(_p, sJsonResponseBuffer);" << endl;
s << TAB << "current->sendResponse(tars::TARSSERVERSUCCESS, sJsonResponseBuffer);" << endl;
DEL_TAB;
s << TAB << "}" << endl;
}
s << TAB << "else" << endl;
s << TAB << "{" << endl;

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 35
#define YY_FLEX_SUBMINOR_VERSION 37
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@ -47,7 +47,6 @@ typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
typedef uint64_t flex_uint64_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
@ -55,7 +54,6 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
@ -86,6 +84,8 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
@ -176,7 +176,7 @@ extern FILE *yyin, *yyout;
*/
#define YY_LESS_LINENO(n) \
do { \
yy_size_t yyl;\
int yyl;\
for ( yyl = n; yyl < yyleng; ++yyl )\
if ( yytext[yyl] == '\n' )\
--yylineno;\
@ -369,7 +369,7 @@ static void yy_fatal_error (yyconst char msg[] );
*/
#define YY_DO_BEFORE_ACTION \
(yytext_ptr) = yy_bp; \
yyleng = (yy_size_t) (yy_cp - yy_bp); \
yyleng = (size_t) (yy_cp - yy_bp); \
(yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
@ -513,7 +513,7 @@ int yy_flex_debug = 0;
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
#line 1 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
#line 1 "/home/worker/Centos_share/src/TarsCloud/UP-Tars/tars_mark_dev/TarsCpp/tools/tarsgrammar/tars.l"
/**
* Tencent is pleased to support the open source community by making Tars available.
*
@ -529,7 +529,7 @@ char *yytext;
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
#line 20 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
#line 20 "/home/worker/Centos_share/src/TarsCloud/UP-Tars/tars_mark_dev/TarsCpp/tools/tarsgrammar/tars.l"
#include <map>
#include <string>
#include <sstream>
@ -649,7 +649,7 @@ static int input (void );
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
#define ECHO fwrite( yytext, yyleng, 1, yyout )
#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@ -660,7 +660,7 @@ static int input (void );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
yy_size_t n; \
size_t n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
@ -742,7 +742,7 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
#line 67 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
#line 67 "/home/worker/Centos_share/src/TarsCloud/UP-Tars/tars_mark_dev/TarsCpp/tools/tarsgrammar/tars.l"
#line 749 "tars.lex.cpp"
@ -840,12 +840,12 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
#line 69 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
#line 69 "/home/worker/Centos_share/src/TarsCloud/UP-Tars/tars_mark_dev/TarsCpp/tools/tarsgrammar/tars.l"
{ BEGIN(INCL); }
YY_BREAK
case 2:
YY_RULE_SETUP
#line 71 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
#line 71 "/home/worker/Centos_share/src/TarsCloud/UP-Tars/tars_mark_dev/TarsCpp/tools/tarsgrammar/tars.l"
{
if ( include_file_stack_ptr >= MAX_INCLUDE_DEPTH )
{
@ -878,7 +878,7 @@ YY_RULE_SETUP
YY_BREAK
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(INCL):
#line 101 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
#line 101 "/home/worker/Centos_share/src/TarsCloud/UP-Tars/tars_mark_dev/TarsCpp/tools/tarsgrammar/tars.l"
{
--include_file_stack_ptr;
if ( include_file_stack_ptr < 0 )
@ -897,14 +897,14 @@ case YY_STATE_EOF(INCL):
YY_BREAK
case 3:
YY_RULE_SETUP
#line 117 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
#line 117 "/home/worker/Centos_share/src/TarsCloud/UP-Tars/tars_mark_dev/TarsCpp/tools/tarsgrammar/tars.l"
{
return TARS_SCOPE_DELIMITER;
}
YY_BREAK
case 4:
YY_RULE_SETUP
#line 121 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
#line 121 "/home/worker/Centos_share/src/TarsCloud/UP-Tars/tars_mark_dev/TarsCpp/tools/tarsgrammar/tars.l"
{
// C++ comment
bool e = false;
@ -925,7 +925,7 @@ YY_RULE_SETUP
YY_BREAK
case 5:
YY_RULE_SETUP
#line 139 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
#line 139 "/home/worker/Centos_share/src/TarsCloud/UP-Tars/tars_mark_dev/TarsCpp/tools/tarsgrammar/tars.l"
{
// C comment
bool e = false;
@ -976,7 +976,7 @@ YY_RULE_SETUP
YY_BREAK
case 6:
YY_RULE_SETUP
#line 187 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
#line 187 "/home/worker/Centos_share/src/TarsCloud/UP-Tars/tars_mark_dev/TarsCpp/tools/tarsgrammar/tars.l"
{
StringGrammarPtr ident = new StringGrammar;
ident->v = yytext;
@ -987,7 +987,7 @@ YY_RULE_SETUP
case 7:
/* rule 7 can match eol */
YY_RULE_SETUP
#line 194 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
#line 194 "/home/worker/Centos_share/src/TarsCloud/UP-Tars/tars_mark_dev/TarsCpp/tools/tarsgrammar/tars.l"
{
StringGrammarPtr ident = new StringGrammar;
ident->v = yytext;
@ -1000,7 +1000,7 @@ YY_RULE_SETUP
YY_BREAK
case 8:
YY_RULE_SETUP
#line 204 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
#line 204 "/home/worker/Centos_share/src/TarsCloud/UP-Tars/tars_mark_dev/TarsCpp/tools/tarsgrammar/tars.l"
{
StringGrammarPtr str = new StringGrammar;
bool e = false;
@ -1115,7 +1115,7 @@ YY_RULE_SETUP
YY_BREAK
case 9:
YY_RULE_SETUP
#line 316 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
#line 316 "/home/worker/Centos_share/src/TarsCloud/UP-Tars/tars_mark_dev/TarsCpp/tools/tarsgrammar/tars.l"
{
errno = 0;
IntergerGrammarPtr ptr = new IntergerGrammar;
@ -1140,7 +1140,7 @@ YY_RULE_SETUP
YY_BREAK
case 10:
YY_RULE_SETUP
#line 338 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
#line 338 "/home/worker/Centos_share/src/TarsCloud/UP-Tars/tars_mark_dev/TarsCpp/tools/tarsgrammar/tars.l"
{
errno = 0;
FloatGrammarPtr ptr = new FloatGrammar;
@ -1175,7 +1175,7 @@ YY_RULE_SETUP
case 11:
/* rule 11 can match eol */
YY_RULE_SETUP
#line 369 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
#line 369 "/home/worker/Centos_share/src/TarsCloud/UP-Tars/tars_mark_dev/TarsCpp/tools/tarsgrammar/tars.l"
{
if(yytext[0] == '\n')
{
@ -1185,7 +1185,7 @@ YY_RULE_SETUP
YY_BREAK
case 12:
YY_RULE_SETUP
#line 376 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
#line 376 "/home/worker/Centos_share/src/TarsCloud/UP-Tars/tars_mark_dev/TarsCpp/tools/tarsgrammar/tars.l"
{
if(yytext[0] < 32 || yytext[0] > 126)
{
@ -1204,7 +1204,7 @@ YY_RULE_SETUP
YY_BREAK
case 13:
YY_RULE_SETUP
#line 392 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
#line 392 "/home/worker/Centos_share/src/TarsCloud/UP-Tars/tars_mark_dev/TarsCpp/tools/tarsgrammar/tars.l"
ECHO;
YY_BREAK
#line 1211 "tars.lex.cpp"
@ -1398,7 +1398,7 @@ static int yy_get_next_buffer (void)
{ /* Not enough room in the buffer - grow it. */
/* just a shorter name for the current buffer */
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
int yy_c_buf_p_offset =
(int) ((yy_c_buf_p) - b->yy_ch_buf);
@ -1531,7 +1531,7 @@ static int yy_get_next_buffer (void)
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 51);
return yy_is_jam ? 0 : yy_current_state;
return yy_is_jam ? 0 : yy_current_state;
}
static void yyunput (int c, register char * yy_bp )
@ -1623,7 +1623,7 @@ static int yy_get_next_buffer (void)
case EOB_ACT_END_OF_FILE:
{
if ( yywrap( ) )
return 0;
return EOF;
if ( ! (yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
@ -1764,10 +1764,6 @@ static void yy_load_buffer_state (void)
yyfree((void *) b );
}
#ifndef __cplusplus
extern int isatty (int );
#endif /* __cplusplus */
/* Initializes or reinitializes a buffer.
* This function is sometimes called more than once on the same buffer,
* such as during a yyrestart() or at EOF.
@ -1972,8 +1968,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
* scan from a @e copy of @a bytes.
* @param bytes the byte buffer to scan
* @param len the number of bytes in the buffer pointed to by @a bytes.
* @param yybytes the byte buffer to scan
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
*
* @return the newly allocated buffer state object.
*/
@ -1981,7 +1977,8 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len
{
YY_BUFFER_STATE b;
char *buf;
yy_size_t n, i;
yy_size_t n;
yy_size_t i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = _yybytes_len + 2;
@ -2214,7 +2211,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
#line 392 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
#line 392 "/home/worker/Centos_share/src/TarsCloud/UP-Tars/tars_mark_dev/TarsCpp/tools/tarsgrammar/tars.l"

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,13 @@
/* A Bison parser, made by GNU Bison 2.3. */
/* A Bison parser, made by GNU Bison 3.0.4. */
/* Skeleton interface for Bison's Yacc-like parsers in C
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -16,9 +15,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@ -33,87 +30,65 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YY_YY_TARS_TAB_HPP_INCLUDED
# define YY_YY_TARS_TAB_HPP_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 1
#endif
#if YYDEBUG
extern int yydebug;
#endif
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
TARS_VOID = 258,
TARS_STRUCT = 259,
TARS_BOOL = 260,
TARS_BYTE = 261,
TARS_SHORT = 262,
TARS_INT = 263,
TARS_DOUBLE = 264,
TARS_FLOAT = 265,
TARS_LONG = 266,
TARS_STRING = 267,
TARS_VECTOR = 268,
TARS_MAP = 269,
TARS_NAMESPACE = 270,
TARS_INTERFACE = 271,
TARS_IDENTIFIER = 272,
TARS_OUT = 273,
TARS_OP = 274,
TARS_KEY = 275,
TARS_ROUTE_KEY = 276,
TARS_REQUIRE = 277,
TARS_OPTIONAL = 278,
TARS_CONST_INTEGER = 279,
TARS_CONST_FLOAT = 280,
TARS_FALSE = 281,
TARS_TRUE = 282,
TARS_STRING_LITERAL = 283,
TARS_SCOPE_DELIMITER = 284,
TARS_CONST = 285,
TARS_ENUM = 286,
TARS_UNSIGNED = 287,
BAD_CHAR = 288
};
enum yytokentype
{
TARS_VOID = 258,
TARS_STRUCT = 259,
TARS_BOOL = 260,
TARS_BYTE = 261,
TARS_SHORT = 262,
TARS_INT = 263,
TARS_DOUBLE = 264,
TARS_FLOAT = 265,
TARS_LONG = 266,
TARS_STRING = 267,
TARS_VECTOR = 268,
TARS_MAP = 269,
TARS_NAMESPACE = 270,
TARS_INTERFACE = 271,
TARS_IDENTIFIER = 272,
TARS_OUT = 273,
TARS_OP = 274,
TARS_KEY = 275,
TARS_ROUTE_KEY = 276,
TARS_REQUIRE = 277,
TARS_OPTIONAL = 278,
TARS_CONST_INTEGER = 279,
TARS_CONST_FLOAT = 280,
TARS_FALSE = 281,
TARS_TRUE = 282,
TARS_STRING_LITERAL = 283,
TARS_SCOPE_DELIMITER = 284,
TARS_CONST = 285,
TARS_ENUM = 286,
TARS_UNSIGNED = 287,
BAD_CHAR = 288
};
#endif
/* Tokens. */
#define TARS_VOID 258
#define TARS_STRUCT 259
#define TARS_BOOL 260
#define TARS_BYTE 261
#define TARS_SHORT 262
#define TARS_INT 263
#define TARS_DOUBLE 264
#define TARS_FLOAT 265
#define TARS_LONG 266
#define TARS_STRING 267
#define TARS_VECTOR 268
#define TARS_MAP 269
#define TARS_NAMESPACE 270
#define TARS_INTERFACE 271
#define TARS_IDENTIFIER 272
#define TARS_OUT 273
#define TARS_OP 274
#define TARS_KEY 275
#define TARS_ROUTE_KEY 276
#define TARS_REQUIRE 277
#define TARS_OPTIONAL 278
#define TARS_CONST_INTEGER 279
#define TARS_CONST_FLOAT 280
#define TARS_FALSE 281
#define TARS_TRUE 282
#define TARS_STRING_LITERAL 283
#define TARS_SCOPE_DELIMITER 284
#define TARS_CONST 285
#define TARS_ENUM 286
#define TARS_UNSIGNED 287
#define BAD_CHAR 288
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE yylval;
int yyparse (void);
#endif /* !YY_YY_TARS_TAB_HPP_INCLUDED */