flex-lexer

Getting CMake to find flex on Windows

北战南征 提交于 2021-02-20 10:44:58
问题 I am trying to use flex on a project and I am trying to use CMake to link flex with my project. I found a FindFLEX.cmake online which I am using for this. You can find it here. This was supposed to be in CMake by default, but I dont think it was. My directory structure is as follows root ---src ---CMakeLists.txt ---cmake ---Modules ---FindFLEX.cmake ---build ---external ---flex - Where flex is installed ---bin ---flex.exe ---lib ---libfl.a My src/CMakeLists.txt is as follows cmake_minimum

Getting CMake to find flex on Windows

混江龙づ霸主 提交于 2021-02-20 10:36:44
问题 I am trying to use flex on a project and I am trying to use CMake to link flex with my project. I found a FindFLEX.cmake online which I am using for this. You can find it here. This was supposed to be in CMake by default, but I dont think it was. My directory structure is as follows root ---src ---CMakeLists.txt ---cmake ---Modules ---FindFLEX.cmake ---build ---external ---flex - Where flex is installed ---bin ---flex.exe ---lib ---libfl.a My src/CMakeLists.txt is as follows cmake_minimum

Getting CMake to find flex on Windows

人盡茶涼 提交于 2021-02-20 10:36:11
问题 I am trying to use flex on a project and I am trying to use CMake to link flex with my project. I found a FindFLEX.cmake online which I am using for this. You can find it here. This was supposed to be in CMake by default, but I dont think it was. My directory structure is as follows root ---src ---CMakeLists.txt ---cmake ---Modules ---FindFLEX.cmake ---build ---external ---flex - Where flex is installed ---bin ---flex.exe ---lib ---libfl.a My src/CMakeLists.txt is as follows cmake_minimum

Pass STL containers from Flex to Bison

老子叫甜甜 提交于 2021-02-10 19:01:22
问题 I'm writing a scanner/parser combination using Flex and Bison, if possible I would like to avoid using C++ specific features of both programs but nevertheless I need to access a C++ library from the source file generated by Bison. At the moment I'm compiling the source file generated by Flex as a C program. One thing I thought I might be able to do is to declare STL type members inside Bison's %union statement, e.g.: %union { std::string str; }; I quickly realized that this cannot work

Pass STL containers from Flex to Bison

别等时光非礼了梦想. 提交于 2021-02-10 18:52:22
问题 I'm writing a scanner/parser combination using Flex and Bison, if possible I would like to avoid using C++ specific features of both programs but nevertheless I need to access a C++ library from the source file generated by Bison. At the moment I'm compiling the source file generated by Flex as a C program. One thing I thought I might be able to do is to declare STL type members inside Bison's %union statement, e.g.: %union { std::string str; }; I quickly realized that this cannot work

Flex RegEx not getting matched?

可紊 提交于 2021-02-08 08:21:02
问题 I've been working with Flex/Bison for about 6 hours now, and here is the first problem I don't seam to be able to solve: I have the following file... state state1: { 1-3: 255 4: 255 } ...which I pass to my flex/bison program using cat and |. The flex file contains this line: \bstate\b { return STATE; } and further down this one: .* { fprintf(stderr, "Lexer error on line %d: \"%s\"\n", linenum, yytext); exit(-1); } One should think that \bstate\b should get matched in the file, but it doesn't.

Flex RegEx not getting matched?

ぃ、小莉子 提交于 2021-02-08 08:19:15
问题 I've been working with Flex/Bison for about 6 hours now, and here is the first problem I don't seam to be able to solve: I have the following file... state state1: { 1-3: 255 4: 255 } ...which I pass to my flex/bison program using cat and |. The flex file contains this line: \bstate\b { return STATE; } and further down this one: .* { fprintf(stderr, "Lexer error on line %d: \"%s\"\n", linenum, yytext); exit(-1); } One should think that \bstate\b should get matched in the file, but it doesn't.

Need help identifying cause of “type clash on default action”

折月煮酒 提交于 2021-02-08 04:41:06
问题 I've been working a school assignment and am having difficulty figuring out which issue is causing the multiple warnings below "type clash on default action." Any help would be greatly appreciated. Warnings received: parser.y:62.9-23: warning: type clash on default action: <value> != <> parser.y:71.9-16: warning: type clash on default action: <value> != <> parser.y:82.5-23: warning: type clash on default action: <value> != <iden> parser.y:83.5-27: warning: type clash on default action: <value

How to parse new line in Scala grammar with flex/bison?

∥☆過路亽.° 提交于 2021-01-29 14:15:52
问题 I want to parse Scala grammar with flex and bison. But I don't know how to parse the newline token in Scala grammar. If I parse newline as a token T_NL , Here's the Toy.l for example: ... [a-zA-Z_][a-zA-Z0-9_]* { yylval->literal = strdup(yy_text); return T_ID; } \n { yylval->token = T_LN; return T_LN; } [ \t\v\f\r] { /* skip whitespaces */ } ... And here's the Toy.y for example: function_def: 'def' T_ID '(' argument_list ')' return_expression '=' expression T_NL ; argument_list: argument |

yyllocp->first_line returns uninitialized value in second iteration of a reEntrant Bison parser

痴心易碎 提交于 2021-01-29 14:02:23
问题 I have a reEntrant parser which takes input from a string and has a structure to maintain context. A function is called with different input strings to be parsed. Relevant code of that function is: void parseMyString(inputToBeParsed) { //LEXICAL COMPONENT - INITIATE LEX PROCESSING yyscan_t scanner; YY_BUFFER_STATE buffer; yylex_init_extra(&parseSupportStruct, &scanner ); //yylex_init(&scanner); buffer = yy_scan_buffer(inputToBeParsed, i+2, scanner); if (buffer == NULL) { strcpy(errorStrings,