CMake Nightly Date Stamp
[kiteware-cmake.git] / Source / LexerParser / cmCTestResourceGroupsLexer.in.l
blobac9cbafe4b790a124462f83b485c21ca5cac1d31
1 %{
2 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
3    file Copyright.txt or https://cmake.org/licensing for details.  */
4 /*
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"
25 #include <string>
27 #include <cstddef>
29 #ifndef _WIN32
30 #  include <termios.h>
31 #endif
33 /*--------------------------------------------------------------------------*/
36 %option prefix="cmCTestResourceGroups_yy"
38 %option reentrant
39 %option noyywrap
40 %option nodefault
41 %pointer
43 %s RESOURCE_GROUPS_START
44 %s RESOURCE_GROUPS_END
45 %s RESOURCE_START
46 %s RESOURCE_COUNT
47 %s RESOURCE_END
49 NUMBER [0-9]+
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} {
66   BEGIN(RESOURCE_END);
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();
87   return 0;
90 <INITIAL,RESOURCE_GROUPS_START><<EOF>> {
91   return 0;
94 <<EOF>> {
95   return 1;
98 .|\n {
99   return 1;
104 /*--------------------------------------------------------------------------*/
106 #endif /* __clang_analyzer__ */