LRDE Tiger Compiler
1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
|
Conduct the scanner and the parser. More...
#include <tiger-parser.hh>
Public Types | |
typedef misc::variant < std::string, Tweast * > | input_type |
Public Member Functions | |
TigerParser (const misc::file_library &lib=misc::file_library()) | |
virtual | ~TigerParser () |
friend | YY_DECL_ (::) |
ast_type | parse_file (const std::string &name) |
Parse the Tiger file name. | |
ast_type | parse (Tweast &s) |
Parse the Tweast s. Extensions are enabled. | |
ast_type | parse (const std::string &s) |
Parse the string s. Extensions are automatically disabled. | |
ast::DecsList * | parse_import (const std::string &name, const location &loc) |
Parse a Tiger prelude, return the list of decs. | |
const misc::error & | error_get () const |
Return the error status of the parsing. | |
const char * | prelude () const |
The default prelude. | |
TigerParser & | scan_trace (bool b=true) |
Set the scanner traces. | |
TigerParser & | parse_trace (bool b=true) |
Set the parser traces. | |
TigerParser & | enable_object_extensions (bool b=true) |
Enable object extensions. | |
TigerParser & | enable_extensions (bool b=true) |
Enable syntax extensions. |
Public Attributes | |
location | location_ |
The location requesting the import. | |
input_type | input_ |
The source to parse. | |
misc::file_library | library_ |
The file library for imports. | |
bool | enable_object_extensions_p_ |
Allow object extensions? | |
bool | enable_extensions_p_ |
Allow language extensions (reserved identifiers, new keywords)? |
Private Attributes | |
Handling the scanner. | |
The scanner. | |
std::unique_ptr< yyFlexLexer > | scanner_ |
bool | scan_trace_p_ |
Verbose scanning? | |
std::map< std::string, location > | open_files_ |
The list of open files, and the location of their request. |
Friends | |
class | parser |
Running the parse. | |
ast_type | ast_ |
The result of the parse. | |
misc::error | error_ |
Parsing errors handler. | |
bool | parse_trace_p_ |
Verbose parsing? | |
ast_type | parse_ () |
Parse a Tiger file or string. | |
ast_type | parse_input (Tweast &input, bool extensions) |
ast::DecsList * | parse_prelude (const std::string &f) |
Parse a Tiger prelude f, return the list of decs. |
Conduct the scanner and the parser.
typedef misc::variant<std::string, Tweast*> parse::TigerParser::input_type |
The parsed object is either a file, represented by the filename or a Tweast.
parse::TigerParser::TigerParser | ( | const misc::file_library & | lib = misc::file_library() | ) |
|
virtual |
TigerParser & parse::TigerParser::enable_extensions | ( | bool | b = true | ) |
TigerParser & parse::TigerParser::enable_object_extensions | ( | bool | b = true | ) |
Enable object extensions.
References enable_object_extensions_p_.
Referenced by parse::parse(), and parse::parse_unit().
const misc::error & parse::TigerParser::error_get | ( | ) | const |
Return the error status of the parsing.
References error_.
Referenced by parse::parse(), and parse::parse_unit().
Parse the Tweast s. Extensions are enabled.
References parse_input().
Referenced by parse::parse(), and parse::parse_unit().
ast_type parse::TigerParser::parse | ( | const std::string & | s | ) |
Parse the string s. Extensions are automatically disabled.
References parse_input().
|
private |
Parse a Tiger file or string.
References ast_, error_, misc::error::exit(), misc::error::failure, filename, input_, location_, and program_name.
Referenced by parse_file().
ast_type parse::TigerParser::parse_file | ( | const std::string & | name | ) |
Parse the Tiger file name.
References input_, parse_(), and parse_trace_p_.
Referenced by parse::parse(), and parse_import().
ast::DecsList * parse::TigerParser::parse_import | ( | const std::string & | name, |
const location & | loc | ||
) |
Parse a Tiger prelude, return the list of decs.
References misc::basename(), misc::path::empty(), error_, misc::error::exit(), misc::error::failure, misc::file_library::find_file(), input_, library_, location_, open_files_, misc::error::parse, parse_file(), misc::file_library::pop_current_directory(), and misc::file_library::push_current_directory().
Referenced by parse::parse().
Parse a Tweast. extensions temporarily enable or disable extensions for the string parsing. This method is used to factor code between parse (Tweast) and parse (const std::string))
References enable_extensions_p_, and parse::Tweast::flatten().
Referenced by parse().
|
private |
Parse a Tiger prelude f, return the list of decs.
TigerParser & parse::TigerParser::parse_trace | ( | bool | b = true | ) |
const char* parse::TigerParser::prelude | ( | ) | const |
The default prelude.
Referenced by parse::parse().
TigerParser & parse::TigerParser::scan_trace | ( | bool | b = true | ) |
parse::TigerParser::YY_DECL_ | ( | :: | ) |
|
friend |
bool parse::TigerParser::enable_extensions_p_ |
Allow language extensions (reserved identifiers, new keywords)?
Referenced by enable_extensions(), and parse_input().
bool parse::TigerParser::enable_object_extensions_p_ |
Allow object extensions?
Referenced by enable_object_extensions().
misc::error parse::TigerParser::error_ |
Parsing errors handler.
Referenced by error_get(), parse_(), and parse_import().
input_type parse::TigerParser::input_ |
The source to parse.
Referenced by parse_(), parse_file(), and parse_import().
misc::file_library parse::TigerParser::library_ |
The file library for imports.
Referenced by parse_import().
location parse::TigerParser::location_ |
The location requesting the import.
Referenced by parse_(), and parse_import().
|
private |
The list of open files, and the location of their request.
Referenced by parse_import().
bool parse::TigerParser::parse_trace_p_ |
Verbose parsing?
Referenced by parse_file(), and parse_trace().
|
private |
Verbose scanning?
Referenced by scan_trace().
|
private |