LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-21-2003, 09:22 AM   #1
nachumk
LQ Newbie
 
Registered: Oct 2003
Distribution: Debian Unstable
Posts: 1

Rep: Reputation: 0
strange behavior in flex


I am using flex 2.5.31 on debian unstable.

I have written 2 simple files for lex and yacc, and the problem appears to be that when i parse the file (from a dos system), flex doesn't seem to see the newline. here are dumps of the 4 files i use. i just run build.
does flex support dos text files?

i am trying to create simple source code to compile in windows and parse my boot.ini.

thanx,
nachum

bas.1:
%{
#include "y.tab.h"
#include <stdlib.h>
void yyerror(char *);
%}

%%
^\[(boot[ ]loader)\]\n { printf("**>%s<**\n", yytext); }

%%

int yywrap(void){
return 1;
}

bas.y:
%{
#include <stdio.h>
int yylex(void);
void yyerror(char *);
%}

%token BOOT_LOADER

%%

program:
program BOOT_LOADER { printf("Found a boot loader\n"); }
| program 'a' { printf("received an a\n"); }
|
;

%%

void yyerror(char *s){
fprintf(stderr, "%s\n", s);
}

int main(void){
yyparse();
return 0;
}

boot.ini:
[boot loader]

a


build:
yacc -d bas.y
lex bas.1
cc -g lex.yy.c y.tab.c -otest
cat boot.ini | ./test
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
strange directory behavior exodist Linux - Software 1 11-20-2005 04:37 PM
Strange SAMBA behavior Daniboy Linux - Software 3 10-07-2005 09:19 AM
Very Strange Behavior raysr Mandriva 4 08-31-2004 02:06 PM
Strange Behavior andrewb758 Linux - Hardware 5 08-31-2003 02:42 PM
strange behavior abhijit Linux - General 3 07-09-2003 11:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration