]> Pileus Git - ~andy/rsl/blob - rapic-lex.l
RSL v1.44
[~andy/rsl] / rapic-lex.l
1 /*
2     NASA/TRMM, Code 910.1.
3     This is the TRMM Office Radar Software Library.
4     Copyright (C) 1996, 1997, 1998
5             John H. Merritt
6             Space Applications Corporation
7             Vienna, Virginia
8
9     This library is free software; you can redistribute it and/or
10     modify it under the terms of the GNU Library General Public
11     License as published by the Free Software Foundation; either
12     version 2 of the License, or (at your option) any later version.
13
14     This library is distributed in the hope that it will be useful,
15     but WITHOUT ANY WARRANTY; without even the implied warranty of
16     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17     Library General Public License for more details.
18
19     You should have received a copy of the GNU Library General Public
20     License along with this library; if not, write to the Free
21     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23 /*
24  * 2/18/98 - John Merritt
25  */
26 %{
27
28 #include <stdio.h>
29 #include "rapic_routines.h"
30 #include "rapic.h"
31 #include <string.h>
32
33 /*
34      fprintf(stderr, "LEX len=%d text=<", yyleng);\
35      binprint(yytext, yyleng);\
36      fprintf(stderr, ">  token=[%d]\n", x);\
37 */
38 #define strreturn(x) rapiclval.token.s = calloc(yyleng+1, sizeof(char));\
39                      rapiclval.token.len=yyleng;\
40                      memcpy(rapiclval.token.s, yytext, yyleng);\
41                      return x;
42
43 %}
44
45
46 %x ATMODE
47
48 %%
49
50 \/IMAGE:          {strreturn(IMAGE);}
51 \/IMAGEEND:       {strreturn(IMAGEEND);}
52 \/IMAGESCANS:     {strreturn(IMAGESCANS);}
53 \/IMAGESIZE:      {strreturn(IMAGESIZE);}
54 \/SCAN            {strreturn(SCAN);}
55 "\/IMAGEHEADER END:"     {strreturn(IMAGEHEADEREND);}
56 COUNTRY:          {strreturn(COUNTRY);}
57 NAME:             {strreturn(NAME);}
58 STNID:            {strreturn(STNID);}
59 LATITUDE:         {strreturn(LATITUDE);}
60 LONGITUDE:        {strreturn(LONGITUDE);}
61 HEIGHT:           {strreturn(HEIGHT);}
62 DATE:             {strreturn(DATE);}
63 TIME:             {strreturn(TIME);}
64 TIMESTAMP:        {strreturn(TIMESTAMP);}
65 VERS:             {strreturn(VERS);}
66 FREQUENCY:        {strreturn(FREQUENCY);}
67 PRF:              {strreturn(PRF);}
68 PULSELENGTH:      {strreturn(PULSELENGTH);}
69 RNGRES:           {strreturn(RNGRES);}
70 ANGRES:           {strreturn(ANGRES);}
71 ANGLERATE:        {strreturn(ANGLERATE);}
72 CLEARAIR:         {strreturn(CLEARAIR);}
73 VIDRES:           {strreturn(VIDRES);}
74 STARTRNG:         {strreturn(STARTRNG);}
75 ENDRNG:           {strreturn(ENDRNG);}
76 PRODUCT:          {strreturn(PRODUCT);}
77 PASS:             {strreturn(PASS);}
78 IMGFMT:           {strreturn(IMGFMT);}
79 ELEV:             {strreturn(ELEV);}
80 VIDEO:            {strreturn(VIDEO);}
81 VELLVL:           {strreturn(VELLVL);}
82 NYQUIST:          {strreturn(NYQUIST);}
83 UNFOLDING:        {strreturn(UNFOLDING);}
84 VOLUMETRIC        {strreturn(VOLUMETRIC);}
85 NORMAL            {strreturn(NORMAL);}
86 [Nn][Oo][Nn][Ee]  {strreturn(NONE);}
87 [Oo][Ff]          {strreturn(OF);}
88 [Oo][Nn]          {strreturn(ON);}
89 [Oo][Ff][Ff]      {strreturn(OFF);}
90 [Rr][Ee][Ff][Ll]  {strreturn(REFL);}
91 [Vv][Ee][Ll]      {strreturn(VEL);}
92 [Uu][Nn][Cc][Oo][Rr][Rr][Ee][Ff][Ll]  {strreturn(UNCORREFL);}
93 [Zz][Dd][Rr]      {strreturn(ZDR);}
94 [Ww][Ii][Dd] |
95 [Ww][Ii][Dd][Tt][Hh]   {strreturn(WID);}
96
97 -?[[:digit:]]+       {strreturn(NUMBER);}
98 -?[[:digit:]]*[\.][[:digit:]]+ |
99 -?[[:digit:]]+[\.][[:digit:]]*  {strreturn(FLOATNUMBER);}
100 [[][[:digit:]]+[]] {strreturn(BRACKETNUM);}
101
102 [[:alpha:]]+       {strreturn(ALPHA);}
103
104 "END RADAR IMAGE"  {strreturn(ENDRADARIMAGE);}
105
106
107
108 "@" {BEGIN ATMODE; yymore();}
109 <ATMODE>. |
110 <ATMODE>\n      {yymore();}
111 <ATMODE>"\0\0@"  |
112 <ATMODE>"\0\0\x1a" {BEGIN INITIAL; yyless(yyleng-1); strreturn(RAYDATA);}
113
114 :  {return(yytext[0]);}
115
116 . ; /* Ignore. */
117 "\n" ; /* Ignore. */
118
119 %%