[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Urgent Please: Specification of timestamp



Joseane,

You have forgotten about the space between years and hours! Also, it is 
a good idea to ignore blank tokens and comments (to save specifying 
where they are allowed in your productions). In your case, the space 
should be a part of the token, AND you should ignore blank tokens 
between others.

BTW, are you sure you cannot get by with simple regular expressions 
rather than a full blown parser?

Here is a different version

Helpers

   asp = 39;       // ascii value of  '
   digit = ['0' .. '9'];
   days_sequency = '0'['1'..'9'] | ['1'..'2']['0'..'9'] | '3'['0'..'1'] ;
   months_sequency = '0'['1'..'9'] | '1'['0'..'2'] ;
   years_sequency = ['2'..'9'] digit digit digit ;
   hours_sequency = '0'['0'..'9'] | '1'['0'..'9'] | '2'['0'..'3'] ;
   minutes_sequency = ['0'..'5']['0'..'9'] ;
   seconds_sequency = ['0'..'5']['0'..'9'] ;

   cr = 13;
   lf = 10;
   tab = 9;

Tokens

   operator = ',' ;
   blank = (cr | lf | tab | ' ')+;
   timestamp_value =
     asp days_sequency '.' months_sequency '.' years_sequency
     (tab | ' ')+
     hours_sequency':' minutes_sequency ':' seconds_sequency asp;


Ignored Tokens
   blank;

Productions
   actual_param_ts =
     [tsf]:timestamp_value operator [tss]: timestamp_value;

Roger

Joseane Farias Fidalgo wrote:

> In the first mail I forget to send you all what the meaning of digit in my
> specification and other things... Please, look the file again...
> 
> ----
> Hi,
> 
> Please: I have to specify a value of timestamp type in the european
> format:
> "'days.months.years hours:minutes:seconds'" like '01.02.2002 10:20:00'
> with the delimiter caracter " ' " delimiting it.
> I have tried many things but I only get it without the " ' ".
> It compilled and have generated all the packages, but when I tried to
> execute it gave an error of parsing, saying that he was expecting a
> timestamp value (he doesn't recgnized it). I tried the following:
>  	Thanks in advance, Joseane.
> ___
>  Helpers
> 
> asp = 39;	// ascii value of  '
> 
> digit =
> 	['0' .. '9'];
> 
> days_sequency =
>  	'0'['1'..'9'] | ['1'..'2']['0'..'9'] | '3'['0'..'1'] ;
> 
> months_sequency =
>  	'0'['1'..'9'] | '1'['0'..'2'] ;
> 
> years_sequency =
>  	['2'..'9'] digit digit digit ;
> 
> hours_sequency =
>  	'0'['0'..'9'] | '1'['0'..'9'] | '2'['0'..'3'] ;
> 
> minutes_sequency =
>  	['0'..'5']['0'..'9'] ;
> 
>  seconds_sequency =
>  	['0'..'5']['0'..'9'] ;
> 
> timestamp_sequency =
> 
>  	asp days_sequency '.' months_sequency '.' years_sequency
>  	hours_sequency':' minutes_sequency ':' seconds_sequency asp;
> 
> Tokens
> 
> operator = ',' ;
> timestamp_value =
> 	timestamp_sequency ;
> 
> Productions
> 
> actual_param_ts =
>  	[tsf]:timestamp_value operator [tss]: timestamp_value;
> 
> 
>