LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / basic / source / inc / parser.hxx
blob4e03e6d39058b7b803b3ddca73af0e9d343d2c60
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include "expr.hxx"
23 #include "codegen.hxx"
24 #include "symtbl.hxx"
25 #include <basic/sbx.hxx>
27 #include <vector>
29 struct SbiParseStack;
31 class SbiParser : public SbiTokenizer
33 friend class SbiExpression;
35 SbiParseStack* pStack;
36 SbiProcDef* pProc;
37 SbiExprNode* pWithVar;
38 SbiToken eEndTok;
39 sal_uInt32 nGblChain; // for global DIMs
40 bool bGblDefs; // true: global definitions general
41 bool bNewGblDefs; // true: globale definitions before sub
42 bool bSingleLineIf;
43 bool bCodeCompleting;
45 SbiSymDef* VarDecl( SbiExprListPtr*, bool, bool );
46 SbiProcDef* ProcDecl(bool bDecl);
47 void DefStatic( bool bPrivate );
48 void DefProc( bool bStatic, bool bPrivate ); // read in procedure
49 void DefVar( SbiOpcode eOp, bool bStatic ); // read in DIM/REDIM
50 void TypeDecl( SbiSymDef&, bool bAsNewAlreadyParsed=false ); // AS-declaration
51 void OpenBlock( SbiToken, SbiExprNode* = nullptr );
52 void CloseBlock();
53 bool Channel( bool bAlways=false ); // parse channel number
54 void StmntBlock( SbiToken );
55 void DefType(); // Parse type declaration
56 void DefEnum( bool bPrivate ); // Parse enum declaration
57 void DefDeclare( bool bPrivate );
58 void EnableCompatibility();
59 static bool IsUnoInterface( const OUString& sTypeName );
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 SbiSymPool* pPool;
70 short nBase; // OPTION BASE-value
71 bool bExplicit; // true: OPTION EXPLICIT
72 bool bClassModule; // true: OPTION ClassModule
73 std::vector<OUString> aIfaceVector; // Holds all interfaces implemented by a class module
74 std::vector<OUString> aRequiredTypes; // Types used in Dim As New <type> outside subs
75 # define N_DEF_TYPES 26
76 SbxDataType eDefTypes[N_DEF_TYPES]; // DEFxxx data types
78 SbiParser( StarBASIC*, SbModule* );
79 ~SbiParser( );
80 bool Parse();
81 void SetCodeCompleting( bool b );
82 bool IsCodeCompleting() const { return bCodeCompleting;}
83 SbiExprNode* GetWithVar();
85 // from 31.3.1996, search symbol in the runtime-library
86 SbiSymDef* CheckRTLForSym( const OUString& rSym, SbxDataType eType );
87 void AddConstants();
89 bool HasGlobalCode();
91 bool TestToken( SbiToken );
92 bool TestSymbol();
93 bool TestComma();
94 void TestEoln();
96 void Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo ); // let or call
97 void ErrorStmnt(); // ERROR n
98 void BadBlock(); // LOOP/WEND/NEXT
99 void NoIf(); // ELSE/ELSE IF without IF
100 void Assign(); // LET
101 void Attribute();
102 void Call(); // CALL
103 void Close(); // CLOSE
104 void Declare(); // DECLARE
105 void DefXXX(); // DEFxxx
106 void Dim(); // DIM
107 void ReDim(); // ReDim();
108 void Erase(); // ERASE
109 void Exit(); // EXIT
110 void For(); // FOR...NEXT
111 void Goto(); // GOTO / GOSUB
112 void If(); // IF
113 void Implements(); // IMPLEMENTS
114 void Input(); // INPUT, INPUT #
115 void Line(); // LINE -> LINE INPUT [#] (#i92642)
116 void LineInput(); // LINE INPUT, LINE INPUT #
117 void LSet(); // LSET
118 void Name(); // NAME .. AS ..
119 void On(); // ON ERROR/variable
120 void OnGoto(); // ON...GOTO / GOSUB
121 void Open(); // OPEN
122 void Option(); // OPTION
123 void Print(); // PRINT, PRINT #
124 void SubFunc(); // SUB / FUNCTION
125 void Resume(); // RESUME
126 void Return(); // RETURN
127 void RSet(); // RSET
128 void DoLoop(); // DO...LOOP
129 void Select(); // SELECT ... CASE
130 void Set(); // SET
131 void Static(); // STATIC
132 void Stop(); // STOP/SYSTEM
133 void Type(); // TYPE...AS...END TYPE
134 void Enum(); // TYPE...END ENUM
135 void While(); // WHILE/WEND
136 void With(); // WITH
137 void Write(); // WRITE
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */