LCOV - code coverage report
Current view: top level - l10ntools/source - cfglex.l (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 59 0.0 %
Date: 2012-08-25 Functions: 0 5 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : %{
       2                 :            : /*
       3                 :            :  * lexer for parsing cfg source files
       4                 :            :  *
       5                 :            :  */
       6                 :            : 
       7                 :            : /* enlarge token buffer to tokenize whole strings */
       8                 :            : #undef YYLMAX
       9                 :            : #define YYLMAX 64000
      10                 :            : 
      11                 :            : /* to enable debug output define LEXDEBUG */
      12                 :            : #define LEXDEBUG                1
      13                 :            : #ifdef LEXDEBUG
      14                 :            : #define OUTPUT  fprintf
      15                 :            : #else
      16                 :            : #define OUTPUT(Par1,Par2);
      17                 :            : #endif
      18                 :            : 
      19                 :            : /* table of possible token ids */
      20                 :            : #include "tokens.h"
      21                 :            : #include <stdlib.h>
      22                 :            : #include <stdio.h>
      23                 :            : 
      24                 :            : #include "sal/main.h"
      25                 :            : 
      26                 :            : #if defined __GNUC__
      27                 :            : #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))
      28                 :            : #pragma GCC diagnostic ignored "-Wunused-function"
      29                 :            : #pragma GCC diagnostic ignored "-Wunused-label"
      30                 :            : #endif
      31                 :            : #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
      32                 :            : #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
      33                 :            : #endif
      34                 :            : #elif defined __SINPRO_CC
      35                 :            : #pragma disable_warn
      36                 :            : #elif defined _MSC_VER
      37                 :            : #pragma warning(push, 1)
      38                 :            : #endif
      39                 :            : 
      40                 :            : int yycolumn = 1;
      41                 :            : #define YY_USER_ACTION yycolumn += yyleng;
      42                 :            : 
      43                 :            : /* external functions (C++ code, declared as extern "C" */
      44                 :            : extern "C" void workOnTokenSet( int, char* );
      45                 :            : extern "C" FILE * init(int, char **);
      46                 :            : 
      47                 :            : int bText=0;
      48                 :            : %}
      49                 :            : 
      50                 :            : %option yylineno
      51                 :            : %option never-interactive
      52                 :            : 
      53                 :            : %p 24000
      54                 :            : %e 1200
      55                 :            : %n 500
      56                 :            : 
      57                 :            : %%
      58                 :            : 
      59                 :            : \<[^\>]*"xml:lang="\""x-no-translate"\"[^\<]*\/\>     {
      60                 :          0 :         bText = 0;
      61                 :          0 :         workOnTokenSet( CFG_TOKEN_NO_TRANSLATE, yytext );
      62                 :            : }
      63                 :          0 : 
      64                 :            : \<.*\/\> {
      65                 :          0 :         bText = 0;
      66                 :          0 :         workOnTokenSet( ANYTOKEN, yytext );
      67                 :            : }
      68                 :          0 : 
      69                 :            : \<[^\>]*"xml:lang="\".*\"[^\<]*\>       {
      70                 :          0 :         bText = 1;
      71                 :          0 :         workOnTokenSet( CFG_TEXT_START, yytext );
      72                 :            : }
      73                 :          0 : 
      74                 :            : 
      75                 :            : \<[^\/\!][^\>]*\>      {
      76                 :          0 :         bText = 0;
      77                 :          0 :         workOnTokenSet( CFG_TAG, yytext );
      78                 :            : }
      79                 :          0 : 
      80                 :            : "<!"DOCTYPE[^\>]*\>  {
      81                 :          0 :         bText = 0;
      82                 :          0 :         workOnTokenSet( CFG_TAG, yytext );
      83                 :            : }
      84                 :          0 : 
      85                 :            : 
      86                 :          0 : \<\!\-\-     {
      87                 :          0 :         char c1 = 0, c2 = 0, c3 = yyinput();
      88                 :            :         char pChar[2];
      89                 :          0 :         pChar[1] = 0x00;
      90                 :          0 :         pChar[0] = c3;
      91                 :            : 
      92                 :          0 :         workOnTokenSet( COMMEND, yytext );
      93                 :          0 :         workOnTokenSet( COMMEND, pChar );
      94                 :            : 
      95                 :          0 :         for(;;) {
      96                 :          0 :                 if ( c3 == EOF )
      97                 :          0 :                         break;
      98                 :          0 :                 if ( c1 == '-' && c2 == '-' && c3 == '>' )
      99                 :          0 :                         break;
     100                 :          0 :                 c1 = c2;
     101                 :          0 :                 c2 = c3;
     102                 :          0 :                 c3 = yyinput();
     103                 :            : 
     104                 :          0 :                 pChar[0] = c3;
     105                 :          0 :                 workOnTokenSet( COMMEND, pChar );
     106                 :            :         }
     107                 :            : }
     108                 :          0 : 
     109                 :            : \<\/[^\>]*\> {
     110                 :          0 :         bText = 0;
     111                 :          0 :         workOnTokenSet( CFG_CLOSETAG, yytext );
     112                 :            : }
     113                 :          0 : 
     114                 :            : \<[^\>\!]*\> {
     115                 :          0 :         bText = 0;
     116                 :          0 :         if ( yytext[ 1 ] == '!' && yytext[ 2 ] == '-' && yytext[ 3 ] == '-' )
     117                 :          0 :                 workOnTokenSet( COMMEND, yytext );
     118                 :            :         else
     119                 :          0 :                 workOnTokenSet( CFG_UNKNOWNTAG, yytext );
     120                 :            : }
     121                 :          0 : 
     122                 :            : .|\n {
     123                 :          0 :     yycolumn = 1;
     124                 :          0 :         if ( bText == 1 )
     125                 :          0 :                 workOnTokenSet( CFG_TEXTCHAR, yytext );
     126                 :            :         else
     127                 :          0 :                 workOnTokenSet( UNKNOWNCHAR, yytext );
     128                 :            : }
     129                 :          0 : 
     130                 :            : 
     131                 :          0 : %%
     132                 :          0 : 
     133                 :            : /*****************************************************************************/
     134                 :            : int     yywrap(void)
     135                 :          0 : /*****************************************************************************/
     136                 :            : {
     137                 :            :         return 1;
     138                 :          0 : }
     139                 :            : 
     140                 :            : /*****************************************************************************/
     141                 :            : void YYWarning( const char *s )
     142                 :          0 : /*****************************************************************************/
     143                 :            : {
     144                 :            :         /* write warning to stderr */
     145                 :            :         fprintf( stderr,
     146                 :            :                 "Warning: \"%s\" in line %d, column %d: \"%s\"\n", s, yylineno, yycolumn, yytext  );
     147                 :          0 : }
     148                 :          0 : 
     149                 :            : /*****************************************************************************/
     150                 :            : void yyerror ( const char *s )
     151                 :          0 : /*****************************************************************************/
     152                 :            : {
     153                 :            :         /* write error to stderr */
     154                 :            :         fprintf( stderr,
     155                 :            :                 "Error: \"%s\" in line %d, column %d: \"%s\"\n", s, yylineno, yycolumn, yytext  );
     156                 :          0 :         exit(EXIT_FAILURE);
     157                 :          0 : }
     158                 :            : 
     159                 :            : SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
     160                 :          0 :     yyin = init(argc, argv);
     161                 :          0 :     yylex();
     162                 :          0 :     return EXIT_SUCCESS;
     163                 :          0 : }

Generated by: LCOV version 1.10