3 * lexer for parsing xml-property source files (*.xml)
8 /* enlarge token buffer to tokenize whole strings */
12 /* to enable debug output define LEXDEBUG */
15 #define OUTPUT fprintf
17 #define OUTPUT(Par1,Par2);
20 /* table of possible token ids */
26 #pragma GCC system_header
27 #elif defined __SINPRO_CC
29 #elif defined _MSC_VER
30 #pragma warning(push, 1)
33 /* external functions (C++ code, declared as extren "C" */
34 extern int WorkOnTokenSet( int, char* );
35 extern int Argument( char * );
36 extern int InitXrmExport( char * , char * );
37 extern int EndXrmExport();
38 extern int GetError();
39 extern int SetError();
40 extern char *GetOutputFile( int argc, char* argv[]);
41 extern FILE *GetXrmFile();
43 extern void removeTempFile();
44 extern char* getFilename();
59 WorkOnTokenSet( XRM_README_START, yytext );
63 WorkOnTokenSet( XRM_README_END, yytext );
67 WorkOnTokenSet( XRM_README_START, yytext );
71 WorkOnTokenSet( XRM_README_END, yytext );
75 WorkOnTokenSet( XRM_SECTION_START, yytext );
79 WorkOnTokenSet( XRM_SECTION_END, yytext );
82 "<Paragraph"[^\>]*\> {
83 WorkOnTokenSet( XRM_PARAGRAPH_START, yytext );
87 WorkOnTokenSet( XRM_PARAGRAPH_END, yytext );
91 WorkOnTokenSet( XRM_TEXT_START, yytext );
95 WorkOnTokenSet( XRM_TEXT_END, yytext );
99 WorkOnTokenSet( XRM_LIST_START, yytext );
103 WorkOnTokenSet( XRM_LIST_END, yytext );
107 char c1 = 0, c2 = 0, c3 = input();
112 WorkOnTokenSet( COMMEND, yytext );
113 WorkOnTokenSet( COMMEND, pChar );
118 if ( c1 == '-' && c2 == '-' && c3 == '>' )
124 WorkOnTokenSet( COMMEND, pChar );
130 WorkOnTokenSet( XML_TEXTCHAR, yytext );
132 WorkOnTokenSet( UNKNOWNCHAR, yytext );
138 /*****************************************************************************/
140 /*****************************************************************************/
145 /*****************************************************************************/
146 void YYWarning( char *s )
147 /*****************************************************************************/
149 /* write warning to stderr */
151 "Warning: \"%s\" in line %d: \"%s\"\n", s, yylineno, yytext );
154 /*****************************************************************************/
156 void yyerror ( char *s, ... )
158 void yyerror ( char *s )
160 /*****************************************************************************/
162 /* write error to stderr */
164 "Error: \"%s\" in line %d: \"%s\"\n", s, yylineno, yytext );
168 /*****************************************************************************/
173 main( int argc, char* argv[])
174 /*****************************************************************************/
181 pOutput = GetOutputFile( argc, argv );
183 fprintf( stdout, "\nXrmEx 0.9 Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.\n" );
184 fprintf( stdout, "======================================================================\n" );
188 fprintf( stdout, "Syntax: XRMEX[-p Prj][-r PrjRoot]-i FileIn [-o FileOut][-m DataBase][-e][-b][-u][-NOUTF8][-L l1,l2,...]\n" );
189 fprintf( stdout, " Prj: Project\n" );
190 fprintf( stdout, " PrjRoot: Path to project root (..\\.. etc.)\n" );
191 fprintf( stdout, " FileIn: Source files (*.src)\n" );
192 fprintf( stdout, " FileOut: Destination file (*.*)\n" );
193 fprintf( stdout, " DataBase: Mergedata (*.sdf)\n" );
194 fprintf( stdout, " -e: Disable writing errorlog\n" );
195 fprintf( stdout, " -b: Break when Token \"HelpText\" found in source\n" );
196 fprintf( stdout, " -u: [english] and [german] are allowed, Id is Taken from DataBase \n" );
197 fprintf( stdout, " -NOUTF8: disable UTF8 as language independent encoding\n" );
198 fprintf( stdout, " -L: Restrict the handled languages. l1,l2,... are elements of (de,en-US,es...)\n" );
199 fprintf( stdout, " A fallback language can be defined like this: l1=f1.\n" );
200 fprintf( stdout, " f1, f2,... are also elements of (de,en-US,es...)\n" );
201 fprintf( stdout, " Example: -L en-US,es=de\n" );
202 fprintf( stdout, " Restriction to es and en-US, de will be fallback for 99\n" );
203 // fprintf( stdout, " -ISO99: IsoCode is the full qualified ISO language code for language 99" );
206 pFile = GetXrmFile();
207 InitXrmExport( pOutput , getFilename() );
214 /* create global instance of class XmlExport */
215 //InitXrmExport( pOutput );
220 /* get error info. and end export */
221 nRetValue = GetError();
224 if( !isQuiet() ) fprintf( stdout, "\n===================================\n\n" );
226 /* return error level */