Changeset 108280 in vbox
- Timestamp:
- Feb 19, 2025 9:28:41 AM (3 weeks ago)
- svn:sync-xref-src-repo-rev:
- 167622
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/script.h
r108049 r108280 98 98 /** Some punctuator. */ 99 99 RTSCRIPTLEXTOKTYPE_PUNCTUATOR, 100 /** A single line comment. */ 101 RTSCRIPTLEXTOKTYPE_COMMENT_SINGLE_LINE, 102 /** A multi line comment. */ 103 RTSCRIPTLEXTOKTYPE_COMMENT_MULTI_LINE, 100 104 /** Special error token, conveying an error message from the lexer. */ 101 105 RTSCRIPTLEXTOKTYPE_ERROR, … … 212 216 PCRTSCRIPTLEXTOKMATCH pPunctuator; 213 217 } Punctuator; 218 /** Comment */ 219 struct 220 { 221 /** Pointer to the start of the comment (including the symbols starting the comment). */ 222 const char *pszComment; 223 /** Number of characters of the comment, including the null terminator. */ 224 size_t cchComment; 225 } Comment; 214 226 /** Error. */ 215 227 struct … … 316 328 * as the lexer will convert everything to uppercase internally. */ 317 329 #define RTSCRIPT_LEX_CFG_F_CASE_INSENSITIVE_UPPER RT_BIT(1) 330 /** Comments are not skipped but passed back as tokens. */ 331 #define RTSCRIPT_LEX_CFG_F_COMMENTS_AS_TOKENS RT_BIT(2) 318 332 319 333 … … 369 383 * If not NULL the string cache must be freed by the caller when not used 370 384 * anymore. 385 * @param phStrCacheComments Where to store the pointer to the string cache containing all 386 * comments on success when RTSCRIPT_LEX_CFG_F_COMMENTS_AS_TOKENS 387 * is given, optional. 388 * If not NULL the string cache must be freed by the caller when not used 389 * anymore. 371 390 * @param pCfg The lexer config to use for identifying the different tokens. 372 391 */ … … 374 393 PFNRTSCRIPTLEXDTOR pfnDtor, void *pvUser, 375 394 size_t cchBuf, PRTSTRCACHE phStrCacheId, PRTSTRCACHE phStrCacheStringLit, 376 P CRTSCRIPTLEXCFG pCfg);395 PRTSTRCACHE phStrCacheComments, PCRTSCRIPTLEXCFG pCfg); 377 396 378 397 … … 391 410 * If not NULL the string cache must be freed by the caller when not used 392 411 * anymore. 412 * @param phStrCacheComments Where to store the pointer to the string cache containing all 413 * comments on success when RTSCRIPT_LEX_CFG_F_COMMENTS_AS_TOKENS 414 * is given, optional. 415 * If not NULL the string cache must be freed by the caller when not used 416 * anymore. 393 417 * @param pCfg The lexer config to use for identifying the different tokens. 394 418 */ 395 419 RTDECL(int) RTScriptLexCreateFromString(PRTSCRIPTLEX phScriptLex, const char *pszSrc, PRTSTRCACHE phStrCacheId, 396 PRTSTRCACHE phStrCacheStringLit, PCRTSCRIPTLEXCFG pCfg); 420 PRTSTRCACHE phStrCacheStringLit, PRTSTRCACHE phStrCacheComments, 421 PCRTSCRIPTLEXCFG pCfg); 397 422 398 423 … … 411 436 * If not NULL the string cache must be freed by the caller when not used 412 437 * anymore. 438 * @param phStrCacheComments Where to store the pointer to the string cache containing all 439 * comments on success when RTSCRIPT_LEX_CFG_F_COMMENTS_AS_TOKENS 440 * is given, optional. 441 * If not NULL the string cache must be freed by the caller when not used 442 * anymore. 413 443 * @param pCfg The lexer config to use for identifying the different tokens. 414 444 */ 415 445 RTDECL(int) RTScriptLexCreateFromFile(PRTSCRIPTLEX phScriptLex, const char *pszFilename, PRTSTRCACHE phStrCacheId, 416 PRTSTRCACHE phStrCacheStringLit, PCRTSCRIPTLEXCFG pCfg); 446 PRTSTRCACHE phStrCacheStringLit, PRTSTRCACHE phStrCacheComments, 447 PCRTSCRIPTLEXCFG pCfg); 417 448 418 449 -
trunk/src/VBox/Disassembler/testcase/tstDisasmArmv8-1.cpp
r108049 r108280 179 179 NULL /*pfnDtor*/, &Rdr /*pvUser*/, cbSrc, 180 180 NULL /*phStrCacheId*/, NULL /*phStrCacheStringLit*/, 181 &s_LexCfg);181 NULL /*phStrCacheComments*/, &s_LexCfg); 182 182 RTTESTI_CHECK_RC(rc, VINF_SUCCESS); 183 183 if (RT_FAILURE(rc)) … … 233 233 RTSCRIPTLEX hLexDis = NULL; 234 234 rc = RTScriptLexCreateFromString(&hLexDis, szOutput, NULL /*phStrCacheId*/, 235 NULL /*phStrCacheStringLit*/, &s_LexCfg); 235 NULL /*phStrCacheStringLit*/, NULL /*phStrCacheComments*/, 236 &s_LexCfg); 236 237 RTTESTI_CHECK_RC(rc, VINF_SUCCESS); 237 238 if (RT_SUCCESS(rc)) … … 490 491 NULL /*pfnDtor*/, &Rdr /*pvUser*/, 0 /*cchBuf*/, 491 492 NULL /*phStrCacheId*/, NULL /*phStrCacheStringLit*/, 492 &s_LexCfg);493 NULL /*phStrCacheComments*/, &s_LexCfg); 493 494 RTTESTI_CHECK_RC(rc, VINF_SUCCESS); 494 495 … … 496 497 RTSCRIPTLEX hLexDis = NULL; 497 498 rc = RTScriptLexCreateFromString(&hLexDis, szOutput, NULL /*phStrCacheId*/, 498 NULL /*phStrCacheStringLit*/, &s_LexCfg); 499 NULL /*phStrCacheStringLit*/, NULL /*phStrCacheComments*/, 500 &s_LexCfg); 499 501 RTTESTI_CHECK_RC(rc, VINF_SUCCESS); 500 502 if (RT_SUCCESS(rc)) -
trunk/src/VBox/Runtime/common/acpi/acpi-compiler.cpp
r108235 r108280 2982 2982 NULL /*pfnDtor*/, pThis /*pvUser*/, 0 /*cchBuf*/, 2983 2983 NULL /*phStrCacheId*/, NULL /*phStrCacheStringLit*/, 2984 &s_AslLexCfg);2984 NULL /*phStrCacheComments*/, &s_AslLexCfg); 2985 2985 if (RT_SUCCESS(rc)) 2986 2986 { -
trunk/src/VBox/Runtime/common/script/scriptlex.cpp
r108251 r108280 82 82 /** String literal string cache. */ 83 83 RTSTRCACHE hStrCacheStringLit; 84 /** Comment string cache. */ 85 RTSTRCACHE hStrCacheComments; 84 86 /** Status code from the reader. */ 85 87 int rcRdr; … … 106 108 107 109 /** Free the identifier string cache literal on destruction. */ 108 #define RTSCRIPT_LEX_INT_F_STR_CACHE_ID_FREE RT_BIT_32(0)110 #define RTSCRIPT_LEX_INT_F_STR_CACHE_ID_FREE RT_BIT_32(0) 109 111 /** Free the string literal string cache literal on destruction. */ 110 #define RTSCRIPT_LEX_INT_F_STR_CACHE_STR_LIT_FREE RT_BIT_32(1) 112 #define RTSCRIPT_LEX_INT_F_STR_CACHE_STR_LIT_FREE RT_BIT_32(1) 113 /** Free the comments string cache literal on destruction. */ 114 #define RTSCRIPT_LEX_INT_F_STR_CACHE_COMMENTS_FREE RT_BIT_32(2) 111 115 /** End of stream reached. */ 112 #define RTSCRIPT_LEX_INT_F_EOS RT_BIT_32(2)116 #define RTSCRIPT_LEX_INT_F_EOS RT_BIT_32(3) 113 117 114 118 … … 267 271 268 272 269 DECLINLINE(bool) rtScriptLexIsNewlineConsume (PRTSCRIPTLEXINT pThis, char ch)270 { 271 const char **papszNl = pThis->pCfg->p szWhitespace ? pThis->pCfg->papszNewline : g_aszNlDef;272 273 bool fMatched = rtScriptLexLocateSubStrInStrArrayMatchConsume(pThis, ch, papszNl, NULL);273 DECLINLINE(bool) rtScriptLexIsNewlineConsumeEx(PRTSCRIPTLEXINT pThis, char ch, unsigned *pidx) 274 { 275 const char **papszNl = pThis->pCfg->papszNewline ? pThis->pCfg->papszNewline : g_aszNlDef; 276 277 bool fMatched = rtScriptLexLocateSubStrInStrArrayMatchConsume(pThis, ch, papszNl, pidx); 274 278 if (fMatched) 275 279 { … … 279 283 280 284 return fMatched; 285 } 286 287 288 DECLINLINE(bool) rtScriptLexIsNewlineConsume(PRTSCRIPTLEXINT pThis, char ch) 289 { 290 return rtScriptLexIsNewlineConsumeEx(pThis, ch, NULL); 291 } 292 293 294 /** 295 * Checks whether the character is the beginning of a multi line comment. 296 * 297 * @returns Flag whether a comment was detected. 298 * @param hScriptLex The lexer state. 299 * @param ch The character to check for. 300 * @param pidxMatch Where to store the index of the matching substring if found, 301 * optional. 302 * @note This consumes the start of the single line comment. 303 */ 304 DECLINLINE(bool) rtScriptLexIsMultiLineComment(PRTSCRIPTLEXINT pThis, char ch, unsigned *pidxMatch) 305 { 306 const char **papszCommentMultiStart = pThis->pCfg->papszCommentMultiStart; 307 if ( papszCommentMultiStart 308 && rtScriptLexLocateSubStrInStrArrayMatchConsume(pThis, ch, papszCommentMultiStart, pidxMatch)) 309 return true; 310 311 return false; 281 312 } 282 313 … … 292 323 DECLINLINE(bool) rtScriptLexIsMultiLineCommentConsume(PRTSCRIPTLEXINT pThis, char ch) 293 324 { 294 const char **papszCommentMultiStart = pThis->pCfg->papszCommentMultiStart;295 325 unsigned idxComment = 0; 296 297 if ( papszCommentMultiStart 298 && rtScriptLexLocateSubStrInStrArrayMatchConsume(pThis, ch, papszCommentMultiStart, 299 &idxComment)) 326 if (rtScriptLexIsMultiLineComment(pThis, ch, &idxComment)) 300 327 { 301 328 /* Look for the matching closing lexeme in the input consuming everything along the way. */ … … 327 354 328 355 /** 356 * Checks whether the character is the beginning of a single line comment. 357 * 358 * @returns Flag whether a comment was detected. 359 * @param hScriptLex The lexer state. 360 * @param ch The character to check for. 361 * @param pidxMatch Where to store the index of the matching substring if found, 362 * optional. 363 * @note This consumes the start of the single line comment. 364 */ 365 DECLINLINE(bool) rtScriptLexIsSingleLineComment(PRTSCRIPTLEXINT pThis, char ch, unsigned *pidxMatch) 366 { 367 const char **papszCommentSingleStart = pThis->pCfg->papszCommentSingleStart; 368 if ( papszCommentSingleStart 369 && rtScriptLexLocateSubStrInStrArrayMatchConsume(pThis, ch, papszCommentSingleStart, pidxMatch)) 370 return true; 371 372 return false; 373 } 374 375 376 /** 329 377 * Checks whether the character is the beginning of a single line comment, skipping the whole 330 378 * comment if necessary. … … 336 384 DECLINLINE(bool) rtScriptLexIsSingleLineCommentConsume(PRTSCRIPTLEXINT pThis, char ch) 337 385 { 338 const char **papszCommentSingleStart = pThis->pCfg->papszCommentSingleStart; 339 340 if ( papszCommentSingleStart 341 && rtScriptLexLocateSubStrInStrArrayMatchConsume(pThis, ch, papszCommentSingleStart, 342 NULL)) 386 if (rtScriptLexIsSingleLineComment(pThis, ch, NULL)) 343 387 { 344 388 for (;;) … … 457 501 pTok->PosEnd = pThis->Pos; 458 502 return VINF_SUCCESS; 503 } 504 505 506 /** 507 * Creates a single line comment token. 508 * 509 * @returns Flag whether a matching rule was found. 510 * @param pThis The lexer state. 511 * @param idxComment The index into the single line comment token start array. 512 * @param pTok The token to fill. 513 */ 514 static void rtScriptLexProduceTokFromSingleLineComment(PRTSCRIPTLEXINT pThis, unsigned idxComment, PRTSCRIPTLEXTOKEN pTok) 515 { 516 const char *pszCommentSingleStart = pThis->pCfg->papszCommentSingleStart[idxComment]; 517 AssertPtr(pszCommentSingleStart); 518 519 pTok->PosStart = pThis->Pos; 520 521 /** @todo Optimize */ 522 size_t cchTmp = 512; 523 char *pszTmp = (char *)RTMemAlloc(cchTmp); 524 if (pszTmp) 525 { 526 size_t cchComment = 0; 527 while (*pszCommentSingleStart != '\0') 528 pszTmp[cchComment++] = *pszCommentSingleStart++; 529 530 for (;;) 531 { 532 char chTmp = RTScriptLexGetCh(pThis); 533 534 if ( chTmp == '\0' 535 || rtScriptLexIsNewlineConsume(pThis, chTmp)) 536 { 537 pszTmp[cchComment++] = '\0'; 538 break; 539 } 540 541 if (cchComment == cchTmp - 1) 542 { 543 char *pszNew = (char *)RTMemRealloc(pszTmp, cchTmp + 512); 544 if (!pszNew) 545 { 546 RTMemFree(pszTmp); 547 pszTmp = NULL; 548 RTScriptLexProduceTokError(pThis, pTok, VERR_NO_STR_MEMORY, "Lexer: Out of memory allocating temporary memory for a single line comment"); 549 break; 550 } 551 552 cchTmp += 512; 553 pszTmp = pszNew; 554 } 555 556 pszTmp[cchComment++] = chTmp; 557 RTScriptLexConsumeCh(pThis); 558 } 559 560 if (pszTmp) 561 { 562 pTok->enmType = RTSCRIPTLEXTOKTYPE_COMMENT_SINGLE_LINE; 563 pTok->PosEnd = pThis->Pos; 564 pTok->Type.Comment.pszComment = RTStrCacheEnterN(pThis->hStrCacheId, pszTmp, cchComment); 565 pTok->Type.Comment.cchComment = cchComment; 566 if (RT_UNLIKELY(!pTok->Type.Comment.pszComment)) 567 RTScriptLexProduceTokError(pThis, pTok, VERR_NO_STR_MEMORY, "Lexer: Out of memory inserting comment into comment cache"); 568 569 RTMemFree(pszTmp); 570 } 571 } 572 else 573 RTScriptLexProduceTokError(pThis, pTok, VERR_NO_MEMORY, "Lexer: Out of memory allocating temporary memory for a single line comment"); 574 } 575 576 577 /** 578 * Ensures there is enough space in the given buffer for the given amount of bytes, 579 * extending the buffer or creating an error token if this fails. 580 * 581 * @returns Flag whether there is enough space in the buffer. 582 * @param pThis The lexer state. 583 * @param ppchTmp Pointer to the pointer for the character buffer being checked. 584 * On successful return this might contain a different pointer if 585 * re-allocation was required. 586 * @param pcchTmp On input the size of the buffer in characters, on return the new 587 * size of the buffer if re-allocation was required. 588 * @param cchCur How much of the current buffer is used. 589 * @param cchAdd How many additional characters are required. 590 * @param pTok The token to fill in if re-allocating the buffer failed. 591 */ 592 DECLINLINE(bool) rtScriptLexEnsureTmpBufSpace(PRTSCRIPTLEXINT pThis, char **ppchTmp, size_t *pcchTmp, 593 size_t cchCur, size_t cchAdd, PRTSCRIPTLEXTOKEN pTok) 594 { 595 if (RT_LIKELY(cchCur + cchAdd + 1 <= *pcchTmp)) /* Always keep room for the zero terminator. */ 596 return true; 597 598 size_t cchNew = *pcchTmp + _1K; 599 char *pchNew = (char *)RTMemRealloc(*ppchTmp, cchNew); 600 if (!pchNew) 601 { 602 RTMemFree(*ppchTmp); 603 *ppchTmp = NULL; 604 RTScriptLexProduceTokError(pThis, pTok, VERR_NO_STR_MEMORY, "Lexer: Out of memory allocating temporary memory for a multi line comment"); 605 return false; 606 } 607 608 *ppchTmp = pchNew; 609 *pcchTmp = cchNew; 610 return true; 611 } 612 613 614 /** 615 * Creates a multi line comment token. 616 * 617 * @returns Flag whether a matching rule was found. 618 * @param pThis The lexer state. 619 * @param idxComment The index into the single line comment token start array. 620 * @param pTok The token to fill. 621 */ 622 static void rtScriptLexProduceTokFromMultiLineComment(PRTSCRIPTLEXINT pThis, unsigned idxComment, PRTSCRIPTLEXTOKEN pTok) 623 { 624 const char *pszCommentMultiStart = pThis->pCfg->papszCommentMultiStart[idxComment]; 625 AssertPtr(pszCommentMultiStart); 626 627 pTok->PosStart = pThis->Pos; 628 629 /** @todo Optimize */ 630 size_t cchTmp = _1K; 631 char *pszTmp = (char *)RTMemAlloc(cchTmp); 632 if (pszTmp) 633 { 634 /* Look for the matching closing lexeme in the input consuming everything along the way. */ 635 const char *pszClosing = pThis->pCfg->papszCommentMultiEnd[idxComment]; 636 637 size_t cchComment = 0; 638 while (*pszCommentMultiStart != '\0') 639 pszTmp[cchComment++] = *pszCommentMultiStart++; 640 641 for (;;) 642 { 643 char chTmp = RTScriptLexGetCh(pThis); 644 645 /* Check for new lines explicetly to advance the position information and copy it over. */ 646 unsigned idxNewLine = 0; 647 if (rtScriptLexIsNewlineConsumeEx(pThis, chTmp, &idxNewLine)) 648 { 649 const char *pszNl = pThis->pCfg->papszNewline 650 ? pThis->pCfg->papszNewline[idxNewLine] 651 : g_aszNlDef[idxNewLine]; 652 if (!rtScriptLexEnsureTmpBufSpace(pThis, &pszTmp, &cchTmp, cchComment, 653 strlen(pszNl), pTok)) 654 break; 655 656 while (*pszNl != '\0') 657 pszTmp[cchComment++] = *pszNl++; 658 continue; 659 } 660 661 /* Check for the closing lexeme. */ 662 if (rtScriptLexMatchStrConsume(pThis, chTmp, pszClosing, NULL)) 663 { 664 /* Copy over the closing comment lexeme. */ 665 if (rtScriptLexEnsureTmpBufSpace(pThis, &pszTmp, &cchTmp, cchComment, 666 strlen(pszClosing), pTok)) 667 { 668 while (*pszClosing != '\0') 669 pszTmp[cchComment++] = *pszClosing++; 670 pszTmp[cchComment++] = '\0'; 671 } 672 break; 673 } 674 675 if (chTmp == '\0') 676 break; /* End of stream before closing lexeme. */ 677 678 if (!rtScriptLexEnsureTmpBufSpace(pThis, &pszTmp, &cchTmp, cchComment, 679 strlen(pszClosing), pTok)) 680 break; 681 682 pszTmp[cchComment++] = chTmp; 683 RTScriptLexConsumeCh(pThis); 684 } 685 686 if (pszTmp) 687 { 688 pTok->enmType = RTSCRIPTLEXTOKTYPE_COMMENT_MULTI_LINE; 689 pTok->PosEnd = pThis->Pos; 690 pTok->Type.Comment.pszComment = RTStrCacheEnterN(pThis->hStrCacheId, pszTmp, cchComment); 691 pTok->Type.Comment.cchComment = cchComment; 692 if (RT_UNLIKELY(!pTok->Type.Comment.pszComment)) 693 RTScriptLexProduceTokError(pThis, pTok, VERR_NO_STR_MEMORY, "Lexer: Out of memory inserting comment into comment cache"); 694 695 RTMemFree(pszTmp); 696 } 697 } 698 else 699 RTScriptLexProduceTokError(pThis, pTok, VERR_NO_MEMORY, "Lexer: Out of memory allocating temporary memory for a multi line comment"); 459 700 } 460 701 … … 542 783 char ch = RTScriptLexGetCh(pThis); 543 784 PCRTSCRIPTLEXTOKMATCH pMatch = NULL; 785 unsigned idxComment = 0; 544 786 if (ch == '\0') 545 787 rtScriptLexProduceTokEos(pThis, pTok); 788 else if ( (pThis->pCfg->fFlags & RTSCRIPT_LEX_CFG_F_COMMENTS_AS_TOKENS) 789 && rtScriptLexIsSingleLineComment(pThis, ch, &idxComment)) 790 rtScriptLexProduceTokFromSingleLineComment(pThis, idxComment, pTok); 791 else if ( (pThis->pCfg->fFlags & RTSCRIPT_LEX_CFG_F_COMMENTS_AS_TOKENS) 792 && rtScriptLexIsMultiLineComment(pThis, ch, &idxComment)) 793 rtScriptLexProduceTokFromMultiLineComment(pThis, idxComment, pTok); 546 794 else if (rtScriptLexLocateExactMatchConsume(pThis, ch, &pMatch)) 547 795 rtScriptLexProduceTokFromExactMatch(pThis, pTok, pMatch); … … 584 832 PFNRTSCRIPTLEXDTOR pfnDtor, void *pvUser, 585 833 size_t cchBuf, PRTSTRCACHE phStrCacheId, PRTSTRCACHE phStrCacheStringLit, 586 P CRTSCRIPTLEXCFG pCfg)834 PRTSTRCACHE phStrCacheComments, PCRTSCRIPTLEXCFG pCfg) 587 835 { 588 836 AssertPtrReturn(phScriptLex, VERR_INVALID_POINTER); … … 617 865 pThis->hStrCacheId = NULL; 618 866 pThis->hStrCacheStringLit = NULL; 867 pThis->hStrCacheComments = NULL; 868 869 if (pCfg->fFlags & RTSCRIPT_LEX_CFG_F_COMMENTS_AS_TOKENS) 870 rc = RTStrCacheCreate(&pThis->hStrCacheComments, "LEX-Comments"); 619 871 620 872 rc = RTStrCacheCreate(&pThis->hStrCacheId, "LEX-Ide"); … … 639 891 pThis->fFlags |= RTSCRIPT_LEX_INT_F_STR_CACHE_STR_LIT_FREE; 640 892 893 if (pCfg->fFlags & RTSCRIPT_LEX_CFG_F_COMMENTS_AS_TOKENS) 894 { 895 if (phStrCacheComments) 896 *phStrCacheComments = pThis->hStrCacheComments; 897 else 898 pThis->fFlags |= RTSCRIPT_LEX_INT_F_STR_CACHE_COMMENTS_FREE; 899 } 900 641 901 return VINF_SUCCESS; 642 902 } … … 648 908 } 649 909 910 if (pThis->hStrCacheComments) 911 RTStrCacheDestroy(pThis->hStrCacheComments); 650 912 RTMemFree(pThis); 651 913 } … … 682 944 683 945 RTDECL(int) RTScriptLexCreateFromString(PRTSCRIPTLEX phScriptLex, const char *pszSrc, PRTSTRCACHE phStrCacheId, 684 PRTSTRCACHE phStrCacheStringLit, P CRTSCRIPTLEXCFG pCfg)946 PRTSTRCACHE phStrCacheStringLit, PRTSTRCACHE phStrCacheComments, PCRTSCRIPTLEXCFG pCfg) 685 947 { 686 948 return RTScriptLexCreateFromReader(phScriptLex, rtScriptLexReaderStr, NULL, (void *)pszSrc, 0, 687 phStrCacheId, phStrCacheStringLit, p Cfg);949 phStrCacheId, phStrCacheStringLit, phStrCacheComments, pCfg); 688 950 } 689 951 … … 715 977 716 978 RTDECL(int) RTScriptLexCreateFromFile(PRTSCRIPTLEX phScriptLex, const char *pszFilename, PRTSTRCACHE phStrCacheId, 717 PRTSTRCACHE phStrCacheStringLit, P CRTSCRIPTLEXCFG pCfg)979 PRTSTRCACHE phStrCacheStringLit, PRTSTRCACHE phStrCacheComments, PCRTSCRIPTLEXCFG pCfg) 718 980 { 719 981 RTFILE hFile; … … 722 984 { 723 985 rc = RTScriptLexCreateFromReader(phScriptLex, rtScriptLexReaderFile, rtScriptLexDtorFile, (void *)hFile, 0, 724 phStrCacheId, phStrCacheStringLit, p Cfg);986 phStrCacheId, phStrCacheStringLit, phStrCacheComments, pCfg); 725 987 if (RT_FAILURE(rc)) 726 988 RTFileClose(hFile); … … 743 1005 if (pThis->fFlags & RTSCRIPT_LEX_INT_F_STR_CACHE_STR_LIT_FREE) 744 1006 RTStrCacheDestroy(pThis->hStrCacheStringLit); 1007 if (pThis->fFlags & RTSCRIPT_LEX_INT_F_STR_CACHE_COMMENTS_FREE) 1008 RTStrCacheDestroy(pThis->hStrCacheComments); 745 1009 746 1010 if (pThis->pszStrLit) … … 902 1166 903 1167 if ( rtScriptLexLocateChInStrConsume(pThis, ch, pszWs) 904 || rtScriptLexIsNewlineConsume(pThis, ch) 905 || rtScriptLexIsMultiLineCommentConsume(pThis, ch) 906 || rtScriptLexIsSingleLineCommentConsume(pThis, ch)) 1168 || rtScriptLexIsNewlineConsume(pThis, ch)) 1169 continue; 1170 1171 if ( !(pThis->pCfg->fFlags & RTSCRIPT_LEX_CFG_F_COMMENTS_AS_TOKENS) 1172 && ( rtScriptLexIsMultiLineCommentConsume(pThis, ch) 1173 || rtScriptLexIsSingleLineCommentConsume(pThis, ch))) 907 1174 continue; 908 1175 -
trunk/src/VBox/Runtime/testcase/tstRTAcpi.cpp
r108115 r108280 164 164 NULL /*pfnDtor*/, hVfsFileAslSrc /*pvUser*/, 0 /*cchBuf*/, 165 165 NULL /*phStrCacheId*/, NULL /*phStrCacheStringLit*/, 166 &s_AslLexCfg);166 NULL /*phStrCacheComments*/, &s_AslLexCfg); 167 167 RTTESTI_CHECK_RC(rc, VINF_SUCCESS); 168 168 if (RT_FAILURE(rc)) … … 173 173 NULL /*pfnDtor*/, hVfsFileAslOut /*pvUser*/, 0 /*cchBuf*/, 174 174 NULL /*phStrCacheId*/, NULL /*phStrCacheStringLit*/, 175 &s_AslLexCfg);175 NULL /*phStrCacheComments*/, &s_AslLexCfg); 176 176 RTTESTI_CHECK_RC(rc, VINF_SUCCESS); 177 177 if (RT_FAILURE(rc))
Note:
See TracChangeset
for help on using the changeset viewer.