Skip to content
k-takata edited this page Sep 19, 2014 · 1 revision

Incompatibilities with Oniguruma 5.9.x

Onigmo is based on Oniguruma 5.9.x, but it has some incompatibilities.

  • Perl-related syntax was renamed.

    • Old ONIG_SYNTAX_PERL was renamed to ONIG_SYNTAX_PERL58.
      Compatible with Perl 5.8.
    • ONIG_SYNTAX_PERL_NG was renamed to ONIG_SYNTAX_PERL58_NG.
      Compatible with Perl 5.8. And also Ruby-style named group (\g<name>, etc.) is supported.
    • New ONIG_SYNTAX_PERL was added.
      Compatible with Perl 5.10 and later. Perl-style named group ((?&name), etc.) is supported, but Ruby-style named group is not supported.

    If you want Perl 5.10 compatible syntax with Ruby-style named group, you can define new syntax by yourself. E.g.:

    OnigSyntaxType OnigSyntaxPerl_NG_EX;
    
    onig_copy_syntax(&OnigSyntaxPerl_NG_EX, ONIG_SYNTAX_PERL);
    OnigSyntaxPerl_NG_EX.op2 |= ONIG_SYN_OP2_ESC_G_SUBEXP_CALL;
    
    onig_new( ..., &OnigSyntaxPerl_NG_EX, ... );
  • Error code

    • ONIGERR_DEFAULT_ENCODING_IS_NOT_SETTED was renamed to ONIGERR_DEFAULT_ENCODING_IS_NOT_SET.