From b758ec724cc06cb866a72ce17dbfd8a426cf21db Mon Sep 17 00:00:00 2001 From: SimplyTheOther Date: Thu, 20 Aug 2020 11:51:25 +0800 Subject: Lexer cleanup --- gcc/rust/lex/rust-codepoint.h | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'gcc/rust/lex/rust-codepoint.h') diff --git a/gcc/rust/lex/rust-codepoint.h b/gcc/rust/lex/rust-codepoint.h index 0f2e5bd..d95bfdf 100644 --- a/gcc/rust/lex/rust-codepoint.h +++ b/gcc/rust/lex/rust-codepoint.h @@ -1,11 +1,6 @@ #ifndef RUST_CODEPOINT_H #define RUST_CODEPOINT_H -#include "config.h" -#include "system.h" -#include "coretypes.h" -// config, system, coretypes - TODO: ensure all are needed - #include namespace Rust { @@ -16,11 +11,21 @@ struct Codepoint // Creates a zero codepoint. Codepoint () : value (0) {} - // Creates a codepoint from UTF-8 value. - Codepoint (uint32_t value_) : value (value_) {} + // Creates a codepoint from an encoded UTF-8 value. + Codepoint (uint32_t value) : value (value) {} + + // Returns a C++ string containing string value of codepoint. + std::string as_string (); + + bool operator== (Codepoint other) const + { + return value == other.value; + } - // Returns a C++ string containing value of codepoint. - ::std::string as_string (); + bool operator!= (Codepoint other) const + { + return !operator== (other); + } }; } // namespace Rust -- cgit v1.1