public inbox for gcc-rust@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Ian Lance Taylor <iant@google.com>
Cc: Mark Wielaard <mark@klomp.org>,
	gcc Mailing List <gcc@gcc.gnu.org>,
	gcc-rust@gcc.gnu.org
Subject: Re: rust frontend and UTF-8/unicode processing/properties
Date: Sun, 18 Jul 2021 15:23:59 -0700	[thread overview]
Message-ID: <CADzB+2n6SP7fBnO1GkU+AAWFa85eYb04XXGSEAyHPT-qmGDSOw@mail.gmail.com> (raw)
In-Reply-To: <CAKOQZ8zB2L-u61KFgftyoV20TJ8oxdXO6D_v7LiwxgsJ7bxPLg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2074 bytes --]

On Sun, Jul 18, 2021 at 1:13 PM Ian Lance Taylor via Gcc <gcc@gcc.gnu.org>
wrote:

> On Sun, Jul 18, 2021 at 6:23 AM Mark Wielaard <mark@klomp.org> wrote:
> >
> > For the gcc rust frontend I was thinking of importing a couple of
> > gnulib modules to help with UTF-8 processing, conversion to/from
> > unicode codepoints and determining various properties of those
> > codepoints. But it seems gcc doesn't yet have any gnulib modules
> > imported, and maybe other frontends already have helpers to this that
> > the gcc rust frontend could reuse.
> >
> > Rust only accepts valid UTF-8 encoded source files, which may or may
> > not start with UTF-8 BOM character. Whitespace is any codepoint with
> > the Pattern_White_Space property. Identifiers can start with any
> > codepoint with the XID_start property plus zero or one codepoints with
> > XID_continue property. It isn't required, but highly desirable to
> > detect confusable identifiers according to tr39/Confusable_Detection.
> >
> > Other names might be constraint to Alphabetic and/or Number categories
> > (Nd, Nl, No), textual types can only contain Unicode Scalar Values
> > (any Unicode codepoint except high-surrogate and low-surrogates),
> > strings in source code can contain unicode escapes (24 bit, up to 6
> > digits codepoints) but are internally stored as UTF-8 (and must not
> > encode any surrogates).
> >
> > Do other gcc frontends handle any of the above already in a way that
> > might be reusable for other frontends?
>
> I don't know that this is particularly helpful, but the Go frontend
> has this kind of code in gcc/go/gofrontend/lex.cc.  E.g.,
> Lex::fetch_char, Lex::advance_one_utf8_char, unicode_space,
> unicode_digits, unicode_letters, Lex::is_unicode_space, etc.  But you
> probably won't be able to use the code directly, and the code in the
> gofrontend directory is also shared with GoLLVM so it can't trivially
> be moved.
>

I believe the UTF-8 handling for the C family front ends is all in libcpp;
I don't think it's factored in a way to be useful to other front ends.

Jason

[-- Attachment #2: Type: text/html, Size: 2632 bytes --]

  reply	other threads:[~2021-07-18 22:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-18 13:22 Mark Wielaard
2021-07-18 20:12 ` Ian Lance Taylor
2021-07-18 22:23   ` Jason Merrill [this message]
2021-07-23 11:29     ` Philip Herron
     [not found] ` <d5e7434b-80e8-2817-ed87-a23ef2ac0cbb@uma.es>
     [not found]   ` <CAOWUKr0Sd3RRSy2cuqMLj--KTWqOz=nQMxmx7ahM8YunrFzEig@mail.gmail.com>
2023-03-15 11:00     ` [GSoC] gccrs Unicode support Philip Herron
2023-03-15 14:53       ` Arsen Arsenović
2023-03-15 15:18       ` Jakub Jelinek
2023-03-16  8:57         ` Raiki Tamura
2023-03-16  9:28         ` Thomas Schwinge
2023-03-16 12:58           ` Mark Wielaard
2023-03-16 13:07             ` Jakub Jelinek
2023-03-18  8:31             ` Raiki Tamura
2023-03-18  8:47               ` Jonathan Wakely
2023-03-18  8:59                 ` Raiki Tamura
2023-03-18  9:28                   ` Jakub Jelinek
2023-03-20 10:19                     ` Raiki Tamura

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADzB+2n6SP7fBnO1GkU+AAWFa85eYb04XXGSEAyHPT-qmGDSOw@mail.gmail.com \
    --to=jason@redhat.com \
    --cc=gcc-rust@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=iant@google.com \
    --cc=mark@klomp.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).