// THIS FILE IS GENERATED
// WARNING! All changes made in this file will be lost!

#ifndef PHP_H_INCLUDED
#define PHP_H_INCLUDED

#include "phptokentype.h"
#include "phpast-fwd.h"
#include <kdev-pg-memory-pool.h>
#include <kdev-pg-allocator.h>
#include "tokenstream.h"
#include "QtCore/QString"
#include "language/duchain/problem.h"
#include "phplexer.h"

#include "parserexport.h"
namespace Php
{

class KDEVPHPPARSER_EXPORT Parser : public TokenTypeWrapper
{
public:
    typedef TokenStream::Token Token;
    TokenStream *tokenStream;
    int yytoken;

    inline Token LA(qint64 k = 1) const
    {
        qint64 idx = tokenStream->index() - 1 + k - 1;
        qint64 oldidx = tokenStream->index();
        tokenStream->rewind(tokenStream->size());
        while (idx >= tokenStream->size()) tokenStream->read();
        tokenStream->rewind(oldidx);
        return tokenStream->at(idx);
    }
    inline int yylex()
    {
        yytoken = tokenStream->read().kind;
        return yytoken;
    }
    inline void rewind(qint64 index)
    {
        tokenStream->rewind(index);
        yylex();
    }

// token stream
    void setTokenStream(TokenStream *s)
    {
        tokenStream = s;
    }

// error handling
    void expectedSymbol(int kind, const QString& name);
    void expectedToken(int kind, qint64 token, const QString& name);

    bool mBlockErrors;
    inline bool blockErrors(bool block)
    {
        bool previous = mBlockErrors;
        mBlockErrors = block;
        return previous;
    }

// memory pool
    typedef KDevPG::MemoryPool memoryPoolType;

    KDevPG::MemoryPool *memoryPool;
    void setMemoryPool(KDevPG::MemoryPool *p)
    {
        memoryPool = p;
    }
    template <class T>
    inline T *create()
    {
        T *node = new (memoryPool->allocate(sizeof(T))) T();
        node->kind = T::KIND;
        return node;
    }
    template <class T>
    inline T *create(AstNode *u)
    {
        T *node = new (memoryPool->allocate(sizeof(T))) T(u);
        node->kind = T::KIND;
        return node;
    }

// user defined declarations:
public:

# 93 "/home/abuild/rpmbuild/BUILD/umbrello-19.08.3/build/lib/kdev4-php/parser/phpparser.h"
# 152 "/home/abuild/rpmbuild/BUILD/umbrello-19.08.3/lib/kdev4-php/parser/php.g" 1
  
  /**
   * Transform the raw input into tokens.
   * When this method returns, the parser's token stream has been filled
   * and any parse*() method can be called.
   */
  void tokenize(const QString& contents, int initialState = Lexer::HtmlState);
 
  enum ProblemType {
      Error,
      Warning,
      Info
  };
  void reportProblem( Parser::ProblemType type, const QString& message, int tokenOffset = -1 );
  QList<KDevelop::ProblemPointer> problems() {
      return m_problems;
  }
  QString tokenText(qint64 begin, qint64 end);
  void setDebug(bool debug);
  void setCurrentDocument(KDevelop::IndexedString url);
 
    enum InitialLexerState {
        HtmlState = 0,
        DefaultState = 1
    };
 
 
# 120 "/home/abuild/rpmbuild/BUILD/umbrello-19.08.3/build/lib/kdev4-php/parser/phpparser.h" 2

private:

# 126 "/home/abuild/rpmbuild/BUILD/umbrello-19.08.3/build/lib/kdev4-php/parser/phpparser.h"
# 181 "/home/abuild/rpmbuild/BUILD/umbrello-19.08.3/lib/kdev4-php/parser/php.g" 1
  
    enum VarExpressionState {
        Normal,
        OnlyVariable,
        OnlyNewObject
    };
    QString m_contents;
    bool m_debug;
    KDevelop::IndexedString m_currentDocument;
    QList<KDevelop::ProblemPointer> m_problems;
 
    struct ParserState {
        VarExpressionState varExpressionState;
        bool varExpressionIsVariable;
    };
    ParserState m_state;
 
# 143 "/home/abuild/rpmbuild/BUILD/umbrello-19.08.3/build/lib/kdev4-php/parser/phpparser.h" 2


public:
// The copyCurrentState() and restoreState() methods are only declared
// if you are using try blocks in your grammar, and have to be
// implemented by yourself, and you also have to define a
// "struct ParserState" inside a %parserclass directive.

// This method should create a new ParserState object and return it,
// or return 0 if no state variables need to be saved.
    ParserState *copyCurrentState();

// This method is only called for ParserState objects != 0
// and should restore the parser state given as argument.
    void restoreState(ParserState *state);
    Parser()
    {
        memoryPool = 0;
        tokenStream = 0;
        yytoken = Token_EOF;
        mBlockErrors = false;

// user defined constructor code:

# 170 "/home/abuild/rpmbuild/BUILD/umbrello-19.08.3/build/lib/kdev4-php/parser/phpparser.h"
# 200 "/home/abuild/rpmbuild/BUILD/umbrello-19.08.3/lib/kdev4-php/parser/php.g" 1
  
    m_state.varExpressionState = Normal;
    m_state.varExpressionIsVariable = false;
 
# 174 "/home/abuild/rpmbuild/BUILD/umbrello-19.08.3/build/lib/kdev4-php/parser/phpparser.h" 2

    }

