ParserBase.h

// ParserBase.h
//
// Author David Barrett-Lennard
// (C)opyright Cedanet Pty Ltd 2006

#pragma once
#ifndef Ceda_cxMacroExpander_ParserBase_H
#define Ceda_cxMacroExpander_ParserBase_H

#include "cxMacroExpander.h"
#include "LSToken.h"
#include "Ceda/cxUtils/xstring.h"

namespace ceda
{

///////////////////////////////////////////////////////////////////////////////////////////////////
// ParserBase

class cxMacroExpander_API ParserBase
{
public:
    ParserBase();

    void Init(SubString s);

    void ReadNextToken();

    EToken GetTokenType() { return m_token.GetType(); }
    LSToken& GetToken() { return m_token; }
    xstring GetTokenString() { return m_token.GetTokenString(); }

    void ThrowExpectedException(ConstStringZ expected);
    void ParseGivenToken(EToken token, ConstStringZ desc);
    xstring ParseIdentifier();
    xstring ParsePath();     // Path is delimited by forward slashes

public:
    // Current token
    xstring m_stringForToken;
    LSToken m_token;
    
    LSToken m_prevToken;

    SubString m_str;
};

} // namespace ceda

#endif // include guard