LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-16-2009, 05:40 AM   #1
eljuventino
LQ Newbie
 
Registered: May 2009
Posts: 26
Blog Entries: 1

Rep: Reputation: 15
lex : unrecognised rule


hi everyone!!thanks for all the help that u gave!!
I'm porting a project from aix to linux RHEL5 system and i'm compiling all the code!!!
i'm doing well but now i'm stuck with those problems related to lex:
and i'm having this:

/usr/bin/lex -t ms_rmb_parser.l > __parser__l.c
"ms_rmb_parser.l", line 76: unrecognized rule
"ms_rmb_parser.l", line 82: unrecognized rule
"ms_rmb_parser.l", line 83: unrecognized rule
"ms_rmb_parser.l", line 97: unrecognized rule
"ms_rmb_parser.l", line 104: unrecognized rule
"ms_rmb_parser.l", line 105: unrecognized rule
"ms_rmb_parser.l", line 106: unrecognized rule
"ms_rmb_parser.l", line 110: unknown error processing section 1
"ms_rmb_parser.l", line 188: fatal parse error
make: *** [__parser__l.c] Erreur 1[/QUOTE]

i don't know what this mean because i'm a beginner in this!!
and that my .l file
Code:
/*******************************************************************************
* Project:  ePOST/Open 2                                                       *
*                                                                              *
* File Name:  ms_rmb_parser.l                                                  *
*                                                                              *
* Subsystem:  Mail Server                                                      *
* Module: Receive Mailbags (RMB)                                               *
*                                                                              *
* Description:	This module contains the LEX specification for EPL file.       *
*								It used for parsing EPL Letters files from VM Mailbag				   *
*                                                                              *
* Author: Paola Vinassa                                                        *
*                                                                              *
* Created:                                                                     *
********************************************************************************
*                                                                              *
* Modification History                                                         *
*                                                                              *
* Revision  Date      Who Modified    Description                              *
*                                                                              *
* 1.1     21 Jan 1998 EF   Add storechone (TRC)                                *
*******************************************************************************/
%{
#include <stdio.h>
#include <ms_rmb.h>
#include <ms_rmb_parser.h>
#include "__parser__tab.h"
static void store_conv(void);
static void storechone(void);
static void store_afp(void);
static int store_channel(void);
static int store_eplb(char);
%}
%%
^\x5a..\xd3\xaf\x5f		{ store_afp(); return(t_IPS); }
^\x5a				{ store_afp(); return(t_AFP); }
^\xc5\xd7\xd3\xf1..........\xf0.*	\
					{ store_conv(); return(t_EPL1_S_E); }
^\xc5\xd7\xd3\xf1..........\xf2.*	\
					{ store_conv(); return(t_EPL1_M_E); }
^\xc5\xd7\xd3\xf2.*     { store_conv(); return(t_EPL2_E); }
^\xc5\xd7\xd3\xd7.*     { store_conv(); return(t_EPLP_E); }
^\xc5\xd7\xd3\xd4.*     { store_conv(); return(t_EPLM_E); }
^\xf1.*                         { storechone(); return(t_CH1_E); } 
^[\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xc1\xc2\xc3].* \
                                        { return( store_channel() ); }
^[\x40\xF0\x60\x4e].* \
                                        { storechone(); return(t_CH_NEUTRAL_E); }
^\xc5\xd7\xd3\xf4.*     { store_conv(); return(t_EPL4_E); }
^\xc5\xd7\xd3\xf7.*     { store_conv(); return(t_EPL7_E); }
^\xc5\xd7\xd3\xd1\x40\xd4\xc2\xc7\xd3\xc5\xe3.*	\
			{ store_conv(); return(t_EPLJMBGLET_E); }
^\xc5\xd7\xd3\xd1\x40\xd4\xc2\xc7\xc6\xc9\xd3\xc5.*	\
			{ store_conv(); return(t_EPLJMBGFILE_E); }
^\xc5\xd7\xd3\xd1\x40\xd4\xc2\xc7\xe2\xc5\xd9\xe5.*	\
			{ store_conv(); return(t_EPLJMBGSERV_E); }
^\xc5\xd7\xd3\xd1\x40\xd4\xc2\xc7\xd7\xc1\xc7\xc5.*	\
			{ store_conv(); return(t_EPLJMBGPAGE_E); }
\n					{ return(t_NL);    }
.					{ printf("%X len %d\n", yytext[0], yyleng);
 if (yytext[0] == 0x5a)  
{ store_afp(); 
  return (t_AFP);
} else return(t_ERR); } 
%%
/* Removed rule EF 21/1/1998 
^\xf1.*                         { storechone(); return(t_CH1_E); } 
*/

static void storechone(void)
{
        char c;

        if(yyleng!=1)
        {
                memcpy(lineBuffer, yytext, yyleng);
                lineBuffer[yyleng]='\0';
        }
        else
        {
                /* '\0' has been met */
                memcpy(lineBuffer, yytext, yyleng);
                while((c=input())!='\n')
                {
                        lineBuffer[yyleng++]=c;
                }
                unput(c);
                lineBuffer[yyleng]='\0';
        }
        mleng=yyleng;
}

static void store_conv(void)
{
	char	ascii_rec[1024];

	memcpy(lineBuffer, yytext, yyleng);
	lineBuffer[yyleng]='\0';
	mleng=yyleng;
	Convert_to_ASCII(yytext,ascii_rec,mleng);
	ascii_rec[mleng] = NULL;

#ifdef DEBUG
	printf("lineBuffer: #%s#\n", lineBuffer);
	printf("ascii: #%s#\n", ascii_rec);
	printf("mleng: %d\n", mleng);
#endif
}

