]> Pileus Git - ~andy/rsl/blob - src/rapic_scan.l
Fix more errors
[~andy/rsl] / src / rapic_scan.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_parse.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 %option nounput
46 %option noinput
47 %x ATMODE
48
49 %%
50
51 \/IMAGE:          {strreturn(IMAGE);}
52 \/IMAGEEND:       {strreturn(IMAGEEND);}
53 \/IMAGESCANS:     {strreturn(IMAGESCANS);}
54 \/IMAGESIZE:      {strreturn(IMAGESIZE);}
55 \/SCAN            {strreturn(SCAN);}
56 "\/IMAGEHEADER END:"     {strreturn(IMAGEHEADEREND);}
57 COUNTRY:          {strreturn(COUNTRY);}
58 NAME:             {strreturn(NAME);}
59 STNID:            {strreturn(STNID);}
60 LATITUDE:         {strreturn(LATITUDE);}
61 LONGITUDE:        {strreturn(LONGITUDE);}
62 HEIGHT:           {strreturn(HEIGHT);}
63 DATE:             {strreturn(DATE);}
64 TIME:             {strreturn(TIME);}
65 TIMESTAMP:        {strreturn(TIMESTAMP);}
66 VERS:             {strreturn(VERS);}
67 FREQUENCY:        {strreturn(FREQUENCY);}
68 PRF:              {strreturn(PRF);}
69 PULSELENGTH:      {strreturn(PULSELENGTH);}
70 RNGRES:           {strreturn(RNGRES);}
71 ANGRES:           {strreturn(ANGRES);}
72 ANGLERATE:        {strreturn(ANGLERATE);}
73 CLEARAIR:         {strreturn(CLEARAIR);}
74 VIDRES:           {strreturn(VIDRES);}
75 STARTRNG:         {strreturn(STARTRNG);}
76 ENDRNG:           {strreturn(ENDRNG);}
77 PRODUCT:          {strreturn(PRODUCT);}
78 PASS:             {strreturn(PASS);}
79 IMGFMT:           {strreturn(IMGFMT);}
80 ELEV:             {strreturn(ELEV);}
81 VIDEO:            {strreturn(VIDEO);}
82 VELLVL:           {strreturn(VELLVL);}
83 NYQUIST:          {strreturn(NYQUIST);}
84 UNFOLDING:        {strreturn(UNFOLDING);}
85 VOLUMETRIC        {strreturn(VOLUMETRIC);}
86 NORMAL            {strreturn(NORMAL);}
87 [Nn][Oo][Nn][Ee]  {strreturn(NONE);}
88 [Oo][Ff]          {strreturn(OF);}
89 [Oo][Nn]          {strreturn(ON);}
90 [Oo][Ff][Ff]      {strreturn(OFF);}
91 [Rr][Ee][Ff][Ll]  {strreturn(REFL);}
92 [Vv][Ee][Ll]      {strreturn(VEL);}
93 [Uu][Nn][Cc][Oo][Rr][Rr][Ee][Ff][Ll]  {strreturn(UNCORREFL);}
94 [Zz][Dd][Rr]      {strreturn(ZDR);}
95 [Ww][Ii][Dd] |
96 [Ww][Ii][Dd][Tt][Hh]   {strreturn(WID);}
97
98 -?[[:digit:]]+       {strreturn(NUMBER);}
99 -?[[:digit:]]*[\.][[:digit:]]+ |
100 -?[[:digit:]]+[\.][[:digit:]]*  {strreturn(FLOATNUMBER);}
101 [[][[:digit:]]+[]] {strreturn(BRACKETNUM);}
102
103 [[:alpha:]]+       {strreturn(ALPHA);}
104
105 "END RADAR IMAGE"  {strreturn(ENDRADARIMAGE);}
106
107
108
109 "@" {BEGIN ATMODE; yymore();}
110 <ATMODE>. |
111 <ATMODE>\n      {yymore();}
112 <ATMODE>"\0\0@"  |
113 <ATMODE>"\0\0\x1a" {BEGIN INITIAL; yyless(yyleng-1); strreturn(RAYDATA);}
114
115 :  {return(yytext[0]);}
116
117 . ; /* Ignore. */
118 "\n" ; /* Ignore. */
119
120 %%