2 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
3 file Copyright.txt or https://cmake.org/licensing for details. */
6 This file must be translated to C++ and modified to build everywhere.
8 Run flex >= 2.6 like this:
10 flex --nounistd -DFLEXINT_H --noline --header-file=cmCTestResourceGroupsLexer.h -ocmCTestResourceGroupsLexer.cxx cmCTestResourceGroupsLexer.in.l
12 Modify cmCTestResourceGroupsLexer.cxx:
13 - remove trailing whitespace: sed -i 's/\s*$//' cmCTestResourceGroupsLexer.h cmCTestResourceGroupsLexer.cxx
14 - remove blank lines at end of file: sed -i '${/^$/d;}' cmCTestResourceGroupsLexer.h cmCTestResourceGroupsLexer.cxx
15 - #include "cmStandardLexer.h" at the top: sed -i '1i#include "cmStandardLexer.h"' cmCTestResourceGroupsLexer.cxx
19 /* IWYU pragma: no_forward_declare yyguts_t */
21 #ifndef __clang_analyzer__ /* Suppress clang-analyzer warnings */
23 #include "cmCTestResourceGroupsLexerHelper.h"
33 /*--------------------------------------------------------------------------*/
36 %option prefix="cmCTestResourceGroups_yy"
43 %s RESOURCE_GROUPS_START
44 %s RESOURCE_GROUPS_END
50 IDENTIFIER [a-z_][a-z0-9_]*
54 <INITIAL,RESOURCE_GROUPS_START,RESOURCE_START>{IDENTIFIER}: {
55 BEGIN(RESOURCE_COUNT);
56 yyextra->SetResourceType(std::string(yytext, yyleng - 1));
59 <INITIAL,RESOURCE_GROUPS_START>{NUMBER} {
60 BEGIN(RESOURCE_GROUPS_END);
61 std::size_t len = yyleng;
62 yyextra->SetProcessCount(std::stoll(yytext, &len, 10));
65 <RESOURCE_COUNT>{NUMBER} {
67 std::size_t len = yyleng;
68 yyextra->SetNeededSlots(std::stoll(yytext, &len, 10));
69 yyextra->WriteRequirement();
72 <RESOURCE_GROUPS_END,RESOURCE_END>,+ {
73 BEGIN(RESOURCE_START);
76 <INITIAL,RESOURCE_GROUPS_START,RESOURCE_START>;+ {
77 BEGIN(RESOURCE_GROUPS_START);
80 <RESOURCE_GROUPS_END,RESOURCE_END>;+ {
81 BEGIN(RESOURCE_GROUPS_START);
82 yyextra->WriteProcess();
85 <RESOURCE_START,RESOURCE_GROUPS_END,RESOURCE_END><<EOF>> {
86 yyextra->WriteProcess();
90 <INITIAL,RESOURCE_GROUPS_START><<EOF>> {
104 /*--------------------------------------------------------------------------*/
106 #endif /* __clang_analyzer__ */