aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/lex/rust-codepoint.h
diff options
context:
space:
mode:
authorSimplyTheOther <simplytheother@gmail.com>2020-08-20 11:51:25 +0800
committerPhilip Herron <philip.herron@embecosm.com>2020-11-28 21:13:20 +0000
commitb758ec724cc06cb866a72ce17dbfd8a426cf21db (patch)
treecffb4e7c584f7da75ea42e57011c5a1d160d67a2 /gcc/rust/lex/rust-codepoint.h
parentc26f60f6a28394e98ac1d830cbe8f632ef576dbb (diff)
downloadgcc-b758ec724cc06cb866a72ce17dbfd8a426cf21db.zip
gcc-b758ec724cc06cb866a72ce17dbfd8a426cf21db.tar.gz
gcc-b758ec724cc06cb866a72ce17dbfd8a426cf21db.tar.bz2
Lexer cleanup
Diffstat (limited to 'gcc/rust/lex/rust-codepoint.h')
-rw-r--r--gcc/rust/lex/rust-codepoint.h23
1 files changed, 14 insertions, 9 deletions
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 <string>
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