aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/parse
diff options
context:
space:
mode:
authorRaiki Tamura <tamaron1203@gmail.com>2022-11-16 17:15:24 +0900
committerRaiki Tamura <tamaron1203@gmail.com>2022-11-19 07:58:38 +0900
commitb43c5d4fd82c220419f9234588fed8131d416fff (patch)
treec7de82082b75f16b15ec6a800f9025250ea512f9 /gcc/rust/parse
parent716ae8d024dcddd5000f65fa5c7c0dbd9f03c869 (diff)
downloadgcc-b43c5d4fd82c220419f9234588fed8131d416fff.zip
gcc-b43c5d4fd82c220419f9234588fed8131d416fff.tar.gz
gcc-b43c5d4fd82c220419f9234588fed8131d416fff.tar.bz2
Improve lexer dump
Diffstat (limited to 'gcc/rust/parse')
-rw-r--r--gcc/rust/parse/rust-parse-impl.h41
-rw-r--r--gcc/rust/parse/rust-parse.h2
2 files changed, 0 insertions, 43 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index 54f3c5c..0346ce6 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -14887,47 +14887,6 @@ Parser<ManagedTokenSource>::done_end ()
return (t->get_id () == RIGHT_CURLY || t->get_id () == END_OF_FILE);
}
-// Dumps lexer output to stderr.
-template <typename ManagedTokenSource>
-void
-Parser<ManagedTokenSource>::debug_dump_lex_output (std::ostream &out)
-{
- /* TODO: a better implementation of "lexer dump" (as in dump what was
- * actually tokenised) would actually be to "write" a token to a file every
- * time skip_token() here was called. This would reflect the parser
- * modifications to the token stream, such as fixing the template angle
- * brackets. */
-
- const_TokenPtr tok = lexer.peek_token ();
-
- while (true)
- {
- if (tok->get_id () == Rust::END_OF_FILE)
- break;
-
- bool has_text = tok->get_id () == Rust::IDENTIFIER
- || tok->get_id () == Rust::INT_LITERAL
- || tok->get_id () == Rust::FLOAT_LITERAL
- || tok->get_id () == Rust::STRING_LITERAL
- || tok->get_id () == Rust::CHAR_LITERAL
- || tok->get_id () == Rust::BYTE_STRING_LITERAL
- || tok->get_id () == Rust::BYTE_CHAR_LITERAL;
-
- Location loc = tok->get_locus ();
-
- out << "<id=";
- out << tok->token_id_to_str ();
- out << has_text ? (std::string (", text=") + tok->get_str ()
- + std::string (", typehint=")
- + std::string (tok->get_type_hint_str ()))
- : "";
- out << lexer.get_line_map ()->to_string (loc);
-
- lexer.skip_token ();
- tok = lexer.peek_token ();
- }
-}
-
// Parses crate and dumps AST to stderr, recursively.
template <typename ManagedTokenSource>
void
diff --git a/gcc/rust/parse/rust-parse.h b/gcc/rust/parse/rust-parse.h
index e4c5a2c..8449181 100644
--- a/gcc/rust/parse/rust-parse.h
+++ b/gcc/rust/parse/rust-parse.h
@@ -671,8 +671,6 @@ public:
// Main entry point for parser.
std::unique_ptr<AST::Crate> parse_crate ();
- // Dumps all lexer output.
- void debug_dump_lex_output (std::ostream &out);
void debug_dump_ast_output (AST::Crate &crate, std::ostream &out);
// Returns whether any parsing errors have occurred.