| 1 |
README 2016/11/30 |
| 2 |
|
| 3 |
Onigmo (Oniguruma-mod) -- (C) K.Takata <kentkt AT csc DOT jp> |
| 4 |
|
| 5 |
https://github.com/k-takata/Onigmo |
| 6 |
|
| 7 |
Onigmo is a regular expressions library forked from Oniguruma. |
| 8 |
It focuses to support new expressions like `\K`, `\R`, `(?(cond)yes|no)` |
| 9 |
and etc. which are supported in Perl 5.10+. |
| 10 |
|
| 11 |
Since Onigmo is used as the default regexp library of Ruby 2.0 or later, |
| 12 |
many patches are backported from Ruby 2.x. |
| 13 |
|
| 14 |
See also the Wiki page: |
| 15 |
https://github.com/k-takata/Onigmo/wiki |
| 16 |
|
| 17 |
|
| 18 |
Main New features: |
| 19 |
Regular Expressions (depends on the syntax): |
| 20 |
\K, \R, \X, (?(cond)yes|no) |
| 21 |
(?adlu), \g{name}, \g{n}, (?&name), (?n), (?R), (?0) |
| 22 |
(?P<name>...), (?P=name), (?P>name) |
| 23 |
|
| 24 |
API: |
| 25 |
onig_search_gpos (for Perl-compatible \G) |
| 26 |
|
| 27 |
Encoding: |
| 28 |
CP932, CP1250, CP1251, CP1252, CP1253, CP1254, CP1257 |
| 29 |
|
| 30 |
Syntax: |
| 31 |
Python |
| 32 |
|
| 33 |
|
| 34 |
New Source Files: |
| 35 |
enc/jis/props.h JIS character properties data. |
| 36 |
enc/jis/props.kwd JIS character properties data. |
| 37 |
enc/unicode/casefold.h Unicode case folding data. |
| 38 |
enc/unicode/name2ctype.h Unicode properties data. |
| 39 |
enc/windows_*.c CP* encoding |
| 40 |
|
| 41 |
onigmo.py onigmo.dll/libonigmo.so loader. |
| 42 |
testpy.py test program. |
| 43 |
|
| 44 |
tool/download-ucd.sh downloads Unicode Character Database (UCD). |
| 45 |
tool/case-folding.rb generates casefold.h from UCD. |
| 46 |
tool/convert-jis-props.sh converts props.kwd to props.h. |
| 47 |
tool/convert-name2ctype.sh converts name2ctype.kwd to name2ctypes.h. |
| 48 |
tool/enc-unicode.rb generates name2ctype.kwd from UCD. |
| 49 |
|
| 50 |
win32/Makefile.mingw Makefile for Win32 (MinGW) |
| 51 |
win32/makedef.py creates onigmo.def. |
| 52 |
win32/onigmo.rc resource file for onigmo.dll. |
| 53 |
|
| 54 |
|
| 55 |
ToDo: |
| 56 |
* Reduce the size of Unicode Character Data. |
| 57 |
* (?|...) |
| 58 |
* Improve (?(cond)yes|no). (support look-ahead/behind assertions.) |
| 59 |
|
| 60 |
|
| 61 |
Oniguruma's README follows: |
| 62 |
====================================================================== |
| 63 |
README 2007/05/31 |
| 64 |
|
| 65 |
Oniguruma ---- (C) K.Kosako <sndgk393 AT ybb DOT ne DOT jp> |
| 66 |
|
| 67 |
http://www.geocities.jp/kosako3/oniguruma/ |
| 68 |
|
| 69 |
Oniguruma is a regular expressions library. |
| 70 |
The characteristics of this library is that different character encoding |
| 71 |
for every regular expression object can be specified. |
| 72 |
|
| 73 |
Supported character encodings: |
| 74 |
|
| 75 |
ASCII, UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF-32LE, |
| 76 |
EUC-JP, EUC-TW, EUC-KR, EUC-CN, |
| 77 |
Shift_JIS, Big5, GB18030, KOI8-R, CP1251, |
| 78 |
ISO-8859-1, ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, |
| 79 |
ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-9, ISO-8859-10, |
| 80 |
ISO-8859-11, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16 |
| 81 |
|
| 82 |
* GB18030: contributed by KUBO Takehiro |
| 83 |
* CP1251: contributed by Byte |
| 84 |
------------------------------------------------------------ |
| 85 |
|
| 86 |
License |
| 87 |
|
| 88 |
BSD license. |
| 89 |
|
| 90 |
|
| 91 |
Install |
| 92 |
|
| 93 |
Case 1: Unix and Cygwin platform |
| 94 |
|
| 95 |
1. ./configure |
| 96 |
2. make |
| 97 |
3. make install |
| 98 |
|
| 99 |
* uninstall |
| 100 |
|
| 101 |
make uninstall |
| 102 |
|
| 103 |
* test (ASCII/EUC-JP) |
| 104 |
|
| 105 |
make atest |
| 106 |
|
| 107 |
* configuration check |
| 108 |
|
| 109 |
onig-config --cflags |
| 110 |
onig-config --libs |
| 111 |
onig-config --prefix |
| 112 |
onig-config --exec-prefix |
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
Case 2: Win32 platform (VC++) |
| 117 |
|
| 118 |
1. copy win32\Makefile Makefile |
| 119 |
2. copy win32\config.h config.h |
| 120 |
3. nmake |
| 121 |
|
| 122 |
onig_s.lib: static link library |
| 123 |
onig.dll: dynamic link library |
| 124 |
|
| 125 |
* test (ASCII/Shift_JIS) |
| 126 |
4. copy win32\testc.c testc.c |
| 127 |
5. nmake ctest |
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
Regular Expressions |
| 132 |
|
| 133 |
See doc/RE (or doc/RE.ja for Japanese). |
| 134 |
|
| 135 |
|
| 136 |
Usage |
| 137 |
|
| 138 |
Include oniguruma.h in your program. (Oniguruma API) |
| 139 |
See doc/API for Oniguruma API. |
| 140 |
|
| 141 |
If you want to disable UChar type (== unsigned char) definition |
| 142 |
in oniguruma.h, define ONIG_ESCAPE_UCHAR_COLLISION and then |
| 143 |
include oniguruma.h. |
| 144 |
|
| 145 |
If you want to disable regex_t type definition in oniguruma.h, |
| 146 |
define ONIG_ESCAPE_REGEX_T_COLLISION and then include oniguruma.h. |
| 147 |
|
| 148 |
Example of the compiling/linking command line in Unix or Cygwin, |
| 149 |
(prefix == /usr/local case) |
| 150 |
|
| 151 |
cc sample.c -L/usr/local/lib -lonig |
| 152 |
|
| 153 |
|
| 154 |
If you want to use static link library(onig_s.lib) in Win32, |
| 155 |
add option -DONIG_EXTERN=extern to C compiler. |
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
Sample Programs |
| 160 |
|
| 161 |
sample/simple.c example of the minimum (Oniguruma API) |
| 162 |
sample/names.c example of the named group callback. |
| 163 |
sample/encode.c example of some encodings. |
| 164 |
sample/listcap.c example of the capture history. |
| 165 |
sample/posix.c POSIX API sample. |
| 166 |
sample/sql.c example of the variable meta characters. |
| 167 |
(SQL-like pattern matching) |
| 168 |
|
| 169 |
Test Programs |
| 170 |
sample/syntax.c Perl, Java and ASIS syntax test. |
| 171 |
sample/crnl.c --enable-crnl-as-line-terminator test |
| 172 |
|
| 173 |
|
| 174 |
Source Files |
| 175 |
|
| 176 |
oniguruma.h Oniguruma API header file. (public) |
| 177 |
onig-config.in configuration check program template. |
| 178 |
|
| 179 |
regenc.h character encodings framework header file. |
| 180 |
regint.h internal definitions |
| 181 |
regparse.h internal definitions for regparse.c and regcomp.c |
| 182 |
regcomp.c compiling and optimization functions |
| 183 |
regenc.c character encodings framework. |
| 184 |
regerror.c error message function |
| 185 |
regext.c extended API functions. (deluxe version API) |
| 186 |
regexec.c search and match functions |
| 187 |
regparse.c parsing functions. |
| 188 |
regsyntax.c pattern syntax functions and built-in syntax definitions. |
| 189 |
regtrav.c capture history tree data traverse functions. |
| 190 |
regversion.c version info function. |
| 191 |
st.h hash table functions header file |
| 192 |
st.c hash table functions |
| 193 |
|
| 194 |
oniggnu.h GNU regex API header file. (public) |
| 195 |
reggnu.c GNU regex API functions |
| 196 |
|
| 197 |
onigposix.h POSIX API header file. (public) |
| 198 |
regposerr.c POSIX error message function. |
| 199 |
regposix.c POSIX API functions. |
| 200 |
|
| 201 |
enc/mktable.c character type table generator. |
| 202 |
enc/ascii.c ASCII encoding. |
| 203 |
enc/euc_jp.c EUC-JP encoding. |
| 204 |
enc/euc_tw.c EUC-TW encoding. |
| 205 |
enc/euc_kr.c EUC-KR, EUC-CN encoding. |
| 206 |
enc/sjis.c Shift_JIS encoding. |
| 207 |
enc/big5.c Big5 encoding. |
| 208 |
enc/gb18030.c GB18030 encoding. |
| 209 |
enc/koi8.c KOI8 encoding. |
| 210 |
enc/koi8_r.c KOI8-R encoding. |
| 211 |
enc/cp1251.c CP1251 encoding. |
| 212 |
enc/iso8859_1.c ISO-8859-1 encoding. (Latin-1) |
| 213 |
enc/iso8859_2.c ISO-8859-2 encoding. (Latin-2) |
| 214 |
enc/iso8859_3.c ISO-8859-3 encoding. (Latin-3) |
| 215 |
enc/iso8859_4.c ISO-8859-4 encoding. (Latin-4) |
| 216 |
enc/iso8859_5.c ISO-8859-5 encoding. (Cyrillic) |
| 217 |
enc/iso8859_6.c ISO-8859-6 encoding. (Arabic) |
| 218 |
enc/iso8859_7.c ISO-8859-7 encoding. (Greek) |
| 219 |
enc/iso8859_8.c ISO-8859-8 encoding. (Hebrew) |
| 220 |
enc/iso8859_9.c ISO-8859-9 encoding. (Latin-5 or Turkish) |
| 221 |
enc/iso8859_10.c ISO-8859-10 encoding. (Latin-6 or Nordic) |
| 222 |
enc/iso8859_11.c ISO-8859-11 encoding. (Thai) |
| 223 |
enc/iso8859_13.c ISO-8859-13 encoding. (Latin-7 or Baltic Rim) |
| 224 |
enc/iso8859_14.c ISO-8859-14 encoding. (Latin-8 or Celtic) |
| 225 |
enc/iso8859_15.c ISO-8859-15 encoding. (Latin-9 or West European with Euro) |
| 226 |
enc/iso8859_16.c ISO-8859-16 encoding. |
| 227 |
(Latin-10 or South-Eastern European with Euro) |
| 228 |
enc/utf8.c UTF-8 encoding. |
| 229 |
enc/utf16_be.c UTF-16BE encoding. |
| 230 |
enc/utf16_le.c UTF-16LE encoding. |
| 231 |
enc/utf32_be.c UTF-32BE encoding. |
| 232 |
enc/utf32_le.c UTF-32LE encoding. |
| 233 |
enc/unicode.c Unicode information data. |
| 234 |
|
| 235 |
win32/Makefile Makefile for Win32 (VC++) |
| 236 |
win32/config.h config.h for Win32 |
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
ToDo |
| 241 |
|
| 242 |
? case fold flag: Katakana <-> Hiragana. |
| 243 |
? add ONIG_OPTION_NOTBOS/NOTEOS. (\A, \z, \Z) |
| 244 |
?? \X (== \PM\pM*) |
| 245 |
?? implement syntax behavior ONIG_SYN_CONTEXT_INDEP_ANCHORS. |
| 246 |
?? transmission stopper. (return ONIG_STOP from match_at()) |
| 247 |
|
| 248 |
and I'm thankful to Akinori MUSHA. |
| 249 |
|
| 250 |
|
| 251 |
Mail Address: K.Kosako <sndgk393 AT ybb DOT ne DOT jp> |