3 ======================================================================
5 CREATOR: eric 10 June 1999
12 (C) COPYRIGHT 1999 Eric Busboom
13 http://www.softwarestudio.org
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/
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.
25 The original author is Eric Busboom
26 The original code is icalitip.y
30 ======================================================================*/
31 #include "icalparser.h"
32 #include "icalenums.h"
33 #include "icalmemory.h"
37 #include <string.h> /* For strdup() */
39 int icalparser_flex_input(char* buf, int max_size);
40 void icalparser_clear_flex_input(void);
43 #define ICAL_MAX_STR_CONST 1024
46 #define YY_INPUT(b,r,ms) ( r= icalparser_flex_input(b,ms))
49 #define YY_FATAL_ERROR(msg) ical_yyerror(msg)
51 icalvalue_kind value_kind=ICAL_NO_VALUE;
52 void set_parser_value_state(icalvalue_kind kind);
55 void ical_yyerror(char *s);
57 void init_str_buf(void);
63 size_t buf_sz; /* = ICAL_MAX_STR_CONST;*/
69 qsafechar [^\x00-\x1F\"]
70 safechar [^\x00-\x1F\"\:\;\,]
71 tsafechar [\x20-\x21\x23-\x2B\x2D-\x39\x3C-\x5B\x5D-\x7E]
72 valuechar [^\x00-\x08\x10-\x1F]
73 xname X-[a-zA-Z0-9\-]+
74 xname2 [a-zA-Z0-9\-\ ]
77 quotedstring \"{qsafechar}+\"
80 %array /* Make yytext an array. Slow, but handy. HACK */
85 %s binary_value boolean_value uri_value time_value duration_value number_value period_value recur_value text_value utcoffset_value
86 %s enum_param_value string_param_value stringlist_param_value keyword line_start component seperator parameter end_of_value paramtext
98 {digit}+ { ical_yylval.v_string =icalmemory_tmp_copy(yytext) ;
100 T { return TIME_CHAR; }
101 Z { return UTC_CHAR; }
102 [\/\+\-PWHMSD] { return yytext[0]; }
103 {crlf} { return EOL;}
108 {crlf} { return EOL;}
109 \-|\+ { return yytext[0]; }
110 {digit}{digit} { ical_yylval.v_int=atoi(yytext); return INTNUMBER; }
115 . { return CHARACTER; }
116 {crlf} { return EOL;}
121 , { BEGIN(last_state); return COMMA; }
133 void set_parser_value_state(icalvalue_kind kind)
138 case ICAL_UTCOFFSET_VALUE:
139 {BEGIN(utcoffset_value);break;}
141 case ICAL_DATETIMEPERIOD_VALUE:
142 case ICAL_DURATION_VALUE:
143 case ICAL_PERIOD_VALUE:
144 {BEGIN(time_value);break;}
153 void init_str_buf(void)
155 str_buf = icalmemory_tmp_buffer(ICAL_MAX_STR_CONST);
157 buf_sz = ICAL_MAX_STR_CONST;