Remove the 4th option from the pivot table source selection dialog.
[LibreOffice.git] / l10ntools / source / srclex.l
blob755b0b3820086f45c4e7640d5af29b9cf0a4365e
2 %{
3 /*
4  * This file is part of the LibreOffice project.
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0. If a copy of the MPL was not distributed with this
8  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9  *
10  * This file incorporates work covered by the following license notice:
11  *
12  *   Licensed to the Apache Software Foundation (ASF) under one or more
13  *   contributor license agreements. See the NOTICE file distributed
14  *   with this work for additional information regarding copyright
15  *   ownership. The ASF licenses this file to you under the Apache
16  *   License, Version 2.0 (the "License"); you may not use this file
17  *   except in compliance with the License. You may obtain a copy of
18  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
19  */
22  * lexer for parsing resource source files (*.src)
23  */
25 /* enlarge token buffer to tokenize whole strings */
26 #undef YYLMAX
27 #define YYLMAX 64000
29 /* to enable debug output define LEXDEBUG */
30 #define LEXDEBUG                1
31 #ifdef LEXDEBUG
32 #define OUTPUT  fprintf
33 #else
34 #define OUTPUT(Par1,Par2);
35 #endif
37 /* table of possible token ids */
38 #include "tokens.h"
39 #include <stdlib.h>
40 #include <stdio.h>
42 #include "sal/main.h"
44 #if defined __GNUC__
45 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))
46 #pragma GCC diagnostic ignored "-Wunused-function"
47 #pragma GCC diagnostic ignored "-Wunused-label"
48 #endif
49 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
50 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
51 #endif
52 #elif defined __SINPRO_CC
53 #pragma disable_warn
54 #elif defined _MSC_VER
55 #pragma warning(push, 1)
56 #endif
58 /* external functions (C++ code, declared as extern "C" */
59 extern "C" int WorkOnTokenSet( int, char* );
60 extern "C" FILE * init(int, char **);
61 extern "C" int SetError();
62 extern "C" int GetError();
63 extern "C" void Close();
65 /* forwards */
66 void YYWarning();
69 %option yylineno
70 %option never-interactive
72 %p 24000
73 %e 1200
74 %n 500
78 ^[\t ]*"#pragma".*      {
79         WorkOnTokenSet( PRAGMA, yytext );
82 ^[ \t]*\n {
83         WorkOnTokenSet( EMPTYLINE, yytext );
86 [\t ]+                          |
87 ^[\t ]*"#include".*     |
88 ^[\t ]*"#undef".*       |
89 "//".*                          |
90 ";"                             |
91 "<"                                     |
92 ">"                                     |
93 \n      {
94         WorkOnTokenSet( IGNOREDTOKENS, yytext );
96 "/*"    {
97         char c1 = 0;
98         int c2 = yyinput();
99         char pChar[2];
100         pChar[1] = 0x00;
101         pChar[0] = c2;
103         WorkOnTokenSet( COMMENT, yytext );
104         WorkOnTokenSet( COMMENT, pChar );
105         for(;;) {
106                 if ( c2 == EOF )
107                         break;
108                 if ( c1 == '*' && c2 == '/' )
109                         break;
110                 c1 = c2;
111                 c2 = yyinput();
112                 pChar[0] = c2;
113                 WorkOnTokenSet( COMMENT, pChar );
114         }
117 ^[\t ]*"#ifndef".+$     |
118 ^[\t ]*"#ifdef".+$      |
119 ^[\t ]*"#if".+$         |
120 ^[\t ]*"#elif".*$       |
121 ^[\t ]*"#else".*$       |
122 ^[\t ]*"#endif".*$      {
123         WorkOnTokenSet( CONDITION, yytext );
126 [a-zA-Z]+[\t ]+[^={\n]+[\t ] {
127 /* defined Res */
128         WorkOnTokenSet( DEFINEDRES, yytext );
131 [a-zA-Z]+[ \t]+[^={;\n]+\n[ \t]*"#".*\n[ \t]*"{"        |
132 [a-zA-Z]+[ \t]+[^={;\n]+\n?([ \t]*"//".*\n)*[ \t]*"{"   {
133 /* RESOURCE // String TTT_XX ... */
134         WorkOnTokenSet( RESOURCE, yytext );
137 ^[\t ]*[a-zA-Z_]+[\t ]*"\\"?[\t ]*\n?[ \t]*"{"[\t ]*"\\"?       {
138 /* SMALRESOURCE // String ... */
139         WorkOnTokenSet( SMALRESOURCE, yytext );
142 [\t ]*[a-zA-Z0-9_]+[ \t]*("["[ \t]*[a-zA-Z0-9_\-]+[ \t]*"]"[ \t]*)?=[ \t]*L?\".*\".*\n? {
143 /* TEXTLINE // TextTyp = "A Text" */
144         WorkOnTokenSet( TEXTLINE, yytext );
147 [\t ]*[a-zA-Z0-9_]+[ \t]*("["[ \t]*[a-zA-Z0-9_\-]+[ \t]*"]"[ \t]*)?(\n[ \t]*)?=([ \t]*\n)?(([a-zA-Z0-9_]+)|(\".*\")|([ \t\n]*))*\".*\"(([a-zA-Z0-9_]+)|(\".*\")|([ \t\n]*))*;   {
148 /* LONGTEXTLINE // TextTyp = "A Text" HHH_XXX "A Text" ZZZ_TTT ... */
149         WorkOnTokenSet( LONGTEXTLINE, yytext );
152 \".*\" {
153 /* TEXT // "A Text" */
154         WorkOnTokenSet( TEXT, yytext );
157 "{"[ \t]*\\?    {
158 /* LEVELUP */
159         WorkOnTokenSet( LEVELUP, yytext );
162 "}"[ \t]*;([ \t]*\\)?   {
163 /* LEVELDOWN */
164         WorkOnTokenSet( LEVELDOWN, yytext );
167 [a-zA-Z0-9_]+[ \t]*"="[ \t]*"MAP_APPFONT"[ \t]*"(".+")".*       {
168 /* APPFONTMAPPING  Typ = MAP_APPFONT( ... ) */
169         WorkOnTokenSet( APPFONTMAPPING, yytext );
172 [ \t]*[a-zA-Z0-9_]+[ \t]*=[ \t]*[0123456789]{1,5}[ \t]*";"?\\? {
173 /* TEXTREFID // TextTyp = 12345 */
174         WorkOnTokenSet( TEXTREFID, yytext );
177 [a-zA-Z0-9_]+[ \t]*"="[\t ]*([ \t]*"//".*\n)*.* |
178 [a-zA-Z0-9_]+[ \t]*"=".*        {
179 /* ASSIGNMENT  Typ = ...  */
180  WorkOnTokenSet( ASSIGNMENT, yytext );
185 [a-zA-Z0-9_]+[ \t]*("["[ \t]*[a-zA-Z0-9_\-]+[ \t]*"]"[ \t]*)?"="[ \t]*(\\[ \t]*)?\n?[ \t]*"{"[ \t]*(\\[ \t]*)?\n?[ \t]*"<"      {
186 /* LISTASSIGNMENT  Typ [ ... ] = ... */
187         WorkOnTokenSet( LISTASSIGNMENT, yytext );
190 "StringList"+[ \t]*("["[ \t]*[a-zA-Z0-9_\-]+[ \t]*"]"[ \t]*)?"="[ \t]*(\\[ \t]*)?\n?[ \t]*"{"[ \t]*(\\[ \t]*)?\n?[ \t]* {
191 /* LISTASSIGNMENT  Typ [ ... ] = ... */
192         WorkOnTokenSet( LISTASSIGNMENT, yytext );
195 "UIEntries"[ \t]*("["[ \t]*[a-zA-Z0-9_\-]+[ \t]*"]"[ \t]*)?"="[ \t]*(\\[ \t]*)?\n?[ \t]*"{"     {
196 /* UIENTRIES */
197         WorkOnTokenSet( UIENTRIES, yytext );
200 "<"?[ \t]*L?\".*\".*">" {
201 /* LISTTEXT */
202         WorkOnTokenSet( LISTTEXT, yytext );
205 [ \t]*"#define"[ \t]+[a-zA-Z0-9_]+.*"\\"        {
206 /* RSCDEFINE  #define ... */
207         WorkOnTokenSet( RSCDEFINE, yytext );
210 [ \t]*"#define"[ \t]+[a-zA-Z0-9_]+.+ {
211 /* #define ... */
212         WorkOnTokenSet( NORMDEFINE, yytext );
215 "\\" {
216 /* RSCDEFINELEND */
217         WorkOnTokenSet( RSCDEFINELEND, yytext );
220 [a-zA-Z0-9_]+[ \t]*; {
221 /* allowed other tokens like "49 ;" or "SFX_... ;" */
222         WorkOnTokenSet( ANYTOKEN, yytext );
225 .       {
226         WorkOnTokenSet( UNKNOWNCHAR, yytext );
227 /*      YYWarning( "Unknown Char" ); */
230 "{"?[ \t]*\".*\"[ \t]*";"[ \t]*"}" {
231 /* _LISTTEXT */
232         WorkOnTokenSet( _LISTTEXT, yytext );
237 /*****************************************************************************/
238 int     yywrap(void)
239 /*****************************************************************************/
241         return 1;
244 /*****************************************************************************/
245 void YYWarning( const char *s )
246 /*****************************************************************************/
248         /* write warning to stderr */
249         fprintf( stderr, "Warning: \"%s\" in line %d: \"%s\"\n", s, yylineno, yytext  );
252 /*****************************************************************************/
253 void yyerror( const char *s )
254 /*****************************************************************************/
256         /* write error to stderr */
257         fprintf( stderr, "Error: \"%s\" in line %d: \"%s\"\n", s, yylineno, yytext  );
258         SetError();
261 SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
262     int e;
263     yyin = init(argc, argv);
264     yylex();
265     e = GetError();
266     Close();
267     return EXIT_SUCCESS;