From fe0b6d7eaf6ffdcb01146356f373ac66cba2f642 Mon Sep 17 00:00:00 2001 From: ptrace Date: Sun, 18 Jan 2026 00:35:09 +0100 Subject: [PATCH 1/2] Updated module stubborn to the latest version of Aug 3, 2025 --- modules/stubborn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/stubborn b/modules/stubborn index 4939f5e..cacd221 160000 --- a/modules/stubborn +++ b/modules/stubborn @@ -1 +1 @@ -Subproject commit 4939f5e755b050c3c4f36597ff2de8d64fc6de7a +Subproject commit cacd221e2c5e27b33aeb46a074e79c1e4f49c922 From 63d8baad3f17ac9256e53be6e551d0c7756fec26 Mon Sep 17 00:00:00 2001 From: ptrace Date: Sun, 18 Jan 2026 00:55:46 +0100 Subject: [PATCH 2/2] Removed deprecation warnings as of Jai version beta 0.2.024; Replaced old deref syntax with the new one --- compile.jai | 18 +++++----- match.jai | 2 +- nfa.jai | 2 +- parse.jai | 94 ++++++++++++++++++++++++++-------------------------- program.jai | 80 ++++++++++++++++++++++---------------------- simplify.jai | 12 +++---- sparse.jai | 8 ++--- walk.jai | 2 +- 8 files changed, 109 insertions(+), 109 deletions(-) diff --git a/compile.jai b/compile.jai index 5f3f71e..0c1ac86 100644 --- a/compile.jai +++ b/compile.jai @@ -33,7 +33,7 @@ compile :: (pattern: string, parse_flags := ParseFlags.LikePerl) -> Regexp, succ uninit(*regexp); return .{}, false; } - #if REGEXP_DEBUG print("Compiled suffix:\n%\n", to_string(< PatchList { patch :: (inst: *[..] Inst, l: PatchList, p: int) { head := l.head; while head != 0 { - ip := *(<>1]; + ip := *(inst.*)[head>>1]; if head & 1 { head = ip.out1; ip.out1 = cast(u32)p; } else { - head = get_out(< PatchList { if l1.head == 0 return l2; if l2.head == 0 return l1; - ip := *(<>1]; + ip := *(inst.*)[l1.tail>>1]; if l1.tail & 1 { ip.out1 = l2.head; } else { @@ -260,13 +260,13 @@ finish :: (using comp: *Compiler, re: *Regexp_Node) -> *Prog { prog.inst = inst; optimize(prog); - #if REGEXP_DEBUG print("Optimized:\n%\n", to_string(< Frag { // Elide no-op. begin := *inst[a.begin]; - if get_opcode(< u64 { cached_rune_byte_suffix :: (using comp: *Compiler, lo: u8, hi: u8, foldcase: bool, next: int) -> int { key := make_rune_cache_key(lo, hi, foldcase, next); ptr := table_find_pointer(*rune_cache, key); - if ptr return < int { compute_num_captures :: (re: *Regexp_Node) -> int { count_pre_visit :: (num: *int, re: *Regexp_Node, v: *void) -> *void, bool { if re.op == .Capture { - < Status { } rep :: (ps: *ParseState, op: RegexpOp, t: *string, lastunary: string) -> isunary: string, success: bool { - opstr := < int, success: bool { - if !s.count || !isdigit((<= 2 && (<= 2 && (s.*)[0] == #char "0" && isdigit((s.*)[1]) return 0, false; n := 0; - while s.count && isdigit((<= 100000000 return 0, false; n = n*10 + c - #char "0"; @@ -2145,7 +2145,7 @@ parse_integer :: (s: *string) -> int, success: bool { // doesn't fail even if ParseRepetition does, so the StringPiece // s must NOT be edited unless MaybeParseRepetition returns true. maybe_parse_repetition :: (sp: *string) -> lo: int, hi: int, success: bool { - s := < lo: int, hi: int, success: bool { } if !s.count || s[0] != #char "}" return 0, 0, false; advance(*s); - < Rune, len: int, status: Status { - result, len := rune_from_string(< r: Rune, status: Status, success: return status; } - assert(s.count && (< r: Rune, status: Status, success: case #char "6"; #through; case #char "7"; // Single non-zero octal digit is a backreference; not supported. - if !s.count || (< #char "7" return 0, bad_escape(begin, s), false; + if !s.count || (s.*)[0] < #char "0" || (s.*)[0] > #char "7" return 0, bad_escape(begin, s), false; #through; case #char "0"; // consume up to three octal digits; already have one. code := c - #char "0"; if !s.count return 0, bad_escape(begin, s), false; - c = (< *UGroup { if !(parse_flags & .PerlClasses) return null; - if s.count < 2 || (< status: Status, result: ParseResult { // Check begins with [: - if s.count < 2 || (< RuneRange, status: Status, success: bool { - os := <= 2 && (<= 2 && (s.*)[0] == #char "-" && (s.*)[1] != #char "]" { advance(s); // #char "-" rr.hi, status, success = parse_cc_character(ps, s, whole_class); @@ -2642,16 +2642,16 @@ parse_cc_range :: (using ps: *ParseState, s: *string, whole_class: string) -> Ru // Sets *s to span the remainder of the string. // Sets *out_re to the regexp for the class. parse_char_class :: (using ps: *ParseState, s: *string) -> *Regexp_Node, status: Status, success: bool { - whole_class := < *Regexp_Node, status: } } first := true; // ] is okay as first char in class - while s.count && (first || (< 2 && (< 2 && (s.*)[0] == #char "[" && (s.*)[1] == #char ":" { status, result := parse_cc_name(s, flags, re.char_class); if #complete result == { case .kParseOk; @@ -2692,7 +2692,7 @@ parse_char_class :: (using ps: *ParseState, s: *string) -> *Regexp_Node, status: } // Look for Unicode character group like \p{Han} - if s.count > 2 && (< 2 && (s.*)[0] == #char "\\" && ((s.*)[1] == #char "p" || (s.*)[1] == #char "P") { status, result := maybe_parse_unicode_group(s, flags, re.char_class); if #complete result == { case .kParseOk; @@ -2763,9 +2763,9 @@ is_valid_capture_name :: (name: string) -> bool { // well-formed or not supported, sets status and returns false. parse_perl_flags :: (using ps: *ParseState, s: *string) -> Status, success: bool { // Caller is supposed to check this. - assert(flags & .PerlX && s.count >= 2 && (<= 2 && (s.*)[0] == #char "(" && (s.*)[1] == #char "?"); - t := < Status, success: bool // Pull out name. end := find_index_from_left(t, #char ">"); if end == -1 { - valid, status := is_valid_utf8(<...", t[end] == '>' - capture := slice(< Status, success: bool nflags := flags; done: bool; while !done { - if !t.count return make_status(.BadPerlOp, < Status, success: bool // Negation case #char "-"; - if negated return make_status(.BadPerlOp, slice(< Status, success: bool } } - if negated && !sawflags return make_status(.BadPerlOp, slice(<= #char "a" { + if get_foldcase(ip.*) && lo <= #char "z" && hi >= #char "a" { foldlo := lo; foldhi := hi; if foldlo < #char "a" { @@ -447,11 +447,11 @@ compute_byte_map :: (using prog: *Prog) { } // If this Inst is not the last Inst in its list AND the next Inst is // also a ByteRange AND the Insts have the same out, defer the merge. - if !get_last(< rootmap: Sparse_Array(int), predmap: Sparse_Array(int), preds_list: [..] [..] int { get_or_add_preds :: (preds_list: *[..] [..] int, predmap: *Sparse_Array(int), id: int) -> *[..] int { preds: * [..] int; - if !contains(<= 0 && !(<= 0 && !(splits.*)[lo] { set_bit(splits, lo); - next := find_next_set_bit(<= #char "a" { + if get_foldcase(ip.*) && lo <= #char "z" && hi >= #char "a" { foldlo := lo; foldhi := hi; if (foldlo < #char "a") { diff --git a/simplify.jai b/simplify.jai index 2307076..9d22f9b 100644 --- a/simplify.jai +++ b/simplify.jai @@ -189,12 +189,12 @@ can_coalesce :: (r1: *Regexp_Node, r2: *Regexp_Node) -> bool { do_coalesce :: (pool: *Regexp_Pool, r1ptr: **Regexp_Node, r2ptr: **Regexp_Node) { leave_empty :: (r1ptr: **Regexp_Node, r2ptr: **Regexp_Node, pool: *Regexp_Pool, nre: *Regexp_Node) { // @ToDo, @Speed: Why don’t we set this to null instead of allocing a temporary new regexp? - < T, stopped_early: bool { do_visit :: (ctx: C, stack: *[..] Walk_State(T), w: *Walk(C, T)) -> T, stopped_early: bool, done: bool { - s := *(<