From 10abcf77cc24dfae451d96310b4391dad35906ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Tue, 20 Mar 2018 06:14:49 +0100 Subject: New upstream version 6.8.1 --- doc/API | 134 +++++++++++++++++++++++++++++++++++++++++++++++- doc/API.ja | 132 ++++++++++++++++++++++++++++++++++++++++++++++- doc/CALLOUTS.BUILTIN | 88 +++++++++++++++++++++++++++++++ doc/CALLOUTS.BUILTIN.ja | 88 +++++++++++++++++++++++++++++++ doc/FAQ | 6 +-- doc/RE | 22 +++++++- doc/RE.ja | 29 +++++++++-- 7 files changed, 488 insertions(+), 11 deletions(-) create mode 100644 doc/CALLOUTS.BUILTIN create mode 100644 doc/CALLOUTS.BUILTIN.ja (limited to 'doc') diff --git a/doc/API b/doc/API index 801e2ac..08f9227 100644 --- a/doc/API +++ b/doc/API @@ -1,4 +1,4 @@ -Oniguruma API Version 6.7.0 2017/12/08 +Oniguruma API Version 6.8.0 2018/03/13 #include @@ -222,6 +222,77 @@ Oniguruma API Version 6.7.0 2017/12/08 1 reg: regex object. +# OnigMatchParam* onig_new_match_param() + + Allocate a OnigMatchParam object and initialize the contents by + onig_initialize_match_param(). + + +# void onig_free_match_param(OnigMatchParam* mp) + + Free memory used by a OnigMatchParam object. + + arguments + 1 mp: OnigMatchParam object + + +# void onig_initialize_match_param(OnigMatchParam* mp) + + Set match-param fields to default values. + Match-param is used in onig_match_with_param() and onig_search_with_param(). + + arguments + 1 mp: match-param pointer + + +# int onig_set_match_stack_limit_size_of_match_param(OnigMatchParam* mp, unsigned int limit) + + Set a maximum number of match-stack depth. + 0 means unlimited. + + arguments + 1 mp: match-param pointer + 2 limit: number of limit + + normal return: ONIG_NORMAL + + +# int onig_set_retry_limit_in_match_of_match_param(OnigMatchParam* mp, unsigned long limit) + + Set a retry limit count of a match process. + + arguments + 1 mp: match-param pointer + 2 limit: number of limit + + normal return: ONIG_NORMAL + + +# int onig_set_progress_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f) + + Set a function for callouts of contents in progress. + If 0 (NULL) is set, never called in progress. + + arguments + 1 mp: match-param pointer + 2 f: function + + normal return: ONIG_NORMAL + + +# int onig_set_retraction_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f) + + Set a function for callouts of contents in retraction (backtrack). + If 0 (NULL) is set, never called in retraction. + + arguments + 1 mp: match-param pointer + 2 f: function + + normal return: ONIG_NORMAL + + + # int onig_search(regex_t* reg, const UChar* str, const UChar* end, const UChar* start, const UChar* range, OnigRegion* region, OnigOptionType option) @@ -246,8 +317,17 @@ Oniguruma API Version 6.7.0 2017/12/08 ONIG_OPTION_POSIX_REGION region argument is regmatch_t[] of POSIX API. +# int onig_search_with_param(regex_t* reg, const UChar* str, const UChar* end, + const UChar* start, const UChar* range, OnigRegion* region, + OnigOptionType option, OnigMatchParam* mp) + + arguments + 1-7: same as onig_search() + 8 mp: match parameter values (match_stack_limit, retry_limit_in_match) + + # int onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at, - OnigRegion* region, OnigOptionType option) + OnigRegion* region, OnigOptionType option) Match string and return result and matching region. @@ -267,6 +347,15 @@ Oniguruma API Version 6.7.0 2017/12/08 ONIG_OPTION_POSIX_REGION region argument is regmatch_t[] type of POSIX API. +# int onig_match_with_param(regex_t* reg, const UChar* str, const UChar* end, + const UChar* at, OnigRegion* region, + OnigOptionType option, OnigMatchParam* mp) + + arguments + 1-6: same as onig_match() + 7 mp: match parameter values (match_stack_limit, retry_limit_in_match) + + # int onig_scan(regex_t* reg, const UChar* str, const UChar* end, OnigRegion* region, OnigOptionType option, int (*scan_callback)(int, int, OnigRegion*, void*), @@ -623,6 +712,47 @@ Oniguruma API Version 6.7.0 2017/12/08 normal return: ONIG_NORMAL +# unsigned long onig_get_retry_limit_in_match(void) + + Return the limit of retry counts in matching process. + (default: 10000000) + + normal return: limit value + + +# int onig_set_retry_limit_in_match(unsigned long n) + + Set the limit of retry counts in matching process. + + normal return: ONIG_NORMAL + + +# OnigCalloutFunc onig_get_progress_callout(void) + + Get a function for callouts of contents in progress. + + +# int onig_set_progress_callout(OnigCalloutFunc f) + + Set a function for callouts of contents in progress. + If 0 (NULL) is set, never called in progress. + + normal return: ONIG_NORMAL + + +# OnigCalloutFunc onig_get_retraction_callout(void) + + Get a function for callouts of contents in retraction (backtrack). + + +# int onig_set_retraction_callout(OnigCalloutFunc f) + + Set a function for callouts of contents in retraction (backtrack). + If 0 (NULL) is set, never called in retraction. + + normal return: ONIG_NORMAL + + # int onig_unicode_define_user_property(const char* name, OnigCodePoint* ranges)) Define new Unicode property. diff --git a/doc/API.ja b/doc/API.ja index d73186c..5226288 100644 --- a/doc/API.ja +++ b/doc/API.ja @@ -1,4 +1,4 @@ -鬼車インターフェース Version 6.7.0 2017/12/08 +鬼車インターフェース Version 6.8.0 2018/03/13 #include @@ -220,6 +220,77 @@ 1 reg: 正規表現オブジェクト +# OnigMatchParam* onig_new_match_param() + + OnigMatchParamオブジェクトを生成し、onig_initialize_match_param()を使用して + 中身を初期化する。 + + +# void onig_free_match_param(OnigMatchParam* mp) + + OnigMatchParamオブジェクトで使用しているメモリを開放する。 + + 引数 + 1 mp: OnigMatchParamオブジェクト + + +# void onig_initialize_match_param(OnigMatchParam* mp) + + マッチパラメタ構造体にデフォルト値をセットする。 + マッチパラメタは、onig_match_with_param(), onig_search_with_param()で + 使用される。 + + 引数 + 1 mp: マッチパラメタオブジェクトアドレス + + +# int onig_set_match_stack_limit_size_of_match_param(OnigMatchParam* mp, unsigned int limit) + + マッチスタックの最大深さをセットする。 + 0は、無制限を表す。 + + 引数 + 1 mp: マッチパラメタオブジェクトアドレス + 2 limit: 制限数 + + 正常終了戻り値: ONIG_NORMAL + + +# int onig_set_retry_limit_in_match_of_match_param(OnigMatchParam* mp, unsigned long limit) + + 一回のマッチでのリトライ数の最大値をセットする。 + + 引数 + 1 mp: マッチパラメタオブジェクトアドレス + 2 limit: 制限回数 + + 正常終了戻り値: ONIG_NORMAL + + +# int onig_set_progress_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f) + + 前進時の内容の呼び出し(callouts)で呼び出される関数をセットする。 + もし0(NULL)がセットされると、前進時に呼び出しは起こらない。 + + 引数 + 1 mp: マッチパラメタオブジェクトアドレス + 2 f: 呼び出される関数 + + 正常終了戻り値: ONIG_NORMAL + + +# int onig_set_retraction_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f) + + 後退時の内容の呼び出し(callouts)で呼び出される関数をセットする。 + もし0(NULL)がセットされると、後退時に呼び出しは起こらない。 + + 引数 + 1 mp: マッチパラメタオブジェクトアドレス + 2 f: 呼び出される関数 + + 正常終了戻り値: ONIG_NORMAL + + # int onig_search(regex_t* reg, const UChar* str, const UChar* end, const UChar* start, const UChar* range, OnigRegion* region, OnigOptionType option) @@ -245,6 +316,15 @@ ONIG_OPTION_POSIX_REGION region引数をPOSIX APIのregmatch_t[]にする +# int onig_search_with_param(regex_t* reg, const UChar* str, const UChar* end, + const UChar* start, const UChar* range, OnigRegion* region, + OnigOptionType option, OnigMatchParam* mp) + + 引数 + 1-7: onig_search()と同じ + 8 mp: マッチパラメタ値 (match_stack_limit, retry_limit_in_match) + + # int onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at, OnigRegion* region, OnigOptionType option) @@ -266,6 +346,15 @@ ONIG_OPTION_POSIX_REGION region引数をPOSIX APIのregmatch_t[]にする +# int onig_match_with_param(regex_t* reg, const UChar* str, const UChar* end, + const UChar* at, OnigRegion* region, + OnigOptionType option, OnigMatchParam* mp) + + 引数 + 1-6: onig_match()と同じ + 7 mp: マッチパラメタ値 (match_stack_limit, retry_limit_in_match) + + # int onig_scan(regex_t* reg, const UChar* str, const UChar* end, OnigRegion* region, OnigOptionType option, int (*scan_callback)(int, int, OnigRegion*, void*), @@ -629,6 +718,47 @@ 正常終了戻り値: ONIG_NORMAL +# unsigned long onig_get_retry_limit_in_match(void) + + マッチング関数内でのリトライ数の制限値を返す。 + (デフォルト: 10000000) + + 正常終了戻り値: 制限値 + + +# int onig_set_retry_limit_in_match(unsigned long n) + + マッチング関数内でのリトライ数の制限値を指定する。 + + 正常終了戻り値: ONIG_NORMAL + + +# OnigCalloutFunc onig_get_progress_callout(void) + + 前進時の内容の呼び出しで呼び出される関数を返す。 + + +# int onig_set_progress_callout(OnigCalloutFunc f) + + 前進時の内容の呼び出しで呼び出される関数を指定する。 + もし0(NULL)を指定すると、前進時の内容の呼び出しで呼び出しは起こらない。 + + 正常終了戻り値: ONIG_NORMAL + + +# OnigCalloutFunc onig_get_retraction_callout(void) + + 後退時の内容の呼び出しで呼び出される関数を返す。 + + +# int onig_set_retraction_callout(OnigCalloutFunc f) + + 後退時の内容の呼び出しで呼び出される関数を指定する。 + もし0(NULL)を指定すると、後退時の内容の呼び出しで呼び出しは起こらない。 + + 正常終了戻り値: ONIG_NORMAL + + # int onig_unicode_define_user_property(const char* name, OnigCodePoint* ranges)) 新しいUnicodeプロパティを定義する。 diff --git a/doc/CALLOUTS.BUILTIN b/doc/CALLOUTS.BUILTIN new file mode 100644 index 0000000..dcf87f8 --- /dev/null +++ b/doc/CALLOUTS.BUILTIN @@ -0,0 +1,88 @@ +CALLOUTS.BUILTIN 2018/03/19 + + +* FAIL (progress) + + (*FAIL) + + Always fail. + + +* MISMATCH (progress) + + (*MISMATCH) + + Terminate Match process. + Continue Search process. + + +* ERROR (progress) + + (*ERROR{n::LONG}) + + Terminate Search/Match process. + + Return value is the argument 'n'. (The value must be less than -1) + 'n' is an optional argument. (default value is ONIG_ABORT) + + +* MAX (progress/retraction) + + (*MAX{n::LONG}) + + Restrict the maximum count of success. + + [callout data] + slot 0: current success count. + + +* COUNT (progress/retraction) + + (*COUNT{c::CHAR}) + + Counter. + Depends on 'c' argument, the slot 0 value changes. + 'c' is an optional argument, deefault value is '>'. + + [callout data] + slot 0: '>': progress count, '<': retraction count, 'X': success count + slot 1: progress count + slot 2: retraction count + + (* success count = progress count - retraction count) + + ** If option ONIG_OPTION_FIND_LONGEST or ONIG_OPTION_FIND_NOT_EMPTY is used, + counts are not accurate. + + +* TOTAL_COUNT (progress/retraction) + + (*TOTAL_COUNT{c::CHAR}) + + It's the almost same as COUNT. + But the counts are integrated in a search process. + 'c' is an optional argument, deefault value is '>'. + + [callout data] + slot 0: '>': progress count, '<': retraction count, 'X': success count + slot 1: progress count + slot 2: retraction count + + ** If option ONIG_OPTION_FIND_LONGEST or ONIG_OPTION_FIND_NOT_EMPTY is used, + counts are not accurate. + + +* CMP (progress) + + (*CMP{x::TAG/LONG, op::STRING, y::TAG/LONG}) + + Compare x value and y value with op operator. + + op: '==', '!=', '>', '<', '>=', '<=' + + ex. "(?:(*MAX[TA]{7})a|(*MAX[TB]{5})b)*(*CMP{TA,>=,4})" + + [callout data] + slot 0: op value (enum OP_CMP in src/regexec.c) + +//END diff --git a/doc/CALLOUTS.BUILTIN.ja b/doc/CALLOUTS.BUILTIN.ja new file mode 100644 index 0000000..e1a5b7a --- /dev/null +++ b/doc/CALLOUTS.BUILTIN.ja @@ -0,0 +1,88 @@ +CALLOUTS.BUILTIN.ja 2018/03/19 + + +* FAIL (前進) + + (*FAIL) + + 常に失敗する + + +* MISMATCH (前進) + + (*MISMATCH) + + 照合を中止する + 検索は継続する + + +* ERROR (前進) + + (*ERROR{n::LONG}) + + 検索/照合を中止する + 戻り値は引数'n'の値。(-1より小さい負の値でなければならない) + 'n'はオプション引数で、デフォルト値はONIG_ABORT + + +* MAX (前進/後退) + + (*MAX{n::LONG}) + + 成功回数を制限する + + [callout data] + slot 0: 現在の成功回数 + + +* COUNT (前進/後退) + + (*COUNT{c::CHAR}) + + カウンタ + 'c'引数の値によって、slot 0の値が変化する + 'c'はオプション引数で、デフォルト値は'>' + + [callout data] + slot 0: '>': 前進回数, '<': 後退回数, 'X': 成功回数 + slot 1: 前進回数 + slot 2: 後退回数 + + (* 成功回数 = 前進回数 - 後退回数) + + ** ONIG_OPTION_FIND_LONGEST または ONIG_OPTION_FIND_NOT_EMPTY が使用されると + 正確な動作ができなくなる + + +* TOTAL_COUNT (前進/後退) + + (*TOTAL_COUNT{c::CHAR}) + + これはCOUNTとほとんど同じ + しかし、カウントが検索過程で積算される + 'c'はオプション引数で、デフォルト値は'>' + + [callout data] + slot 0: '>': 前進回数, '<': 後退回数, 'X': 成功回数 + slot 1: 前進回数 + slot 2: 後退回数 + + ** ONIG_OPTION_FIND_LONGEST または ONIG_OPTION_FIND_NOT_EMPTY が使用されると + 正確な動作ができなくなる + + +* CMP (前進) + + (*CMP{x::TAG/LONG, op::STRING, y::TAG/LONG}) + + xの値とyの値をop演算子で比較する + x, yがTAGのときにはそのcalloutのslot 0の値が参照される + + op: '==', '!=', '>', '<', '>=', '<=' + + 例: "(?:(*MAX[TA]{7})a|(*MAX[TB]{5})b)*(*CMP{TA,>=,4})" + + [callout data] + slot 0: op値 (src/regexec.c の中の enum OP_CMP) + +//END diff --git a/doc/FAQ b/doc/FAQ index c00f030..dfbd7fa 100644 --- a/doc/FAQ +++ b/doc/FAQ @@ -1,12 +1,12 @@ FAQ 2006/11/14 -1. Lognest match +1. Longest match - You can execute longest match by using ONIG_OPTION_FIND_LONGEST option + You can execute the longest match by using ONIG_OPTION_FIND_LONGEST option in onig_new(). 2. Mailing list - There is no mailing list about Oniguruma. + There is no mailing list for Oniguruma. // END diff --git a/doc/RE b/doc/RE index 64f9bb2..4bd0e7d 100644 --- a/doc/RE +++ b/doc/RE @@ -1,4 +1,4 @@ -Oniguruma Regular Expressions Version 6.7.0 2017/12/08 +Oniguruma Regular Expressions Version 6.8.0 2018/03/08 syntax: ONIG_SYNTAX_ONIGURUMA (default) @@ -262,6 +262,24 @@ syntax: ONIG_SYNTAX_ONIGURUMA (default) Assigning the same name to two or more subexps is allowed. + + + + * Callouts of contents + (?{...contents...}) callouts in progress + (?{...contents...}D) D is a direction flag char. ('X' or '<' or '>') + D = 'X': progress and retraction, '<': retraction only + '>': progress only (default) + (?{...contents...}[tag]) tag assigned + (?{...contents...}[tag]D) + + * Callouts of name + (*name) + (*name{args...}) with args + (*name[tag]) tag assigned + (*name[tag]{args...}) + + (?~absent) Absent repeater (* proposed by Tanaka Akira) @@ -289,6 +307,8 @@ syntax: ONIG_SYNTAX_ONIGURUMA (default) is undefined. + + (?(condition_exp)then_exp|else_exp) if-then-else (?(condition_exp)then_exp) if-then diff --git a/doc/RE.ja b/doc/RE.ja index 4679818..a7f6b8d 100644 --- a/doc/RE.ja +++ b/doc/RE.ja @@ -1,4 +1,4 @@ -鬼車 正規表現 Version 6.7.0 2017/12/08 +鬼車 正規表現 Version 6.8.0 2018/03/08 使用文法: ONIG_SYNTAX_ONIGURUMA (既定値) @@ -264,10 +264,28 @@ この場合には、この名前を使用した後方参照は可能であるが、 部分式呼出しはできない。 + + <呼び出し> + + * 内容の呼び出し + (?{...contents...}) 前進中のみの呼び出し + (?{...contents...}D) Dは方向指定文字 ('X' or '<' or '>') + D = 'X': 前進および後退, '<' 後退のみ, '>': 前進のみ + (?{...contents...}[tag]) 名札付き + (?{...contents...}[tag]D) + + * 名前の呼び出し + (*name) + (*name{args...}) 引数付き + (*name[tag]) 名札付き + (*name[tag]{args...}) + + + <不在機能群> (?~不在式) 不在繰り返し (*原案 田中哲) - これは.*(より正確には\O*)のように動作するが、<不在式>に + これは .*(より正確には\O*)のように動作するが、<不在式>に 適合する文字列を含まない範囲に制限される。 これは(?~|不在式|\O*)の省略表記である。 @@ -282,10 +300,13 @@ <不在式>に適合する文字列を含まない範囲に制限される。 (?~|) 範囲消去 - 不在停止の効果を消して、初期状態にする。 + 不在停止の効果を消して、それ以前の状態にする。 + + * 不在機能の入れ子には対応しておらず、その場合の挙動は不定とする。 + - * 不在機能の入れ子には対応しておらず、挙動は不定とする。 + <条件文> (?(条件式)成功式|失敗式) 条件式が成功すれば成功式、失敗すれば失敗式を実行する この機能の存在理由は、成功式が失敗しても失敗式には -- cgit v1.2.3