aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/lex
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/lex')
-rw-r--r--gcc/rust/lex/rust-lex.cc15
-rw-r--r--gcc/rust/lex/rust-lex.h9
-rw-r--r--gcc/rust/lex/rust-token.h7
3 files changed, 16 insertions, 15 deletions
diff --git a/gcc/rust/lex/rust-lex.cc b/gcc/rust/lex/rust-lex.cc
index f4b8861..b143e70 100644
--- a/gcc/rust/lex/rust-lex.cc
+++ b/gcc/rust/lex/rust-lex.cc
@@ -21,7 +21,7 @@
#include "rust-lex.h"
#include "rust-diagnostics.h"
#include "rust-linemap.h"
-#include "rust-session-manager.h"
+#include "rust-edition.h"
#include "safe-ctype.h"
#include "cpplib.h"
#include "rust-keyword-values.h"
@@ -277,9 +277,7 @@ Lexer::classify_keyword (const std::string &str)
// https://doc.rust-lang.org/reference/keywords.html#reserved-keywords
// `try` is not a reserved keyword before 2018
- if (Session::get_instance ().options.get_edition ()
- == CompileOptions::Edition::E2015
- && id == TRY)
+ if (get_rust_edition () == Edition::E2015 && id == TRY)
return IDENTIFIER;
return id;
@@ -589,7 +587,8 @@ Lexer::build_token ()
if (current_char.is_eof ())
{
rust_error_at (
- loc, "unexpected EOF while looking for end of comment");
+ loc, ErrorCode::E0758,
+ "unexpected EOF while looking for end of comment");
break;
}
str += current_char;
@@ -644,7 +643,8 @@ Lexer::build_token ()
if (current_char.is_eof ())
{
rust_error_at (
- loc, "unexpected EOF while looking for end of comment");
+ loc, ErrorCode::E0758,
+ "unexpected EOF while looking for end of comment");
break;
}
@@ -708,7 +708,8 @@ Lexer::build_token ()
if (current_char.is_eof ())
{
rust_error_at (
- loc, "unexpected EOF while looking for end of comment");
+ loc, ErrorCode::E0758,
+ "unexpected EOF while looking for end of comment");
break;
}
diff --git a/gcc/rust/lex/rust-lex.h b/gcc/rust/lex/rust-lex.h
index 8265ca8..10293e0 100644
--- a/gcc/rust/lex/rust-lex.h
+++ b/gcc/rust/lex/rust-lex.h
@@ -115,14 +115,15 @@ private:
// Request new Location for current column in line_table
location_t get_current_location ();
- // Skips the current input char.
+ // Skips the current input character.
void skip_input ();
- // Advances current input char to n + 1 chars ahead of current position.
+ // Advances current input character to n + 1 characters ahead of current
+ // position.
void skip_input (int n);
- // Peeks the current char.
+ // Peeks the current character.
Codepoint peek_input ();
- // Returns char n bytes ahead of current position.
+ // Returns character n characters ahead of current position.
Codepoint peek_input (int n);
// Classifies keyword (i.e. gets id for keyword).
diff --git a/gcc/rust/lex/rust-token.h b/gcc/rust/lex/rust-token.h
index aa2f308..c683ecd 100644
--- a/gcc/rust/lex/rust-token.h
+++ b/gcc/rust/lex/rust-token.h
@@ -21,7 +21,6 @@
#include "rust-system.h"
#include "rust-linemap.h"
-#include "rust-make-unique.h"
#include "rust-unicode.h"
namespace Rust {
@@ -268,7 +267,7 @@ private:
: token_id (token_id), locus (location), type_hint (CORETYPE_UNKNOWN)
{
// Normalize identifier tokens
- str = Rust::make_unique<std::string> (
+ str = std::make_unique<std::string> (
nfc_normalize_token_string (location, token_id, paramStr));
}
@@ -285,7 +284,7 @@ private:
: token_id (token_id), locus (location), type_hint (CORETYPE_UNKNOWN)
{
// Normalize identifier tokens
- str = Rust::make_unique<std::string> (
+ str = std::make_unique<std::string> (
nfc_normalize_token_string (location, token_id,
paramCodepoint.as_string ()));
}
@@ -296,7 +295,7 @@ private:
: token_id (token_id), locus (location), type_hint (parType)
{
// Normalize identifier tokens
- str = Rust::make_unique<std::string> (
+ str = std::make_unique<std::string> (
nfc_normalize_token_string (location, token_id, paramStr));
}