本文整理汇总了C++中pANTLR3_COMMON_TOKEN类的典型用法代码示例。如果您正苦于以下问题:C++ pANTLR3_COMMON_TOKEN类的具体用法?C++ pANTLR3_COMMON_TOKEN怎么用?C++ pANTLR3_COMMON_TOKEN使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了pANTLR3_COMMON_TOKEN类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: isTokenText
/**
* Helper for the query type determination.
*/
static bool isTokenText(pANTLR3_COMMON_TOKEN token, const std::string &expected)
{
pANTLR3_STRING text = token->getText(token);
if (text == NULL)
return false;
return base::tolower((const char*)text->chars) == expected;
}
开发者ID:ThiagoGarciaAlves,项目名称:mysql-workbench,代码行数:11,代码来源:mysql-scanner.cpp
示例2: print_token_text
void print_token_text(pANTLR3_COMMON_TOKEN tok)
{
if (tok->getType(tok) == T_EOS) {
printf("\n");
}
else {
printf("\%s", tok->getText(tok)->chars);
}
}
开发者ID:OpenFortranProject,项目名称:open-fortran-parser,代码行数:9,代码来源:support.c
示例3:
static void
dbgSetTokenBoundaries (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_TREE t, pANTLR3_COMMON_TOKEN startToken, pANTLR3_COMMON_TOKEN stopToken)
{
setTokenBoundaries(adaptor, t, startToken, stopToken);
if (t != NULL && startToken != NULL && stopToken != NULL)
{
adaptor->debugger->setTokenBoundaries(adaptor->debugger, t, startToken->getTokenIndex(startToken), stopToken->getTokenIndex(stopToken));
}
}
开发者ID:jariba,项目名称:europa-pso,代码行数:10,代码来源:antlr3commontreeadaptor.c
示例4:
static pANTLR3_BASE_TREE
createTypeTokenText (pANTLR3_BASE_TREE_ADAPTOR adaptor, ANTLR3_UINT32 tokenType, pANTLR3_COMMON_TOKEN fromToken, pANTLR3_UINT8 text)
{
/* Create the new token
*/
fromToken = adaptor->createTokenFromToken(adaptor, fromToken);
/* Set the type of the new token to that supplied
*/
fromToken->setType(fromToken, tokenType);
/* Set the text of the token accordingly
*/
fromToken->setText8(fromToken, text);
/* Return a new node based upon this token
*/
return (pANTLR3_BASE_TREE)adaptor->create(adaptor, fromToken);
}
开发者ID:Daniel1892,项目名称:tora,代码行数:19,代码来源:antlr3basetreeadaptor.c
示例5: printToken
void printToken(pANTLR3_COMMON_TOKEN tok)
{
printf("[");
printf("@\%d,", (int)tok->getTokenIndex(tok));
printf("\%d:", (int)tok->getStartIndex(tok));
printf("\%d=", (int)tok->getStopIndex(tok));
printf("'\%s',", tok->getText(tok)->chars);
printf("<\%d>,", (int)tok->getType(tok));
if (tok->getChannel(tok) > ANTLR3_TOKEN_DEFAULT_CHANNEL) {
printf("channel=\%d,", (int)tok->getChannel(tok));
}
开发者ID:OpenFortranProject,项目名称:open-fortran-parser,代码行数:11,代码来源:fparser.c
示例6: toStringTT
static pANTLR3_STRING
toStringTT (pANTLR3_TOKEN_STREAM ts, pANTLR3_COMMON_TOKEN start, pANTLR3_COMMON_TOKEN stop)
{
if (start != NULL && stop != NULL)
{
return ts->toStringSS(ts, (ANTLR3_UINT32)start->getTokenIndex(start), (ANTLR3_UINT32)stop->getTokenIndex(stop));
}
else
{
return NULL;
}
}
开发者ID:10114395,项目名称:android-5.0.0_r5,代码行数:12,代码来源:antlr3tokenstream.c
示例7:
static pANTLR3_STRING getText (pANTLR3_COMMON_TOKEN token)
{
if (token->text != NULL)
{
return token->text;
}
if (token->type == ANTLR3_TOKEN_EOF)
{
token->setText8(token, (pANTLR3_UINT8)"<EOF>");
return token->text;
}
if (token->input != NULL)
{
return token->input->substr( token->input,
token->getStartIndex(token),
token->getStopIndex(token));
}
/* Nothing to return
*/
return NULL;
}
开发者ID:UIKit0,项目名称:mclab,代码行数:22,代码来源:antlr3commontoken.c
示例8: antlr3SetTokenAPI
ANTLR3_API void
antlr3SetTokenAPI(pANTLR3_COMMON_TOKEN token)
{
token->getText = getText;
token->setText = setText;
token->setText8 = setText8;
token->getType = getType;
token->setType = setType;
token->getLine = getLine;
token->setLine = setLine;
token->setLine = setLine;
token->getCharPositionInLine = getCharPositionInLine;
token->setCharPositionInLine = setCharPositionInLine;
token->getChannel = getChannel;
token->setChannel = setChannel;
token->getTokenIndex = getTokenIndex;
token->setTokenIndex = setTokenIndex;
token->getStartIndex = getStartIndex;
token->setStartIndex = setStartIndex;
token->getStopIndex = getStopIndex;
token->setStopIndex = setStopIndex;
token->toString = toString;
/* Set defaults
*/
token->setCharPositionInLine(token, -1);
token->custom = NULL;
token->freeCustom = NULL;
token->type = ANTLR3_TOKEN_INVALID;
token->text = NULL;
token->start = 0;
token->stop = 0;
token->channel = ANTLR3_TOKEN_DEFAULT_CHANNEL;
token->line = 0;
token->index = 0;
token->input = NULL;
return;
}
开发者ID:UIKit0,项目名称:mclab,代码行数:40,代码来源:antlr3commontoken.c
示例9: token_text
string mcmt_state::token_text(pANTLR3_COMMON_TOKEN token) {
ANTLR3_MARKER start = token->getStartIndex(token);
size_t size = token->getStopIndex(token) - start + 1;
return string((const char*) start, size);
}
开发者ID:benjaminfjones,项目名称:sally,代码行数:5,代码来源:mcmt_state.cpp
示例10: switch
static pANTLR3_STRING getText (pANTLR3_COMMON_TOKEN token)
{
switch (token->textState)
{
case ANTLR3_TEXT_STRING:
// Someone already created a string for this token, so we just
// use it.
//
return token->tokText.text;
break;
case ANTLR3_TEXT_CHARP:
// We had a straight text pointer installed, now we
// must convert it to a string. Note we have to do this here
// or otherwise setText8() will just install the same char*
//
if (token->strFactory != NULL)
{
token->tokText.text = token->strFactory->newStr8(token->strFactory, (pANTLR3_UINT8)token->tokText.chars);
token->textState = ANTLR3_TEXT_STRING;
return token->tokText.text;
}
else
{
// We cannot do anything here
//
return NULL;
}
break;
default:
// EOF is a special case
//
if (token->type == ANTLR3_TOKEN_EOF)
{
token->tokText.text = token->strFactory->newStr8(token->strFactory, (pANTLR3_UINT8)"<EOF>");
token->textState = ANTLR3_TEXT_STRING;
token->tokText.text->factory = token->strFactory;
return token->tokText.text;
}
// We had nothing installed in the token, create a new string
// from the input stream
//
if (token->input != NULL)
{
return token->input->substr( token->input,
token->getStartIndex(token),
token->stop
);
}
// Nothing to return, there is no input stream
//
return NULL;
break;
}
}
开发者ID:cctbx,项目名称:cctbx-playground,代码行数:64,代码来源:antlr3commontoken.c
示例11: GetType
ANTLR3_UINT32 GetType(pANTLR3_COMMON_TOKEN token)
{
return token->getType(token);
}
开发者ID:ldh9451,项目名称:XLE,代码行数:4,代码来源:InterfaceSignature.cpp
注:本文中的pANTLR3_COMMON_TOKEN类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论