2 Replies - 891 Views - Last Post: 01 August 2019 - 10:40 PM Rate Topic: -----

#1 azaeldevel   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 01-August 19

Flex fail on second program

Posted 01 August 2019 - 02:24 PM

Greetings to all and thanks advances for paying attention to my mail


I have a mistake just baffling

I run muy first program and next gets output correct

Number : 1
.
Number : 1
.
Number : 0
-
Stage : snapshot
Build : 20190729201751



So y run a second program but i get a incorrect result
Name :1

Should be Number : 1 like in first ran program


The program entry is the same, they differ in that one is the test
program (cunit) and the second is the productive program, in both cases
the complete scanner is called from a shared library generated in cmake
and the scanner is generated in C ++

the firts rule in flex file is

{DIGIT}{1,11} {
std::cout << "Number : " <<
yytext << std::endl;
yylval->build< int >(
atoi(yytext) );
return token::NUMBER;
}


whe run the second program no call this rule it call final rule

{NAME} {std::cout << "Name: " << yytext << std::endl; yylval-
>build< std::string >( yytext ); return token::NAME;}


my cuestion is why this differ is the same input, the same class scaner
only diferent program.

I attach my flex file, if you need the rest I put a link for both

firt program https://github.com/a...vel/toolkit.git commit
8b4845dda686321fbaf0d9e6a5abc04992dd6f24
second program https://github.com/a...devel/apidb.git commit
c887addfdc0a7fbad80df3571a8214c5e0bb8d34


I appreciate any comments

Is This A Good Question/Topic? 0
  • +

Replies To: Flex fail on second program

#2 jimblumberg   User is online

  • member icon

Reputation: 5745
  • View blog
  • Posts: 17,601
  • Joined: 25-December 09

Re: Flex fail on second program

Posted 01 August 2019 - 05:21 PM

Please post the code in question into a post (inside code tags please). Then ask specific questions based on the code posted.

:code:


Jim
Was This Post Helpful? 0
  • +
  • -

#3 Salem_c   User is offline

  • void main'ers are DOOMED
  • member icon

Reputation: 2369
  • View blog
  • Posts: 4,496
  • Joined: 30-May 10

Re: Flex fail on second program

Posted 01 August 2019 - 10:40 PM

It's all over the place -> http://www.cplusplus...general/258781/
Was This Post Helpful? 2
  • +
  • -

Page 1 of 1