LCOV - code coverage report
Current view: top level - basic/source/inc - scanner.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 16 18 88.9 %
Date: 2012-08-25 Functions: 16 18 88.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #ifndef _SCANNER_HXX
      21                 :            : #define _SCANNER_HXX
      22                 :            : 
      23                 :            : #include <basic/sberrors.hxx>
      24                 :            : 
      25                 :            : // The scanner is stand-alone, i. e. it can be used from everywhere.
      26                 :            : // A BASIC-instance is necessary for error messages. Without BASIC
      27                 :            : // the errors are only counted. Also the BASIC is necessary when an
      28                 :            : // advanced SBX-variable shall be used for data type recognition etc.
      29                 :            : 
      30                 :            : class StarBASIC;
      31                 :            : 
      32                 :       1037 : class SbiScanner
      33                 :            : {
      34                 :            :     ::rtl::OUString   aBuf;             // input buffer
      35                 :            :     ::rtl::OUString   aLine;
      36                 :            :     const sal_Unicode* pLine;
      37                 :            :     const sal_Unicode* pSaveLine;
      38                 :            : 
      39                 :            :     void scanAlphanumeric();
      40                 :            :     void scanGoto();
      41                 :            :     bool readLine();
      42                 :            : protected:
      43                 :            :     ::rtl::OUString aSym;
      44                 :            :     ::rtl::OUString aError;
      45                 :            :     SbxDataType eScanType;
      46                 :            :     StarBASIC* pBasic;                  // instance for error callbacks
      47                 :            :     double nVal;                        // numeric value
      48                 :            :     sal_Int32 nCurCol1;
      49                 :            :     sal_Int32 nSavedCol1;
      50                 :            :     sal_Int32 nCol;
      51                 :            :     sal_Int32 nErrors;
      52                 :            :     sal_Int32 nColLock;                    // lock counter for Col1
      53                 :            :     sal_Int32 nBufPos;
      54                 :            :     sal_Int32 nLine;
      55                 :            :     sal_Int32 nCol1, nCol2;
      56                 :            :     bool   bSymbol;                     // true: symbol scanned
      57                 :            :     bool   bNumber;                     // true: number scanned
      58                 :            :     bool   bSpaces;                     // true: whitespace before token
      59                 :            :     bool   bAbort;
      60                 :            :     bool   bHash;                       // true: # has been read in
      61                 :            :     bool   bError;                      // true: generate error
      62                 :            :     bool   bCompatible;                 // true: OPTION compatible
      63                 :            :     bool   bVBASupportOn;               // true: OPTION VBASupport 1 otherwise default False
      64                 :            :     bool   bPrevLineExtentsComment;     // true: Previous line is comment and ends on "... _"
      65                 :            : 
      66                 :            :     bool   bInStatement;
      67                 :            :     void   GenError( SbError );
      68                 :            : public:
      69                 :            :     SbiScanner( const ::rtl::OUString&, StarBASIC* = NULL );
      70                 :            :    ~SbiScanner();
      71                 :            : 
      72                 :       7510 :     void  EnableErrors()            { bError = false; }
      73                 :         30 :     bool  IsHash()                  { return bHash;   }
      74                 :         42 :     bool  IsCompatible()            { return bCompatible; }
      75                 :        624 :     void  SetCompatible( bool b )   { bCompatible = b; }        // #118206
      76                 :       8165 :     bool  IsVBASupportOn()          { return bVBASupportOn; }
      77                 :            :     void  SetVBASupportOn( bool b ) { bVBASupportOn = b; }
      78                 :       5295 :     bool  WhiteSpace()              { return bSpaces; }
      79                 :        465 :     sal_Int32 GetErrors()           { return nErrors; }
      80                 :       4599 :     sal_Int32 GetLine()             { return nLine;   }
      81                 :       4047 :     sal_Int32 GetCol1()             { return nCol1;   }
      82                 :        965 :     sal_Int32 GetCol2()             { return nCol2;   }
      83                 :          0 :     void  SetCol1( sal_Int32 n )    { nCol1 = n;      }
      84                 :       1690 :     StarBASIC* GetBasic()           { return pBasic;  }
      85                 :       1054 :     void  SaveLine(void)            { pSaveLine = pLine; }
      86                 :          0 :     void  RestoreLine(void)         { pLine = pSaveLine; }
      87                 :            :     void  LockColumn();
      88                 :            :     void  UnlockColumn();
      89                 :            :     bool  DoesColonFollow();
      90                 :            : 
      91                 :            :     bool NextSym();
      92                 :       8449 :     const ::rtl::OUString& GetSym() { return aSym;  }
      93                 :       7793 :     SbxDataType GetType()           { return eScanType; }
      94                 :       1516 :     double    GetDbl()              { return nVal;  }
      95                 :            : };
      96                 :            : 
      97                 :            : #endif
      98                 :            : 
      99                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10