LCOV - code coverage report
Current view: top level - basic/source/inc - parser.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 2 2 100.0 %
Date: 2015-06-13 12:38:46 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11