aboutsummaryrefslogtreecommitdiffstats
path: root/regexec.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-29 13:58:45 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-29 13:58:45 +0000
commit90228f9a86df1c312f3af121235195f4f9ece79a (patch)
tree27977e012b765d4b0f1b59dda0dd82192b3d19b3 /regexec.c
parentfecd08ab8697f0d85ebc450048e621c0f58078fc (diff)
downloadruby-90228f9a86df1c312f3af121235195f4f9ece79a.tar.gz
* regexec.c (ONIGENC_IS_MBC_ASCII_WORD): redefine optimized one.
WORD of Ruby's ascii compatible encoding is always [a-zA-Z0-9_]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/regexec.c b/regexec.c
index a70fbdef91..480017ae54 100644
--- a/regexec.c
+++ b/regexec.c
@@ -40,6 +40,18 @@
# endif
#endif
+#define ENC_DUMMY_FLAG (1<<24)
+static inline int
+rb_enc_asciicompat(OnigEncoding enc)
+{
+ return ONIGENC_MBC_MINLEN(enc)==1 && !((enc)->ruby_encoding_index & ENC_DUMMY_FLAG);
+}
+#undef ONIGENC_IS_MBC_ASCII_WORD
+#define ONIGENC_IS_MBC_ASCII_WORD(enc,s,end) \
+ (rb_enc_asciicompat(enc) ? (ISALNUM(*s) || *s=='_') : \
+ onigenc_ascii_is_code_ctype( \
+ ONIGENC_MBC_TO_CODE(enc,s,end),ONIGENC_CTYPE_WORD,enc))
+
#ifdef USE_CRNL_AS_LINE_TERMINATOR
#define ONIGENC_IS_MBC_CRNL(enc,p,end) \
(ONIGENC_MBC_TO_CODE(enc,p,end) == 13 && \