mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
Miscellaneous parser cleanup (#429)
- Give unary `-` and `not` the same precedence as in C++ - Add detail to parse error messages, and make the --trace flag also enable parser debug tracing - Make any new shift-reduce conflicts into build errors - Use `%precedence` rather than `%nonassoc` where possible, in order to catch more grammar bugs at build time
This commit is contained in:
@@ -29,7 +29,11 @@ auto parse(const std::string& input_file_name)
|
||||
std::optional<AST> parsed_input = std::nullopt;
|
||||
ParseAndLexContext context(input_file_name);
|
||||
|
||||
auto syntax_error_code = yy::parser(parsed_input, context)();
|
||||
auto parser = yy::parser(parsed_input, context);
|
||||
if (tracing_output) {
|
||||
parser.set_debug_level(1);
|
||||
}
|
||||
auto syntax_error_code = parser();
|
||||
if (syntax_error_code != 0) {
|
||||
return syntax_error_code;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user