[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/salvo-polizzi/lpython/main/src/lpython/parser/parser.h [Back]  [Original]

#ifndef LPYTHON_PARSER_PARSER_H
#define LPYTHON_PARSER_PARSER_H

#include 
#include 
#include 

namespace LCompilers::LPython {

class Parser
{
public:
    std::string inp;

public:
    diag::Diagnostics &diag;
    Allocator &m_a;
    Tokenizer m_tokenizer;
    Vec result;
    Vec type_ignore;

    Parser(Allocator &al, diag::Diagnostics &diagnostics)
            : diag{diagnostics}, m_a{al} {
        result.reserve(al, 32);
        type_ignore.reserve(al, 4);
    }

    void parse(const std::string &input, uint32_t prev_loc);
    void handle_yyerror(const Location &loc, const std::string &msg);
};


// Parses Python code to AST
Result parse(Allocator &al,
    const std::string &s, uint32_t prev_loc,
    diag::Diagnostics &diagnostics);

Result parse_python_file(Allocator &al,
        const std::string &runtime_library_dir,
        const std::string &infile,
        diag::Diagnostics &diagnostics,
        uint32_t prev_loc, bool new_parser);

} // namespace LCompilers::LPython

#endif

Web Proxy Viewer  |  New URL  |  Original Page