Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Fogapod committed Feb 17, 2024
1 parent ceaa57f commit df848ff
Showing 1 changed file with 28 additions and 21 deletions.
49 changes: 28 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ Full reference:
```ron
(
// main list of passes
accent: [
accent: {
// `words` are applied before `patterns`
(
// names must be unique. they are used if you want to extend accent
name: "words",
// pass names must be unique. they are used if you want to extend accent
"words": (
// this optional field instructs all regexes inside this pass to be wrapped in \b
format: r"\b{}\b",
Expand All @@ -48,8 +46,23 @@ Full reference:
r"(a)(?P<b_group>b)": {"Literal": "$b_group$a"},
},
),
(
name: "patterns",
// second pass
"patterns": (
rules: {
// lowercases all `p` letters (use "p" match from `Original`, then lowercase)
// note that this will still be uppercase for single letter "P" match because of
// case mimicking. there is currently no way to disable it
"p": {"Lower": {"Original": ()}},
// uppercases all `m` letters, undoing previous operation
"m": {"Upper": {"Original": ()}},
},
),
// third pass. note that ^ and $ will conflict with patterns at beginning and end of strings because of regex merging.
// these should be defined separately
"ending": (
rules: {
// inserts one of the honks. first value of `Weights` is relative weight. higher is better
"$": {"Weights": {
Expand All @@ -59,34 +72,28 @@ Full reference:
// ultra rare sigma honk - 1 / 56
01: {"Literal": " HONK HONK HONK HONK!!!!!!!!!!!!!!!"},
}},
// lowercases all `p` letters (use "p" match from `Original`, then lowercase)
"p": {"Lower": {"Original": ()}},
// uppercases all `p` letters, undoing previous operation
"P": {"Upper": {"Original": ()}},
},
),
],
},
// accent can be used with intensity (non negative value). higher intensities can either extend
// lower level or completely replace it.
// default intensity is 0. higher ones are defined here
intensities: {
// extends previous intensity (level 0, base one in this case), adding additional rules
// below existingones. passes keep their relative order, rules inside passes also preserve order
1: Extend([
(
name: "words",
1: Extend({
"words": (
format: r"\b{}\b",
rules: {
// even though we are extending, defining same rule will overwrite result.
// relative order of rules remain the same: "windows" will remain first
"windows": {"Literal": "bloatware"},
},
),
(
// extend "patterns", adding 1 more rule
// extend "patterns", adding 1 more rule
"patterns": (
name: "patterns",
rules: {
// tags can be nested arbitrarily
Expand All @@ -105,10 +112,10 @@ Full reference:
}},
},
),
]),
}),
// replace intensity 1 entirely. in this case with nothing. remove all rules on intensity 2+
2: Replace([]),
2: Replace({}),
},
)
```
Expand Down

0 comments on commit df848ff

Please sign in to comment.