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()
207 pANTLR3_COMMON_TOKEN token; in newPoolToken() local
231 token = factory->pools[factory->thisPool] + factory->nextToken; in newPoolToken()
238 if (token->setStartIndex == NULL) in newPoolToken()
240 antlr3SetTokenAPI(token); in newPoolToken()
244 token->factoryMade = ANTLR3_TRUE; in newPoolToken()
245 token->strFactory = factory->input == NULL ? NULL : factory->input->strFactory; in newPoolToken()
246 token->input = factory->input; in newPoolToken()
251 return token; in newPoolToken()
270 ANTLR3_UINT32 token; in factoryClose() local
292 for (token = 0; token < limit; token++) in factoryClose()
296 check = pool + token; in factoryClose()
329 pANTLR3_COMMON_TOKEN token; in newToken() local
333 token = (pANTLR3_COMMON_TOKEN) ANTLR3_CALLOC(1, (size_t)(sizeof(ANTLR3_COMMON_TOKEN))); in newToken()
335 if (token == NULL) in newToken()
342 antlr3SetTokenAPI(token); in newToken()
343 token->factoryMade = ANTLR3_FALSE; in newToken()
345 return token; in newToken()
349 antlr3SetTokenAPI(pANTLR3_COMMON_TOKEN token) in antlr3SetTokenAPI() argument
351 token->getText = getText; in antlr3SetTokenAPI()
352 token->setText = setText; in antlr3SetTokenAPI()
353 token->setText8 = setText8; in antlr3SetTokenAPI()
354 token->getType = getType; in antlr3SetTokenAPI()
355 token->setType = setType; in antlr3SetTokenAPI()
356 token->getLine = getLine; in antlr3SetTokenAPI()
357 token->setLine = setLine; in antlr3SetTokenAPI()
358 token->setLine = setLine; in antlr3SetTokenAPI()
359 token->getCharPositionInLine = getCharPositionInLine; in antlr3SetTokenAPI()
360 token->setCharPositionInLine = setCharPositionInLine; in antlr3SetTokenAPI()
361 token->getChannel = getChannel; in antlr3SetTokenAPI()
362 token->setChannel = setChannel; in antlr3SetTokenAPI()
363 token->getTokenIndex = getTokenIndex; in antlr3SetTokenAPI()
364 token->setTokenIndex = setTokenIndex; in antlr3SetTokenAPI()
365 token->getStartIndex = getStartIndex; in antlr3SetTokenAPI()
366 token->setStartIndex = setStartIndex; in antlr3SetTokenAPI()
367 token->getStopIndex = getStopIndex; in antlr3SetTokenAPI()
368 token->setStopIndex = setStopIndex; in antlr3SetTokenAPI()
369 token->toString = toString; in antlr3SetTokenAPI()
374 static pANTLR3_STRING getText (pANTLR3_COMMON_TOKEN token) in getText() argument
376 switch (token->textState) in getText()
383 return token->tokText.text; in getText()
392 if (token->strFactory != NULL) in getText()
394 …token->tokText.text = token->strFactory->newStr8(token->strFactory, (pANTLR3_UINT8)token->tokText.… in getText()
395 token->textState = ANTLR3_TEXT_STRING; in getText()
396 return token->tokText.text; in getText()
410 if (token->type == ANTLR3_TOKEN_EOF) in getText()
412 token->tokText.text = token->strFactory->newStr8(token->strFactory, (pANTLR3_UINT8)"<EOF>"); in getText()
413 token->textState = ANTLR3_TEXT_STRING; in getText()
414 token->tokText.text->factory = token->strFactory; in getText()
415 return token->tokText.text; in getText()
423 if (token->input != NULL) in getText()
426 return token->input->substr( token->input, in getText()
427 token->getStartIndex(token), in getText()
428 token->getStopIndex(token) in getText()
438 static void setText8 (pANTLR3_COMMON_TOKEN token, pANTLR3_UINT8 text) in setText8() argument
444 switch (token->textState) in setText8()
452 token->textState = ANTLR3_TEXT_CHARP; in setText8()
453 token->tokText.chars = (pANTLR3_UCHAR)text; in setText8()
460 token->tokText.text->set8(token->tokText.text, (const char *)text); in setText8()
474 static void setText (pANTLR3_COMMON_TOKEN token, pANTLR3_STRING text) in setText() argument
479 token->textState = ANTLR3_TEXT_STRING; in setText()
480 token->tokText.text = text; in setText()
487 static ANTLR3_UINT32 getType (pANTLR3_COMMON_TOKEN token) in getType() argument
489 return token->type; in getType()
492 static void setType (pANTLR3_COMMON_TOKEN token, ANTLR3_UINT32 type) in setType() argument
494 token->type = type; in setType()
497 static ANTLR3_UINT32 getLine (pANTLR3_COMMON_TOKEN token) in getLine() argument
499 return token->line; in getLine()
502 static void setLine (pANTLR3_COMMON_TOKEN token, ANTLR3_UINT32 line) in setLine() argument
504 token->line = line; in setLine()
507 static ANTLR3_INT32 getCharPositionInLine (pANTLR3_COMMON_TOKEN token) in getCharPositionInLine() argument
509 return token->charPosition; in getCharPositionInLine()
512 static void setCharPositionInLine (pANTLR3_COMMON_TOKEN token, ANTLR3_INT32 pos) in setCharPositionInLine() argument
514 token->charPosition = pos; in setCharPositionInLine()
517 static ANTLR3_UINT32 getChannel (pANTLR3_COMMON_TOKEN token) in getChannel() argument
519 return token->channel; in getChannel()
522 static void setChannel (pANTLR3_COMMON_TOKEN token, ANTLR3_UINT32 channel) in setChannel() argument
524 token->channel = channel; in setChannel()
527 static ANTLR3_MARKER getTokenIndex (pANTLR3_COMMON_TOKEN token) in getTokenIndex() argument
529 return token->index; in getTokenIndex()
532 static void setTokenIndex (pANTLR3_COMMON_TOKEN token, ANTLR3_MARKER index) in setTokenIndex() argument
534 token->index = index; in setTokenIndex()
537 static ANTLR3_MARKER getStartIndex (pANTLR3_COMMON_TOKEN token) in getStartIndex() argument
539 return token->start == -1 ? (ANTLR3_MARKER)(token->input->data) : token->start; in getStartIndex()
542 static void setStartIndex (pANTLR3_COMMON_TOKEN token, ANTLR3_MARKER start) in setStartIndex() argument
544 token->start = start; in setStartIndex()
547 static ANTLR3_MARKER getStopIndex (pANTLR3_COMMON_TOKEN token) in getStopIndex() argument
549 return token->stop; in getStopIndex()
552 static void setStopIndex (pANTLR3_COMMON_TOKEN token, ANTLR3_MARKER stop) in setStopIndex() argument
554 token->stop = stop; in setStopIndex()
557 static pANTLR3_STRING toString (pANTLR3_COMMON_TOKEN token) in toString() argument
562 text = token->getText(token); in toString()
583 outtext->addi (outtext, (ANTLR3_INT32)token->getTokenIndex(token)); in toString()
585 outtext->addi (outtext, (ANTLR3_INT32)token->getStartIndex(token)); in toString()
587 outtext->addi (outtext, (ANTLR3_INT32)token->getStopIndex(token)); in toString()
591 outtext->addi (outtext, token->type); in toString()
594 if (token->getChannel(token) > ANTLR3_TOKEN_DEFAULT_CHANNEL) in toString()
597 outtext->addi (outtext, (ANTLR3_INT32)token->getChannel(token)); in toString()
602 outtext->addi (outtext, (ANTLR3_INT32)token->getLine(token)); in toString()
604 outtext->addi (outtext, token->getCharPositionInLine(token)); in toString()