File: loady.y

package info (click to toggle)
eccodes 2.45.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 154,404 kB
  • sloc: cpp: 162,953; ansic: 26,308; sh: 21,742; f90: 6,854; perl: 6,361; python: 5,172; java: 2,226; javascript: 1,427; yacc: 854; fortran: 543; lex: 359; makefile: 283; xml: 183; awk: 66
file content (72 lines) | stat: -rw-r--r-- 1,320 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
%{

#include "grib_api.h"
#include <string.h>

extern int yylex();
extern void yyerror(const char*);

#include "load.h"




%}

%union {
    char                  *str;
    long                  lval;
    double                dval;
};

%start all

%token MISSING;

%token <str>IDENT
%token <str>STRING

%token <lval>INTEGER
%token <dval>FLOAT

%%

all        : empty        
           | message
           ;

empty:;

messages : message
         | messages message
         ;

message : IDENT '{' accessors '}' ';'  { load_finish(); }
        ; 

accessors : accessor
    | accessors accessor
    ;

accessor : IDENT '=' INTEGER ';'     { load_long($1,$3);   }
         | IDENT '=' '-' INTEGER ';' { load_long($1,-$4);  }
         | IDENT '=' STRING  ';'     { load_string($1,$3); }
         | IDENT '=' FLOAT  ';'      { load_double($1,$3); }
         | IDENT '=' MISSING  ';'    { load_missing($1);  }
         | IDENT '=' '-' FLOAT  ';'  { load_double($1,-$4); }
		 | IDENT '=' '{' {load_start_array();} values ',' '}'  ';' 
		 	{ load_end_array($1); free($1); }

         ;

values: value 
	  | values ',' value 
	  ;

value : INTEGER      { load_long_value($1);  }
      | '-' INTEGER  { load_long_value(-$2); }
	  | FLOAT        { load_double_value($1);  }
	  | '-' FLOAT    { load_double_value(-$2); }
	  ;

%%