LCOV - code coverage report
Current view: top level - basic/source/inc - parser.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1 100.0 %
Date: 2012-08-25 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 8 16 50.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 _PARSER_HXX
      21                 :            : #define _PARSER_HXX
      22                 :            : 
      23                 :            : #include "expr.hxx"
      24                 :            : #include "codegen.hxx"
      25                 :            : #include "symtbl.hxx"
      26                 :            : 
      27                 :            : 
      28                 :            : #include <vector>
      29                 :            : typedef ::std::vector< String > StringVector;
      30                 :            : 
      31                 :            : struct SbiParseStack;
      32                 :            : 
      33 [ +  - ][ +  - ]:         65 : class SbiParser : public SbiTokenizer
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      34                 :            : {
      35                 :            :     friend class SbiExpression;
      36                 :            : 
      37                 :            :     SbiParseStack* pStack;
      38                 :            :     SbiProcDef* pProc;
      39                 :            :     SbiExprNode*  pWithVar;
      40                 :            :     SbiToken    eEndTok;
      41                 :            :     sal_uInt32      nGblChain;          // for global DIMs
      42                 :            :     bool        bGblDefs;           // true: global definitions general
      43                 :            :     bool        bNewGblDefs;        // true: globale definitions before sub
      44                 :            :     bool        bSingleLineIf;
      45                 :            : 
      46                 :            :     SbiSymDef*  VarDecl( SbiDimList**, bool, bool );
      47                 :            :     SbiProcDef* ProcDecl(bool bDecl);
      48                 :            :     void DefStatic( bool bPrivate );
      49                 :            :     void DefProc( bool bStatic, bool bPrivate ); // read in procedure
      50                 :            :     void DefVar( SbiOpcode eOp, bool bStatic ); // read in DIM/REDIM
      51                 :            :     void TypeDecl( SbiSymDef&, bool bAsNewAlreadyParsed=false );    // AS-declaration
      52                 :            :     void OpenBlock( SbiToken, SbiExprNode* = NULL );
      53                 :            :     void CloseBlock();
      54                 :            :     bool Channel( bool bAlways=false );     // parse channel number
      55                 :            :     void StmntBlock( SbiToken );
      56                 :            :     void DefType( bool bPrivate );  // Parse type declaration
      57                 :            :     void DefEnum( bool bPrivate );  // Parse enum declaration
      58                 :            :     void DefDeclare( bool bPrivate );
      59                 :            :     void EnableCompatibility();
      60                 :            : public:
      61                 :            :     SbxArrayRef   rTypeArray;
      62                 :            :     SbxArrayRef   rEnumArray;
      63                 :            :     SbiStringPool aGblStrings;      // string-pool
      64                 :            :     SbiStringPool aLclStrings;      // string-pool
      65                 :            :     SbiSymPool    aGlobals;
      66                 :            :     SbiSymPool    aPublics;         // module global
      67                 :            :     SbiSymPool    aRtlSyms;         // Runtime-Library
      68                 :            :     SbiCodeGen    aGen;             // Code-Generator
      69                 :            :     StarBASIC*    pBasic;           // StarBASIC instance
      70                 :            :     SbiSymPool*   pPool;
      71                 :            :     SbiExprType   eCurExpr;
      72                 :            :     short         nBase;            // OPTION BASE-value
      73                 :            :     bool          bText;            // OPTION COMPARE TEXT
      74                 :            :     bool          bExplicit;        // true: OPTION EXPLICIT
      75                 :            :     bool          bClassModule;     // true: OPTION ClassModule
      76                 :            :     StringVector  aIfaceVector;     // Holds all interfaces implemented by a class module
      77                 :            :     StringVector  aRequiredTypes;   // Types used in Dim As New <type> outside subs
      78                 :            :     SbxDataType   eDefTypes[26];    // DEFxxx data types
      79                 :            : 
      80                 :            :     SbiParser( StarBASIC*, SbModule* );
      81                 :            :     bool Parse();
      82                 :            :     SbiExprNode* GetWithVar();
      83                 :            : 
      84                 :            :     // from 31.3.1996, search symbol in the runtime-library
      85                 :            :     SbiSymDef* CheckRTLForSym( const String& rSym, SbxDataType eType );
      86                 :            :     void AddConstants( void );
      87                 :            : 
      88                 :            :     bool HasGlobalCode();
      89                 :            : 
      90                 :            :     bool TestToken( SbiToken );
      91                 :            :     bool TestSymbol( bool bKwdOk=false );
      92                 :            :     bool TestComma();
      93                 :            :     void TestEoln();
      94                 :            : 
      95                 :            :     void Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo = NULL );  // let or call
      96                 :            :     void ErrorStmnt();              // ERROR n
      97                 :            :     void NotImp();                  // not implemented
      98                 :            :     void BadBlock();                // LOOP/WEND/NEXT
      99                 :            :     void BadSyntax();               // wrong SbiToken
     100                 :            :     void NoIf();                    // ELSE/ELSE IF without IF
     101                 :            :     void Assign();                  // LET
     102                 :            :     void Attribute();
     103                 :            :     void Call();                    // CALL
     104                 :            :     void Close();                   // CLOSE
     105                 :            :     void Declare();                 // DECLARE
     106                 :            :     void DefXXX();                  // DEFxxx
     107                 :            :     void Dim();                     // DIM
     108                 :            :     void ReDim();                   // ReDim();
     109                 :            :     void Erase();                   // ERASE
     110                 :            :     void Exit();                    // EXIT
     111                 :            :     void For();                     // FOR...NEXT
     112                 :            :     void Goto();                    // GOTO / GOSUB
     113                 :            :     void If();                      // IF
     114                 :            :     void Implements();              // IMPLEMENTS
     115                 :            :     void Input();                   // INPUT, INPUT #
     116                 :            :     void Line();                    // LINE -> LINE INPUT [#] (#i92642)
     117                 :            :     void LineInput();               // LINE INPUT, LINE INPUT #
     118                 :            :     void LSet();                    // LSET
     119                 :            :     void Name();                    // NAME .. AS ..
     120                 :            :     void On();                      // ON ERROR/variable
     121                 :            :     void OnGoto();                  // ON...GOTO / GOSUB
     122                 :            :     void Open();                    // OPEN
     123                 :            :     void Option();                  // OPTION
     124                 :            :     void Print();                   // PRINT, PRINT #
     125                 :            :     void SubFunc();                 // SUB / FUNCTION
     126                 :            :     void Resume();                  // RESUME
     127                 :            :     void Return();                  // RETURN
     128                 :            :     void RSet();                    // RSET
     129                 :            :     void DoLoop();                  // DO...LOOP
     130                 :            :     void Select();                  // SELECT ... CASE
     131                 :            :     void Set();                     // SET
     132                 :            :     void Static();                  // STATIC
     133                 :            :     void Stop();                    // STOP/SYSTEM
     134                 :            :     void Type();                    // TYPE...AS...END TYPE
     135                 :            :     void Enum();                    // TYPE...END ENUM
     136                 :            :     void While();                   // WHILE/WEND
     137                 :            :     void With();                    // WITH
     138                 :            :     void Write();                   // WRITE
     139                 :            : };
     140                 :            : 
     141                 :            : 
     142                 :            : 
     143                 :            : 
     144                 :            : 
     145                 :            : 
     146                 :            : #endif
     147                 :            : 
     148                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10