Remove apparently useless forward declarations. Should fix bug #2893
[claws.git] / src / plugins / vcalendar / libical / libical / icallexer.l
1 %{
2 /* -*- Mode: C -*-
3   ======================================================================
4   FILE: icallexer.l
5   CREATOR: eric 10 June 1999
6   
7   DESCRIPTION:
8   
9   $Id$
10   $Locker$
11
12   (C) COPYRIGHT 1999 Eric Busboom 
13   http://www.softwarestudio.org
14
15   The contents of this file are subject to the Mozilla Public License
16   Version 1.0 (the "License"); you may not use this file except in
17   compliance with the License. You may obtain a copy of the License at
18   http://www.mozilla.org/MPL/
19  
20   Software distributed under the License is distributed on an "AS IS"
21   basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
22   the License for the specific language governing rights and
23   limitations under the License.
24
25   The original author is Eric Busboom
26   The original code is icalitip.y
27
28
29
30   ======================================================================*/
31 #include "icalparser.h"
32 #include "icalenums.h"
33 #include "icalmemory.h"
34 #include "assert.h"
35 #include "icalyacc.h"
36
37 #include <string.h> /* For strdup() */
38
39 int icalparser_flex_input(char* buf, int max_size);
40 void icalparser_clear_flex_input(void);
41
42
43 #define ICAL_MAX_STR_CONST 1024
44
45 #undef YY_INPUT
46 #define YY_INPUT(b,r,ms) ( r= icalparser_flex_input(b,ms))
47 #undef yywrap
48
49 #undef YY_FATAL_ERROR
50 #define YY_FATAL_ERROR(msg) ical_yyerror(msg)
51
52 icalvalue_kind value_kind=ICAL_NO_VALUE;
53 void set_parser_value_state(icalvalue_kind kind);
54 extern int yydebug; 
55
56 void ical_yyerror(char *s);
57
58 void init_str_buf(void);
59
60 int last_state;
61
62 char *str_buf;
63 char *str_buf_p;
64 size_t buf_sz; /* = ICAL_MAX_STR_CONST;*/
65
66 %}
67
68 crlf            \x0D?\x0A
69 space           [ ]
70 qsafechar       [^\x00-\x1F\"]
71 safechar        [^\x00-\x1F\"\:\;\,]
72 tsafechar       [\x20-\x21\x23-\x2B\x2D-\x39\x3C-\x5B\x5D-\x7E]
73 valuechar       [^\x00-\x08\x10-\x1F]
74 xname           X-[a-zA-Z0-9\-]+
75 xname2          [a-zA-Z0-9\-\ ]
76 paramtext       {safechar}+
77 value           {valuechar}+
78 quotedstring    \"{qsafechar}+\"
79 digit           [0-9]
80
81 %array /* Make yytext an array. Slow, but handy. HACK */
82
83 %option caseless
84
85 %s quoted_string
86 %s binary_value boolean_value uri_value time_value duration_value number_value period_value recur_value text_value utcoffset_value
87 %s enum_param_value string_param_value stringlist_param_value keyword line_start component seperator parameter end_of_value paramtext
88
89
90
91 %%
92
93 %{
94 %}
95
96
97
98 <time_value>{
99 {digit}+                 { ical_yylval.v_string =icalmemory_tmp_copy(yytext) ;
100                            return DIGITS; }
101 T                        { return TIME_CHAR; }
102 Z                        { return UTC_CHAR; }
103 [\/\+\-PWHMSD]           { return yytext[0]; }
104 {crlf}                   { return EOL;}
105
106 }
107
108 <utcoffset_value>{
109 {crlf}                   { return EOL;}
110 \-|\+                    { return yytext[0]; }
111 {digit}{digit}           { ical_yylval.v_int=atoi(yytext); return INTNUMBER; }
112
113 }
114
115 <enum_param_value>{
116 .                        { return CHARACTER; }
117 {crlf}                   { return EOL;}
118
119 }
120
121 <seperator>{
122 ,       { BEGIN(last_state); return COMMA; } 
123 }
124
125
126 %% 
127
128 int yywrap()
129 {
130      return 1;
131 }
132
133
134 void set_parser_value_state(icalvalue_kind kind)
135 {
136
137     switch (kind){
138
139         case ICAL_UTCOFFSET_VALUE:
140             {BEGIN(utcoffset_value);break;}
141
142         case ICAL_DATETIMEPERIOD_VALUE:
143         case ICAL_DURATION_VALUE:
144         case ICAL_PERIOD_VALUE:
145             {BEGIN(time_value);break;}
146
147         default:
148         {
149            assert(1==0);
150         }
151     }
152 }
153
154 void init_str_buf(void)
155 {
156    str_buf = icalmemory_tmp_buffer(ICAL_MAX_STR_CONST);
157    str_buf_p = str_buf;
158    buf_sz = ICAL_MAX_STR_CONST;
159
160
161 }
162