Lines Matching refs:lexerState

364 struct LexerState *lexerState = NULL;  variable
387 lexerState->lineNo++; in nextLine()
388 lexerState->colNo = 1; in nextLine()
395 for (struct IfStack *stack = lexerState->ifStack; stack != NULL; stack = stack->next) in lexer_GetIFDepth()
410 new->next = lexerState->ifStack; in lexer_IncIFDepth()
412 lexerState->ifStack = new; in lexer_IncIFDepth()
417 if (!lexerState->ifStack) in lexer_DecIFDepth()
420 struct IfStack *top = lexerState->ifStack->next; in lexer_DecIFDepth()
422 free(lexerState->ifStack); in lexer_DecIFDepth()
424 lexerState->ifStack = top; in lexer_DecIFDepth()
429 return lexerState->ifStack->ranIfBlock; in lexer_RanIFBlock()
434 return lexerState->ifStack->reachedElseBlock; in lexer_ReachedELSEBlock()
439 lexerState->ifStack->ranIfBlock = true; in lexer_RunIFBlock()
444 lexerState->ifStack->reachedElseBlock = true; in lexer_ReachELSEBlock()
546 lexerState->offset = 0; in lexer_RestartRept()
547 initState(lexerState); in lexer_RestartRept()
548 lexerState->lineNo = lineNo; in lexer_RestartRept()
640 lexerState->mode = mode; in lexer_SetMode()
645 lexerState->expandStrings = enable; in lexer_ToggleStringExpansion()
652 if (lexerState->captureCapacity == SIZE_MAX) in reallocCaptureBuf()
654 else if (lexerState->captureCapacity > SIZE_MAX / 2) in reallocCaptureBuf()
655 lexerState->captureCapacity = SIZE_MAX; in reallocCaptureBuf()
657 lexerState->captureCapacity *= 2; in reallocCaptureBuf()
658 lexerState->captureBuf = realloc(lexerState->captureBuf, lexerState->captureCapacity); in reallocCaptureBuf()
659 if (!lexerState->captureBuf) in reallocCaptureBuf()
674 for (struct Expansion *exp = lexerState->expansions; exp; exp = exp->parent) { in beginExpansion()
685 new->parent = lexerState->expansions; in beginExpansion()
692 lexerState->expansions = new; in beginExpansion()
717 bool disableMacroArgs = lexerState->disableMacroArgs; in readBracketedMacroArgNum()
718 bool disableInterpolation = lexerState->disableInterpolation; in readBracketedMacroArgNum()
720 lexerState->disableMacroArgs = false; in readBracketedMacroArgNum()
721 lexerState->disableInterpolation = false; in readBracketedMacroArgNum()
776 lexerState->disableMacroArgs = disableMacroArgs; in readBracketedMacroArgNum()
777 lexerState->disableInterpolation = disableInterpolation; in readBracketedMacroArgNum()
814 for (struct Expansion *exp = lexerState->expansions; exp; exp = exp->parent) { in peekInternal()
829 if (lexerState->isMmapped) { in peekInternal()
830 if (lexerState->offset + distance >= lexerState->size) in peekInternal()
833 return (unsigned char)lexerState->ptr[lexerState->offset + distance]; in peekInternal()
836 if (lexerState->nbChars <= distance) { in peekInternal()
838 size_t target = LEXER_BUF_SIZE - lexerState->nbChars; /* Aim: making the buf full */ in peekInternal()
841 size_t writeIndex = (lexerState->index + lexerState->nbChars) % LEXER_BUF_SIZE; in peekInternal()
847 nbCharsRead = read(lexerState->fd, &lexerState->buf[writeIndex], (size)); \ in peekInternal()
849 fatalerror("Error while reading \"%s\": %s\n", lexerState->path, strerror(errno)); \ in peekInternal()
872 lexerState->nbChars += totalCharsRead; in peekInternal()
875 if (lexerState->nbChars <= distance) in peekInternal()
878 return (unsigned char)lexerState->buf[(lexerState->index + distance) % LEXER_BUF_SIZE]; in peekInternal()
889 if (lexerState->macroArgScanDistance > 0) in peek()
892 lexerState->macroArgScanDistance++; /* Do not consider again */ in peek()
894 if (c == '\\' && !lexerState->disableMacroArgs) { in peek()
896 lexerState->macroArgScanDistance++; in peek()
916 lexerState->macroArgScanDistance += strlen(str); in peek()
922 } else if (c == '{' && !lexerState->disableInterpolation) { in peek()
937 if (lexerState->capturing) { in shiftChar()
938 if (lexerState->captureBuf) { in shiftChar()
939 if (lexerState->captureSize + 1 >= lexerState->captureCapacity) in shiftChar()
942 lexerState->captureBuf[lexerState->captureSize] = peek(); in shiftChar()
944 lexerState->captureSize++; in shiftChar()
947 lexerState->macroArgScanDistance--; in shiftChar()
950 if (lexerState->expansions) { in shiftChar()
952 assert(lexerState->expansions->offset <= lexerState->expansions->size); in shiftChar()
953 lexerState->expansions->offset++; in shiftChar()
954 if (lexerState->expansions->offset > lexerState->expansions->size) { in shiftChar()
959 struct Expansion *exp = lexerState->expansions; in shiftChar()
961 lexerState->expansions = lexerState->expansions->parent; in shiftChar()
967 lexerState->colNo++; in shiftChar()
968 if (lexerState->isMmapped) { in shiftChar()
969 lexerState->offset++; in shiftChar()
971 assert(lexerState->index < LEXER_BUF_SIZE); in shiftChar()
972 lexerState->index++; in shiftChar()
973 if (lexerState->index == LEXER_BUF_SIZE) in shiftChar()
974 lexerState->index = 0; /* Wrap around if necessary */ in shiftChar()
975 assert(lexerState->nbChars > 0); in shiftChar()
976 lexerState->nbChars--; in shiftChar()
1001 return lexerState ? lexerState->path : NULL; in lexer_GetFileName()
1006 return lexerState->lineNo; in lexer_GetLineNo()
1011 return lexerState->colNo; in lexer_GetColNo()
1016 if (!lexerState) in lexer_DumpStringExpansions()
1019 for (struct Expansion *exp = lexerState->expansions; exp; exp = exp->parent) { in lexer_DumpStringExpansions()
1029 lexerState->disableMacroArgs = true; in discardBlockComment()
1030 lexerState->disableInterpolation = true; in discardBlockComment()
1043 if (!lexerState->expansions) in discardBlockComment()
1063 lexerState->disableMacroArgs = false; in discardBlockComment()
1064 lexerState->disableInterpolation = false; in discardBlockComment()
1071 lexerState->disableMacroArgs = true; in discardComment()
1072 lexerState->disableInterpolation = true; in discardComment()
1079 lexerState->disableMacroArgs = false; in discardComment()
1080 lexerState->disableInterpolation = false; in discardComment()
1096 if (!lexerState->expansions) in readLineContinuation()
1342 bool disableInterpolation = lexerState->disableInterpolation; in readInterpolation()
1349 lexerState->disableInterpolation = true; in readInterpolation()
1390 lexerState->disableInterpolation = disableInterpolation; in readInterpolation()
1459 lexerState->disableMacroArgs = true; in readString()
1460 lexerState->disableInterpolation = true; in readString()
1581 lexerState->disableMacroArgs = false; in readString()
1587 lexerState->disableMacroArgs = true; in readString()
1603 lexerState->disableMacroArgs = false; in readString()
1604 lexerState->disableInterpolation = false; in readString()
1609 lexerState->disableMacroArgs = true; in appendStringLiteral()
1610 lexerState->disableInterpolation = true; in appendStringLiteral()
1731 lexerState->disableMacroArgs = false; in appendStringLiteral()
1735 lexerState->disableMacroArgs = true; in appendStringLiteral()
1751 lexerState->disableMacroArgs = false; in appendStringLiteral()
1752 lexerState->disableInterpolation = false; in appendStringLiteral()
2001 if (tokenType == T_POP_ELIF && lexerState->lastToken == T_NEWLINE in yylex_NORMAL()
2011 if (tokenType == T_ID && lexerState->expandStrings) { in yylex_NORMAL()
2025 if (tokenType == T_ID && (lexerState->atLineStart || peek() == ':')) in yylex_NORMAL()
2032 if (!lexerState->capturing) { in yylex_NORMAL()
2037 lexerState->atLineStart = false; in yylex_NORMAL()
2201 bool atLineStart = lexerState->atLineStart; in skipIfBlock()
2204 lexerState->disableMacroArgs = true; in skipIfBlock()
2205 lexerState->disableInterpolation = true; in skipIfBlock()
2273 lexerState->disableMacroArgs = false; in skipIfBlock()
2274 lexerState->disableInterpolation = false; in skipIfBlock()
2275 lexerState->atLineStart = false; in skipIfBlock()
2294 bool atLineStart = lexerState->atLineStart; in yylex_SKIP_TO_ENDR()
2297 lexerState->disableMacroArgs = true; in yylex_SKIP_TO_ENDR()
2298 lexerState->disableInterpolation = true; in yylex_SKIP_TO_ENDR()
2359 lexerState->disableMacroArgs = false; in yylex_SKIP_TO_ENDR()
2360 lexerState->disableInterpolation = false; in yylex_SKIP_TO_ENDR()
2361 lexerState->atLineStart = false; in yylex_SKIP_TO_ENDR()
2369 if (lexerState->atLineStart && lexerStateEOL) { in yylex()
2374 if (lexerState->lastToken == T_EOB && yywrap()) in yylex()
2377 if (lexerState->atLineStart && !lexerState->expansions) in yylex()
2387 int token = lexerModeFuncs[lexerState->mode](); in yylex()
2390 if (token == T_EOF && !lexerState->capturing) in yylex()
2392 lexerState->lastToken = token; in yylex()
2393 lexerState->atLineStart = token == T_NEWLINE || token == T_EOB; in yylex()
2400 assert(!lexerState->capturing); in startCapture()
2401 lexerState->capturing = true; in startCapture()
2402 lexerState->captureSize = 0; in startCapture()
2403 lexerState->disableMacroArgs = true; in startCapture()
2404 lexerState->disableInterpolation = true; in startCapture()
2408 if (lexerState->isMmapped && !lexerState->expansions) { in startCapture()
2409 capture->body = &lexerState->ptr[lexerState->offset]; in startCapture()
2411 lexerState->captureCapacity = 128; /* The initial size will be twice that */ in startCapture()
2412 assert(lexerState->captureBuf == NULL); in startCapture()
2423 capture->body = lexerState->captureBuf; in endCapture()
2424 capture->size = lexerState->captureSize; in endCapture()
2426 lexerState->capturing = false; in endCapture()
2427 lexerState->captureBuf = NULL; in endCapture()
2428 lexerState->disableMacroArgs = false; in endCapture()
2429 lexerState->disableInterpolation = false; in endCapture()
2444 assert(lexerState->atLineStart); in lexer_CaptureRept()
2466 lexerState->captureSize -= strlen("ENDR"); in lexer_CaptureRept()
2488 lexerState->atLineStart = false; in lexer_CaptureRept()
2499 if (lexerState->isMmapped) in lexer_CaptureMacroBody()
2500 lexerState->isReferenced = true; in lexer_CaptureMacroBody()
2509 assert(lexerState->atLineStart); in lexer_CaptureMacroBody()
2524 lexerState->captureSize -= strlen("ENDM"); in lexer_CaptureMacroBody()
2544 lexerState->atLineStart = false; in lexer_CaptureMacroBody()