/* AFP block management */
static void store_afp(void)
{
	unsigned int i, nchar;
	char c;
	memcpy(lineBuffer, yytext, yyleng);
        for ( ;yyleng < 6; yyleng++)
        {
	lineBuffer[yyleng]=input();
	}
/*
	lineBuffer[yyleng]=input();
	yyleng++;
	lineBuffer[yyleng]=input();
	yyleng++;
*/
	/* The bytes [1-2] contain the lenght of the record afp; */
	/* the byte [1] is the most significant byte */
	nchar = ((unsigned char)lineBuffer[1])*256 + (unsigned char)lineBuffer[2];
	for( i=yyleng-1; i<nchar; i++)
	{
		c=input();
		lineBuffer[yyleng]=c;
		yyleng++;
	}
	mleng=yyleng;
#ifdef DEBUG 
	printf("lineBuffer: #%s#\n", lineBuffer);
	printf("mleng: %d\n", mleng);
#endif
}

/* Channels management */
/* the recipient channel is 2 or the one in the customer profile */
int store_channel(void)
{
	char	ascii_rec[1024];
	char c;

/*	memcpy(lineBuffer, yytext, yyleng);
	lineBuffer[yyleng]='\0';
	mleng=yyleng;

	Convert_to_ASCII(yytext,ascii_rec,mleng);
	ascii_rec[mleng] = NULL;
*/

        if(yyleng!=1)
        {
                memcpy(lineBuffer, yytext, yyleng);
                lineBuffer[yyleng]='\0';
        }
        else
        {
                /* '\0' has been met */
                memcpy(lineBuffer, yytext, yyleng);
                while((c=input())!='\n')
                {
                        lineBuffer[yyleng++]=c;
                }
                unput(c);
                lineBuffer[yyleng]='\0';
        }
        mleng=yyleng;

#ifdef DEBUG
	printf("lineBuffer: #%s#\n", lineBuffer);
	printf("ascii: #%s#\n", ascii_rec);
	printf("mleng: %d\n", mleng);
#endif

	if(lineBuffer[0] == 0xF2)
		return (t_CHX_REC_E);
	else
		return (t_CHX_NOREC_E);

}

i will be grateful if u help me figure this out!!!
 
Old 09-16-2009, 06:32 AM   #2
cicorino
Member
 
Registered: May 2006
Location: Italy
Distribution: Slackware, Slackware64
Posts: 31

Rep: Reputation: 16
Hi,
this time your problem is much easier: you have to remove the trailing backslashes inside the rules declarations and let the '{' follow the rule instead of going to a new line.

Code:
^\x5a..\xd3\xaf\x5f		{ store_afp(); return(t_IPS); }
^\x5a				{ store_afp(); return(t_AFP); }
^\xc5\xd7\xd3\xf1..........\xf0.*	{ store_conv(); return(t_EPL1_S_E); }
^\xc5\xd7\xd3\xf1..........\xf2.*	{ store_conv(); return(t_EPL1_M_E); }
^\xc5\xd7\xd3\xf2.*     { store_conv(); return(t_EPL2_E); }
^\xc5\xd7\xd3\xd7.*     { store_conv(); return(t_EPLP_E); }
^\xc5\xd7\xd3\xd4.*     { store_conv(); return(t_EPLM_E); }
^\xf1.*                         { storechone(); return(t_CH1_E); }
^[\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xc1\xc2\xc3].* { return( store_channel() ); }
^[\x40\xF0\x60\x4e].*   { storechone(); return(t_CH_NEUTRAL_E); }
^\xc5\xd7\xd3\xf4.*     { store_conv(); return(t_EPL4_E); }
^\xc5\xd7\xd3\xf7.*     { store_conv(); return(t_EPL7_E); }
^\xc5\xd7\xd3\xd1\x40\xd4\xc2\xc7\xd3\xc5\xe3.*	{ store_conv(); return(t_EPLJMBGLET_E); }
^\xc5\xd7\xd3\xd1\x40\xd4\xc2\xc7\xc6\xc9\xd3\xc5.*	{ store_conv(); return(t_EPLJMBGFILE_E); }
^\xc5\xd7\xd3\xd1\x40\xd4\xc2\xc7\xe2\xc5\xd9\xe5.*	{ store_conv(); return(t_EPLJMBGSERV_E); }
^\xc5\xd7\xd3\xd1\x40\xd4\xc2\xc7\xd7\xc1\xc7\xc5.*	{ store_conv(); return(t_EPLJMBGPAGE_E); }
(I had some difficulties copying and pasting this code, so double check it.)

Bye!

Last edited by cicorino; 09-16-2009 at 06:33 AM. Reason: typo
 
Old 09-16-2009, 06:49 AM   #3
eljuventino
LQ Newbie
 
Registered: May 2009
Posts: 26

Original Poster
Blog Entries: 1

Rep: Reputation: 15
thanks a loooooooooot man it works!!!thank u !!thank u!!!
 
  


Reply



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
eth1 unrecognised johnmart Linux - Hardware 3 05-08-2007 08:07 AM
Installing un unrecognised MTA Chris Murphy Debian 6 01-14-2005 06:08 PM
VSFTP Unrecognised Variable? sjblasko82 Linux - Software 2 11-16-2004 05:16 PM
graphics card sis305 unrecognised valeed Linux - Hardware 2 06-08-2004 11:56 AM
My SATA Unrecognised by RH9.0 mlse Linux - Hardware 2 04-16-2004 05:34 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:31 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