1#ifndef NEWLANG_PARSER_H_
2#define NEWLANG_PARSER_H_
9#include "llvm/Support/Path.h"
10#include "llvm/Support/FileSystem.h"
75 void error(
const class location& l,
const std::string& m);
79 void error(
const std::string &m);
112 TermPtr Parse(
const std::string str,
bool expand_module =
false);
119 inline static bool IsBracket(
const std::string_view str) {
120 return str.size() > 0 && (str[0] ==
'(' || str[0] ==
'[' || str[0] ==
'<');
void error(const class location &l, const std::string &m)
TermPtr Parse(const std::string str, bool expand_module=false)
static size_t SkipBrackets(const BlockType &buffer, size_t offset)
std::istringstream m_stream
bool RegisterPredefMacro(const char *name, const char *desc)
Parser(MacroPtr macro=nullptr, PostLexerType *postlex=nullptr, DiagPtr diag=nullptr, bool pragma_enable=true, RunTime *rt=nullptr)
bool PragmaCheck(const TermPtr &term)
static size_t ParseTerm(TermPtr &term, const BlockType &buffer, const size_t skip=0, bool pragma_enable=true)
std::map< std::string, std::string > m_predef_macro
void AstAddTerm(TermPtr &term)
static std::string GetCurrentTimeStampISO(time_t ts=std::time(NULL))
bool trace_parsing
enable debug output in the bison parser
std::string m_name_module
std::vector< ParserLocation > m_loc_stack
bool PragmaEval(const TermPtr &term, BlockType &buffer, BlockType &seq)
static std::string GetCurrentDate(time_t ts=std::time(NULL))
static std::string GetCurrentTime(time_t ts=std::time(NULL))
PostLexerType * m_postlex
static bool IsBracket(const std::string_view str)
bool trace_scanning
enable debug output in the flex scanner
parser::token_type GetNextToken(TermPtr *yylval, parser::location_type *yylloc)
parser::token_type ExpandPredefMacro(TermPtr &term)
static std::string GetCurrentTimeStamp(time_t ts=std::time(NULL))
bool CheckPredefMacro(const TermPtr &term)
TermPtr CheckModuleTerm(const TermPtr &term)
std::string m_filename
stream name (file or input stream) used for error messages.
bool PragmaStaticAssert(const TermPtr &term)
TermPtr ParseFile(const std::string_view filename)
parser::location_type m_location
BlockType m_macro_analisys_buff
Последовательность лексем для анализа на наличие макросов
static ObjPtr StaticEval(const TermPtr &term)
std::vector< std::string > PostLexerType
std::shared_ptr< Term > TermPtr
std::shared_ptr< Obj > ObjPtr
ExpandMacroResult ExpandTermMacro(Parser &parser)
std::shared_ptr< Macro > MacroPtr
std::vector< TermPtr > BlockType
std::shared_ptr< Diag > DiagPtr
TermPtr ProcessMacro(Parser &parser, TermPtr &term)
parser::location_type location