Do not use non-ASCII chars in sources

No encodings are guaranteed in C compilers, and other than UTF-8
encodings may be assumed in some platforms, e.g., CP932 on Windows
Japanese edition, and may result in compilation errors.
This commit is contained in:
Nobuyoshi Nakada 2023-11-05 02:14:26 +09:00
parent 054a4672cb
commit 368a1cb3c4
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
5 changed files with 19 additions and 15 deletions

View File

@ -3,7 +3,7 @@
; Some relevant examples: https://github.com/gcc-mirror/gcc/blob/master/libphobos/libdruntime/config/powerpc/switchcontext.S ; Some relevant examples: https://github.com/gcc-mirror/gcc/blob/master/libphobos/libdruntime/config/powerpc/switchcontext.S
; https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/rs6000/darwin-gpsave.S ; https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/rs6000/darwin-gpsave.S
; https://www.ibm.com/docs/en/aix/7.2?topic=epilogs-saving-gprs-only ; https://www.ibm.com/docs/en/aix/7.2?topic=epilogs-saving-gprs-only
; ppc32 version may be re-written compactly with stmw/lwm, but the code wonʼt be faster, see: https://github.com/ruby/ruby/pull/5927#issuecomment-1139730541 ; ppc32 version may be re-written compactly with stmw/lwm, but the code won't be faster, see: https://github.com/ruby/ruby/pull/5927#issuecomment-1139730541
; Notice that this code is only for Darwin (macOS). Darwin ABI differs from AIX and ELF. ; Notice that this code is only for Darwin (macOS). Darwin ABI differs from AIX and ELF.
; To add support for AIX, *BSD or *Linux, please make separate implementations. ; To add support for AIX, *BSD or *Linux, please make separate implementations.

View File

@ -13,7 +13,7 @@
enum { enum {
COROUTINE_REGISTERS = COROUTINE_REGISTERS =
20 /* 19 general purpose registers (r13r31) and 1 return address */ 20 /* 19 general purpose registers (r13-r31) and 1 return address */
+ 4 /* space for fiber_entry() to store the link register */ + 4 /* space for fiber_entry() to store the link register */
}; };

View File

@ -12,7 +12,7 @@
enum { enum {
COROUTINE_REGISTERS = COROUTINE_REGISTERS =
20 /* 19 general purpose registers (r13r31) and 1 return address */ 20 /* 19 general purpose registers (r13-r31) and 1 return address */
+ 4 /* space for fiber_entry() to store the link register */ + 4 /* space for fiber_entry() to store the link register */
}; };

View File

@ -116,18 +116,18 @@ pm_regexp_char_find(pm_regexp_parser_t *parser, uint8_t value) {
* The properly track everything, we're going to build a little state machine. * The properly track everything, we're going to build a little state machine.
* It looks something like the following: * It looks something like the following:
* *
* * +-------+ +---------+ ------------+
* lbrace > start digit > minimum * ---- lbrace ---> | start | ---- digit ---> | minimum | |
* < digit * +-------+ +---------+ <--- digit -+
* * | | |
* rbrace * +-------+ | | rbrace
* comma < comma comma * | comma | <----- comma +---- comma -------+ |
* V V * +-------+ V V
* * | +---------+ +---------+
* digit > maximum rbrace > | final | * +-- digit --> | maximum | -- rbrace --> || final ||
* * +---------+ +---------+
* ^ * | ^
* digit * +- digit -+
* *
* Note that by the time we've hit this function, the lbrace has already been * Note that by the time we've hit this function, the lbrace has already been
* consumed so we're in the start state. * consumed so we're in the start state.

View File

@ -360,6 +360,7 @@ module Prism
=end =end
HEADING HEADING
else else
escape = true
<<~HEADING <<~HEADING
/******************************************************************************/ /******************************************************************************/
/* This file is generated by the templates/template.rb script and should not */ /* This file is generated by the templates/template.rb script and should not */
@ -373,6 +374,9 @@ module Prism
write_to ||= File.expand_path("../#{name}", __dir__) write_to ||= File.expand_path("../#{name}", __dir__)
contents = heading + erb.result_with_hash(locals) contents = heading + erb.result_with_hash(locals)
if escape
(contents = contents.b).gsub!(/[^\t-~]/) {|c| "\\x%.2x" % c.ord}
end
FileUtils.mkdir_p(File.dirname(write_to)) FileUtils.mkdir_p(File.dirname(write_to))
File.write(write_to, contents) File.write(write_to, contents)