Lines Matching refs:token
40 static pANTLR3_STRING getText (pANTLR3_COMMON_TOKEN token);
41 static void setText (pANTLR3_COMMON_TOKEN token, pANTLR3_STRING text);
42 static void setText8 (pANTLR3_COMMON_TOKEN token, pANTLR3_UINT8 text);
43 static ANTLR3_UINT32 getType (pANTLR3_COMMON_TOKEN token);
44 static void setType (pANTLR3_COMMON_TOKEN token, ANTLR3_UINT32 type);
45 static ANTLR3_UINT32 getLine (pANTLR3_COMMON_TOKEN token);
46 static void setLine (pANTLR3_COMMON_TOKEN token, ANTLR3_UINT32 line);
47 static ANTLR3_INT32 getCharPositionInLine (pANTLR3_COMMON_TOKEN token);
48 static void setCharPositionInLine (pANTLR3_COMMON_TOKEN token, ANTLR3_INT32 pos);
49 static ANTLR3_UINT32 getChannel (pANTLR3_COMMON_TOKEN token);
50 static void setChannel (pANTLR3_COMMON_TOKEN token, ANTLR3_UINT32 channel);
51 static ANTLR3_MARKER getTokenIndex (pANTLR3_COMMON_TOKEN token);
52 static void setTokenIndex (pANTLR3_COMMON_TOKEN token, ANTLR3_MARKER);
53 static ANTLR3_MARKER getStartIndex (pANTLR3_COMMON_TOKEN token);
54 static void setStartIndex (pANTLR3_COMMON_TOKEN token, ANTLR3_MARKER index);
55 static ANTLR3_MARKER getStopIndex (pANTLR3_COMMON_TOKEN token);
56 static void setStopIndex (pANTLR3_COMMON_TOKEN token, ANTLR3_MARKER index);
57 static pANTLR3_STRING toString (pANTLR3_COMMON_TOKEN token);
75 pANTLR3_COMMON_TOKEN token; in antlr3CommonTokenNew() local
79 token = newToken(); in antlr3CommonTokenNew()
81 if (token != NULL) in antlr3CommonTokenNew()
83 token->setType(token, ttype); in antlr3CommonTokenNew()
88 return token; in antlr3CommonTokenNew()
193 pANTLR3_COMMON_TOKEN token; in newPoolToken() local
208 token = factory->pools[factory->thisPool] + factory->nextToken; in newPoolToken()
215 if (token->setStartIndex == NULL) in newPoolToken()
217 antlr3SetTokenAPI(token); in newPoolToken()
221 token->factoryMade = ANTLR3_TRUE; in newPoolToken()
222 token->strFactory = factory->input == NULL ? NULL : factory->input->strFactory; in newPoolToken()
223 token->input = factory->input; in newPoolToken()
228 return token; in newPoolToken()
247 ANTLR3_UINT32 token; in factoryClose() local
269 for (token = 0; token < limit; token++) in factoryClose()
273 check = pool + token; in factoryClose()
306 pANTLR3_COMMON_TOKEN token; in newToken() local
310 token = (pANTLR3_COMMON_TOKEN) ANTLR3_CALLOC(1, (size_t)(sizeof(ANTLR3_COMMON_TOKEN))); in newToken()
312 if (token == NULL) in newToken()
319 antlr3SetTokenAPI(token); in newToken()
320 token->factoryMade = ANTLR3_FALSE; in newToken()
322 return token; in newToken()
326 antlr3SetTokenAPI(pANTLR3_COMMON_TOKEN token) in antlr3SetTokenAPI() argument
328 token->getText = getText; in antlr3SetTokenAPI()
329 token->setText = setText; in antlr3SetTokenAPI()
330 token->setText8 = setText8; in antlr3SetTokenAPI()
331 token->getType = getType; in antlr3SetTokenAPI()
332 token->setType = setType; in antlr3SetTokenAPI()
333 token->getLine = getLine; in antlr3SetTokenAPI()
334 token->setLine = setLine; in antlr3SetTokenAPI()
335 token->setLine = setLine; in antlr3SetTokenAPI()
336 token->getCharPositionInLine = getCharPositionInLine; in antlr3SetTokenAPI()
337 token->setCharPositionInLine = setCharPositionInLine; in antlr3SetTokenAPI()
338 token->getChannel = getChannel; in antlr3SetTokenAPI()
339 token->setChannel = setChannel; in antlr3SetTokenAPI()
340 token->getTokenIndex = getTokenIndex; in antlr3SetTokenAPI()
341 token->setTokenIndex = setTokenIndex; in antlr3SetTokenAPI()
342 token->getStartIndex = getStartIndex; in antlr3SetTokenAPI()
343 token->setStartIndex = setStartIndex; in antlr3SetTokenAPI()
344 token->getStopIndex = getStopIndex; in antlr3SetTokenAPI()
345 token->setStopIndex = setStopIndex; in antlr3SetTokenAPI()
346 token->toString = toString; in antlr3SetTokenAPI()
351 static pANTLR3_STRING getText (pANTLR3_COMMON_TOKEN token) in getText() argument
353 switch (token->textState) in getText()
360 return token->tokText.text; in getText()
369 if (token->strFactory != NULL) in getText()
371 …token->tokText.text = token->strFactory->newStr8(token->strFactory, (pANTLR3_UINT8)token->tokText.… in getText()
372 token->textState = ANTLR3_TEXT_STRING; in getText()
373 return token->tokText.text; in getText()
387 if (token->type == ANTLR3_TOKEN_EOF) in getText()
389 token->tokText.text = token->strFactory->newStr8(token->strFactory, (pANTLR3_UINT8)"<EOF>"); in getText()
390 token->textState = ANTLR3_TEXT_STRING; in getText()
391 token->tokText.text->factory = token->strFactory; in getText()
392 return token->tokText.text; in getText()
400 if (token->input != NULL) in getText()
403 return token->input->substr( token->input, in getText()
404 token->getStartIndex(token), in getText()
405 token->getStopIndex(token) in getText()
415 static void setText8 (pANTLR3_COMMON_TOKEN token, pANTLR3_UINT8 text) in setText8() argument
421 switch (token->textState) in setText8()
429 token->textState = ANTLR3_TEXT_CHARP; in setText8()
430 token->tokText.chars = (pANTLR3_UCHAR)text; in setText8()
437 token->tokText.text->set8(token->tokText.text, (const char *)text); in setText8()
451 static void setText (pANTLR3_COMMON_TOKEN token, pANTLR3_STRING text) in setText() argument
456 token->textState = ANTLR3_TEXT_STRING; in setText()
457 token->tokText.text = text; in setText()
464 static ANTLR3_UINT32 getType (pANTLR3_COMMON_TOKEN token) in getType() argument
466 return token->type; in getType()
469 static void setType (pANTLR3_COMMON_TOKEN token, ANTLR3_UINT32 type) in setType() argument
471 token->type = type; in setType()
474 static ANTLR3_UINT32 getLine (pANTLR3_COMMON_TOKEN token) in getLine() argument
476 return token->line; in getLine()
479 static void setLine (pANTLR3_COMMON_TOKEN token, ANTLR3_UINT32 line) in setLine() argument
481 token->line = line; in setLine()
484 static ANTLR3_INT32 getCharPositionInLine (pANTLR3_COMMON_TOKEN token) in getCharPositionInLine() argument
486 return token->charPosition; in getCharPositionInLine()
489 static void setCharPositionInLine (pANTLR3_COMMON_TOKEN token, ANTLR3_INT32 pos) in setCharPositionInLine() argument
491 token->charPosition = pos; in setCharPositionInLine()
494 static ANTLR3_UINT32 getChannel (pANTLR3_COMMON_TOKEN token) in getChannel() argument
496 return token->channel; in getChannel()
499 static void setChannel (pANTLR3_COMMON_TOKEN token, ANTLR3_UINT32 channel) in setChannel() argument
501 token->channel = channel; in setChannel()
504 static ANTLR3_MARKER getTokenIndex (pANTLR3_COMMON_TOKEN token) in getTokenIndex() argument
506 return token->index; in getTokenIndex()
509 static void setTokenIndex (pANTLR3_COMMON_TOKEN token, ANTLR3_MARKER index) in setTokenIndex() argument
511 token->index = index; in setTokenIndex()
514 static ANTLR3_MARKER getStartIndex (pANTLR3_COMMON_TOKEN token) in getStartIndex() argument
516 return token->start == -1 ? (ANTLR3_MARKER)(token->input->data) : token->start; in getStartIndex()
519 static void setStartIndex (pANTLR3_COMMON_TOKEN token, ANTLR3_MARKER start) in setStartIndex() argument
521 token->start = start; in setStartIndex()
524 static ANTLR3_MARKER getStopIndex (pANTLR3_COMMON_TOKEN token) in getStopIndex() argument
526 return token->stop; in getStopIndex()
529 static void setStopIndex (pANTLR3_COMMON_TOKEN token, ANTLR3_MARKER stop) in setStopIndex() argument
531 token->stop = stop; in setStopIndex()
534 static pANTLR3_STRING toString (pANTLR3_COMMON_TOKEN token) in toString() argument
539 text = token->getText(token); in toString()
560 outtext->addi (outtext, (ANTLR3_INT32)token->getTokenIndex(token)); in toString()
562 outtext->addi (outtext, (ANTLR3_INT32)token->getStartIndex(token)); in toString()
564 outtext->addi (outtext, (ANTLR3_INT32)token->getStopIndex(token)); in toString()
568 outtext->addi (outtext, token->type); in toString()
571 if (token->getChannel(token) > ANTLR3_TOKEN_DEFAULT_CHANNEL) in toString()
574 outtext->addi (outtext, (ANTLR3_INT32)token->getChannel(token)); in toString()
579 outtext->addi (outtext, (ANTLR3_INT32)token->getLine(token)); in toString()
581 outtext->addi (outtext, token->getCharPositionInLine(token)); in toString()