pytorch/torch/csrc/jit/script/parser.h
James Reed dd046bef8d NamedTuple serialization (#21839)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/21839
ghimport-source-id: b9d82018fbf26b22d58cad3a033cbfe4e879a8fe

Test Plan: Imported from OSS

Reviewed By: zdevito

Differential Revision: D15860002

Pulled By: jamesr66a

fbshipit-source-id: 0fc97c4adefa9ae4937f21179c7afa817f4099e5
2019-06-19 10:43:55 -07:00

36 lines
729 B
C++

#pragma once
#include <torch/csrc/WindowsTorchApiMacro.h>
#include <torch/csrc/jit/script/tree.h>
#include <torch/csrc/jit/script/tree_views.h>
#include <memory>
namespace torch {
namespace jit {
namespace script {
struct Decl;
struct ParserImpl;
struct Lexer;
TORCH_API Decl mergeTypesFromTypeComment(
const Decl& decl,
const Decl& type_annotation_decl,
bool is_method);
struct TORCH_API Parser {
explicit Parser(const std::shared_ptr<Source>& src);
TreeRef parseFunction(bool is_method);
TreeRef parseClassLike();
Decl parseTypeComment();
Expr parseExp();
Lexer& lexer();
~Parser();
private:
std::unique_ptr<ParserImpl> pImpl;
};
} // namespace script
} // namespace jit
} // namespace torch