<commit_before>import { RulesWriting, RuleBlockWriting, RuleWriting, compile } from './formatter/ruleCompiler';
import { ElementType } from './formatter/analyst';

let ruleVariables = {
    //line begin
    LB: /^\s*/.source,
    //line end
    LE: /\s*$/.source,
    ArrowLeft: /(?:(?:(?:\s+[ox]|[+*])|(?:<\|?|<<|\\\\|\\|\/\/|\})|(?:\s+[ox]|[+*])(?:<\|?|<<|\\\\|\\|\/\/|\}))(?=[-.]))/.source,
    ArrowRight: /(?:(?:\|?>|>>|\\\\|\\|\/\/|\{)|(?:[ox]\s+|[+*])|(?:\|?>|>>|\\\\|\\|\/\/|\{)(?:[ox]\s+|[+*]))/.source,
    Color: /(?:\#(?:[0-9a-f]{6}|[0-9a-f]{3}|\w+)(?:[-\\\/](?:[0-9a-f]{6}|[0-9a-f]{3}|\w+))?)/.source
}

let rules = <RulesWriting>{
    includes: ["Quoted", "Block"],
    blocks: [
        {
            name: "Quoted",
            rules: [
                {
                    comment: "quoted string",
                    begin: /"/i,
                    end: /"/i,
                    beginCaptures: {
                        0: ElementType.punctLeftSpace
                    },
                    endCaptures: {
                        0: ElementType.punctRightSpace
                    },
                    patterns: {
                        type: ElementType.asIs
                    }
                },
                {
                    comment: "quoted activity definition",
                    match: /{{LB}}(:)(.*)([;|<>/\]}]){{LE}}/i,
                    captures: {
                        1: ElementType.punctLeftSpace,
                        2: ElementType.asIs,
                        3: ElementType.punctRightSpace,
                    }
                },
                {
                    comment: "quoted usecase user definition",
                    match: /(:)([^:]+)(:)/i,
                    captures: {
                        1: ElementType.punctLeftSpace,
                        2: ElementType.asIs,
                        3: ElementType.punctRightSpace,
                    }
                },
                {
                    comment: "quoted component definition",
                    match: /(\[)([^\[\]]+)(\])/i,
                    captures: {
                        1: ElementType.punctLeftSpace,
                        2: ElementType.asIs,
                        3: ElementType.punctRightSpace,
                    }
                },
                {
                    comment: "quoted <> <<>>",
                    match: /(<<?)([^<>]+)(>>?)/i,
                    captures: {
                        1: ElementType.punctLeftSpace,
                        2: ElementType.asIs,
                        3: ElementType.punctRightSpace,
                    }
                },
            ]
        },
        {
            name: "Block",
            rules: [
                {
                    comment: "block {}",
                    isBlock: true,
                    begin: /\{[!#+T*-/]?/i,
                    end: /\}/i,
                    patterns: {
                        includes: ["Quoted", "Block"],
                    }
                },
                {
                    comment: "block multiple note",<commit_msg>fix curly braces relationship format, solve #108<commit_after>import { RulesWriting, RuleBlockWriting, RuleWriting, compile } from './formatter/ruleCompiler';
import { ElementType } from './formatter/analyst';

let ruleVariables = {
    //line begin
    LB: /^\s*/.source,
    //line end
    LE: /\s*$/.source,
    ArrowLeft: /(?:(?:(?:\s+[ox]|[+*])|(?:<\|?|<<|\\\\|\\|\/\/|\})|(?:\s+[ox]|[+*])(?:<\|?|<<|\\\\|\\|\/\/|\}))(?=[-.]))/.source,
    ArrowRight: /(?:(?:\|?>|>>|\\\\|\\|\/\/|\{)|(?:[ox]\s+|[+*])|(?:\|?>|>>|\\\\|\\|\/\/|\{)(?:[ox]\s+|[+*]))/.source,
    Color: /(?:\#(?:[0-9a-f]{6}|[0-9a-f]{3}|\w+)(?:[-\\\/](?:[0-9a-f]{6}|[0-9a-f]{3}|\w+))?)/.source
}

let rules = <RulesWriting>{
    includes: ["Quoted", "Block"],
    blocks: [
        {
            name: "Quoted",
            rules: [
                {
                    comment: "quoted string",
                    begin: /"/i,
                    end: /"/i,
                    beginCaptures: {
                        0: ElementType.punctLeftSpace
                    },
                    endCaptures: {
                        0: ElementType.punctRightSpace
                    },
                    patterns: {
                        type: ElementType.asIs
                    }
                },
                {
                    comment: "quoted activity definition",
                    match: /{{LB}}(:)(.*)([;|<>/\]}]){{LE}}/i,
                    captures: {
                        1: ElementType.punctLeftSpace,
                        2: ElementType.asIs,
                        3: ElementType.punctRightSpace,
                    }
                },
                {
                    comment: "quoted usecase user definition",
                    match: /(:)([^:]+)(:)/i,
                    captures: {
                        1: ElementType.punctLeftSpace,
                        2: ElementType.asIs,
                        3: ElementType.punctRightSpace,
                    }
                },
                {
                    comment: "quoted component definition",
                    match: /(\[)([^\[\]]+)(\])/i,
                    captures: {
                        1: ElementType.punctLeftSpace,
                        2: ElementType.asIs,
                        3: ElementType.punctRightSpace,
                    }
                },
                {
                    comment: "quoted <> <<>>",
                    match: /(<<?)([^<>]+)(>>?)/i,
                    captures: {
                        1: ElementType.punctLeftSpace,
                        2: ElementType.asIs,
                        3: ElementType.punctRightSpace,
                    }
                },
            ]
        },
        {
            name: "Block",
            rules: [
                {
                    comment: "block {}",
                    isBlock: true,
                    begin: /({{LB}}|[^-])\{[!#+T*-/]?/i,
                    end: /\}(?!-)/i,
                    patterns: {
                        includes: ["Quoted", "Block"],
                    }
                },
                {
                    comment: "block multiple note",
{'fraction_non_alphanumeric': 0.1906732452650008, 'fraction_numerical': 0.008753780041381505, 'mean_word_length': 0.8853885388538854, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4110667', 'n_tokens_mistral': 1852, 'n_tokens_neox': 1683, 'n_words': 251}