    virtual ~Parser() {}

    bool parseAdditiveExpression(AdditiveExpressionAst **yynode);
    bool parseAdditiveExpressionRest(AdditiveExpressionRestAst **yynode);
    bool parseArrayIndexSpecifier(ArrayIndexSpecifierAst **yynode);
    bool parseArrayPairValue(ArrayPairValueAst **yynode);
    bool parseAssignmentExpression(AssignmentExpressionAst **yynode);
    bool parseAssignmentExpressionCheckIfVariable(AssignmentExpressionCheckIfVariableAst **yynode);
    bool parseAssignmentExpressionEqual(AssignmentExpressionEqualAst **yynode);
    bool parseAssignmentList(AssignmentListAst **yynode);
    bool parseAssignmentListElement(AssignmentListElementAst **yynode);
    bool parseBaseVariable(BaseVariableAst **yynode);
    bool parseBaseVariableWithFunctionCalls(BaseVariableWithFunctionCallsAst **yynode);
    bool parseBitAndExpression(BitAndExpressionAst **yynode);
    bool parseBitOrExpression(BitOrExpressionAst **yynode);
    bool parseBitXorExpression(BitXorExpressionAst **yynode);
    bool parseBooleanAndExpression(BooleanAndExpressionAst **yynode);
    bool parseBooleanOrExpression(BooleanOrExpressionAst **yynode);
    bool parseCaseList(CaseListAst **yynode);
    bool parseCase_item(Case_itemAst **yynode);
    bool parseCatchItem(CatchItemAst **yynode);
    bool parseClassBody(ClassBodyAst **yynode);
    bool parseClassDeclarationStatement(ClassDeclarationStatementAst **yynode);
    bool parseClassExtends(ClassExtendsAst **yynode);
    bool parseClassImplements(ClassImplementsAst **yynode);
    bool parseClassNameReference(ClassNameReferenceAst **yynode);
    bool parseClassStatement(ClassStatementAst **yynode);
    bool parseClassVariable(ClassVariableAst **yynode);
    bool parseClassVariableDeclaration(ClassVariableDeclarationAst **yynode);
    bool parseClosure(ClosureAst **yynode);
    bool parseCommonScalar(CommonScalarAst **yynode);
    bool parseCompoundVariable(CompoundVariableAst **yynode);
    bool parseCompoundVariableWithSimpleIndirectReference(CompoundVariableWithSimpleIndirectReferenceAst **yynode);
    bool parseConditionalExpression(ConditionalExpressionAst **yynode);
    bool parseConstantDeclaration(ConstantDeclarationAst **yynode);
    bool parseConstantOrClassConst(ConstantOrClassConstAst **yynode);
    bool parseCtorArguments(CtorArgumentsAst **yynode);
    bool parseDeclareItem(DeclareItemAst **yynode);
    bool parseDeclareStatement(DeclareStatementAst **yynode);
    bool parseDimListItem(DimListItemAst **yynode);
    bool parseDynamicClassNameReference(DynamicClassNameReferenceAst **yynode);
    bool parseDynamicClassNameVariableProperties(DynamicClassNameVariablePropertiesAst **yynode);
    bool parseDynamicClassNameVariableProperty(DynamicClassNameVariablePropertyAst **yynode);
    bool parseElseSingle(ElseSingleAst **yynode);
    bool parseElseifList(ElseifListAst **yynode);
    bool parseElseifListItem(ElseifListItemAst **yynode);
    bool parseEncaps(EncapsAst **yynode);
    bool parseEncapsList(EncapsListAst **yynode);
    bool parseEncapsVar(EncapsVarAst **yynode);
    bool parseEncapsVarOffset(EncapsVarOffsetAst **yynode);
    bool parseEqualityExpression(EqualityExpressionAst **yynode);
    bool parseEqualityExpressionRest(EqualityExpressionRestAst **yynode);
    bool parseExpr(ExprAst **yynode);
    bool parseForExpr(ForExprAst **yynode);
    bool parseForStatement(ForStatementAst **yynode);
    bool parseForeachStatement(ForeachStatementAst **yynode);
    bool parseForeachVariable(ForeachVariableAst **yynode);
    bool parseFunctionCall(FunctionCallAst **yynode);
    bool parseFunctionCallParameterList(FunctionCallParameterListAst **yynode);
    bool parseFunctionCallParameterListElement(FunctionCallParameterListElementAst **yynode);
    bool parseFunctionDeclarationStatement(FunctionDeclarationStatementAst **yynode);
    bool parseGlobalVar(GlobalVarAst **yynode);
    bool parseIdentifier(IdentifierAst **yynode);
    bool parseInnerStatementList(InnerStatementListAst **yynode);
    bool parseInstantiationAccess(InstantiationAccessAst **yynode);
    bool parseInterfaceDeclarationStatement(InterfaceDeclarationStatementAst **yynode);
    bool parseLexicalVar(LexicalVarAst **yynode);
    bool parseLexicalVarList(LexicalVarListAst **yynode);
    bool parseLogicalAndExpression(LogicalAndExpressionAst **yynode);
    bool parseLogicalOrExpression(LogicalOrExpressionAst **yynode);
    bool parseLogicalXorExpression(LogicalXorExpressionAst **yynode);
    bool parseMethodBody(MethodBodyAst **yynode);
    bool parseMultiplicativeExpression(MultiplicativeExpressionAst **yynode);
    bool parseMultiplicativeExpressionRest(MultiplicativeExpressionRestAst **yynode);
    bool parseNamespaceDeclarationStatement(NamespaceDeclarationStatementAst **yynode);
    bool parseNamespacedIdentifier(NamespacedIdentifierAst **yynode);
    bool parseNewElseSingle(NewElseSingleAst **yynode);
    bool parseNewElseifList(NewElseifListAst **yynode);
    bool parseNewelseifListItem(NewelseifListItemAst **yynode);
    bool parseObjectDimList(ObjectDimListAst **yynode);
    bool parseObjectOperator(ObjectOperatorAst **yynode);
    bool parseObjectProperty(ObjectPropertyAst **yynode);
    bool parseOptionalClassModifier(OptionalClassModifierAst **yynode);
    bool parseOptionalModifiers(OptionalModifiersAst **yynode);
    bool parseOuterTopStatement(OuterTopStatementAst **yynode);
    bool parseParameter(ParameterAst **yynode);
    bool parseParameterList(ParameterListAst **yynode);
    bool parsePostprefixOperator(PostprefixOperatorAst **yynode);
    bool parsePrintExpression(PrintExpressionAst **yynode);
    bool parseRelationalExpression(RelationalExpressionAst **yynode);
    bool parseRelationalExpressionRest(RelationalExpressionRestAst **yynode);
    bool parseScalar(ScalarAst **yynode);
    bool parseSemicolonOrCloseTag(SemicolonOrCloseTagAst **yynode);
    bool parseShiftExpression(ShiftExpressionAst **yynode);
    bool parseShiftExpressionRest(ShiftExpressionRestAst **yynode);
    bool parseStart(StartAst **yynode);
    bool parseStatement(StatementAst **yynode);
    bool parseStaticArrayPairValue(StaticArrayPairValueAst **yynode);
    bool parseStaticMember(StaticMemberAst **yynode);
    bool parseStaticScalar(StaticScalarAst **yynode);
    bool parseStaticVar(StaticVarAst **yynode);
    bool parseStringIndexSpecifier(StringIndexSpecifierAst **yynode);
    bool parseSwitchCaseList(SwitchCaseListAst **yynode);
    bool parseTopStatement(TopStatementAst **yynode);
    bool parseTraitAliasDeclaration(TraitAliasDeclarationAst **yynode);
    bool parseTraitAliasIdentifier(TraitAliasIdentifierAst **yynode);
    bool parseTraitAliasStatement(TraitAliasStatementAst **yynode);
    bool parseTraitDeclarationStatement(TraitDeclarationStatementAst **yynode);
    bool parseUnaryExpression(UnaryExpressionAst **yynode);
    bool parseUnaryExpressionNotPlusminus(UnaryExpressionNotPlusminusAst **yynode);
    bool parseUseNamespace(UseNamespaceAst **yynode);
    bool parseVarExpression(VarExpressionAst **yynode);
    bool parseVarExpressionArray(VarExpressionArrayAst **yynode);
    bool parseVarExpressionNewObject(VarExpressionNewObjectAst **yynode);
    bool parseVarExpressionNormal(VarExpressionNormalAst **yynode);
    bool parseVariable(VariableAst **yynode);
    bool parseVariableIdentifier(VariableIdentifierAst **yynode);
    bool parseVariableName(VariableNameAst **yynode);
    bool parseVariableObjectProperty(VariableObjectPropertyAst **yynode);
    bool parseVariableProperty(VariablePropertyAst **yynode);
    bool parseVariableWithoutObjects(VariableWithoutObjectsAst **yynode);
    bool parseWhileStatement(WhileStatementAst **yynode);
};

} // end of namespace Php

#endif

