# ------------------------------------------------------------------------------------- # BEGIN glyph class definitions @DASH = [ hyphen endash emdash ]; @DASH_CASE = [ hyphen.case endash.case emdash.case ]; @DASH_ANY = [ @DASH @DASH_CASE ]; # cap-height tall glyphs @UC = [ @Uppercase @Numeral # punctuation ampersand exclam exclamdbl exclamdown uni2049 question uni2047 uni2048 questiondown interrobang invertedinterrobang bar paragraph # currency dollar cent yen sterling florin uni20BA uni20BD euro uni20B9 tenge peseta peso kip won lira austral hryvnia naira guarani coloncurrency cedi cruzeiro tugrik uni20AF mill afii57636 manat rupee lari franc # cap-tall symbols numero triagrt triagdn triagup warningSign blackleftpointingtriangle circleblack circlewhite diamondblack diamondblack_x diamondwhite diamondwhite_x sunWithRays blackSunWithRays heartWhiteSuit heartBlackSuit heavyBlackHeart upBlackArrow upWhiteArrow capslock placeofinterestsign control projective option alternativekeysymbol brokenCircleNorthWestArrow anticlockwiseOpenCircleArrow clockwiseOpenCircleArrow deleteleft deleteright clear ejectsymbol # percent and fractions onehalf onethird onequarter threequarters fivesixths onefraction seveneighths oneeighth fiveeighths threeeighths percent perthousand pertenthousand uni214D cadauna careof accountof addresssubject ]; # x-height tall glyphs @LC = [ @Lowercase ]; @CASE_L = [ braceleft braceright bracketleft bracketright parenleft parenright asterisk at multiply minus plus plusminus divide equal notequal endash figuredash emdash hyphen bullet openbullet hyphenbullet trianglebullet blackleftbullet blackrightbullet blackSmallSquare leftArrow leftLongArrow leftLongArrow2 leftDoubleArrow leftLongDoubleArrow rightArrow rightLongArrow rightLongArrow2 rightDoubleArrow rightLongDoubleArrow leftRightArrow leftRightLongArrow leftRightDoubleArrow leftRightLongDoubleArrow northEastArrow southEastArrow southWestArrow northWestArrow colon approxequal asciitilde less greater lessequal greaterequal ]; @CASE_R = [ braceleft.case braceright.case bracketleft.case bracketright.case parenleft.case parenright.case asterisk.case at.case multiply.case minus.case plus.case plusminus.case divide.case equal.case notequal.case endash.case figuredash.case emdash.case hyphen.case bullet.case openbullet.case hyphenbullet.case trianglebullet.case blackleftbullet.case blackrightbullet.case blackSmallSquare.case leftArrow.case leftLongArrow.case leftLongArrow2.case leftDoubleArrow.case leftLongDoubleArrow.case rightArrow.case rightLongArrow.case rightLongArrow2.case rightDoubleArrow.case rightLongDoubleArrow.case leftRightArrow.case leftRightLongArrow.case leftRightDoubleArrow.case leftRightLongDoubleArrow.case northEastArrow.case southEastArrow.case southWestArrow.case northWestArrow.case colon.case approxequal.case asciitilde.case less.case greater.case lessequal.case greaterequal.case ]; @Punctuation = [ slash bar quoteleft quoteright quotesingle quotedbl quotedblleft quotedblright quotedblbase quotesinglbase prime doubleprime tripleprime quadrupleprime primerev doubleprimerev tripleprimerev primemod doubleprimemod comma period ellipsis twodotleader semicolon underscore asciicircum circumflex asterisk ]; # END glyph class definitions # ------------------------------------------------------------------------------------- # BEGIN arrow replacements # ---> sub @DASH @DASH @DASH greater by rightLongArrow2; sub @DASH_ANY @DASH_ANY @DASH_ANY greater.case by rightLongArrow2.case; # --> sub @DASH @DASH greater by rightLongArrow; sub @DASH_ANY @DASH_ANY greater.case by rightLongArrow.case; # [endash emdash]-> (legacy) sub [endash emdash] greater by rightLongArrow; sub [endash emdash endash.case emdash.case] greater.case by rightLongArrow.case; # -> sub hyphen greater by rightArrow; sub [hyphen hyphen.case] greater.case by rightArrow.case; # <--- sub less @DASH @DASH @DASH by leftLongArrow2; sub less.case @DASH_ANY @DASH_ANY @DASH_ANY by leftLongArrow2.case; # <-- sub less @DASH @DASH by leftLongArrow; sub less.case @DASH_ANY @DASH_ANY by leftLongArrow.case; # <-[endash emdash] (legacy) sub less [endash emdash] by leftLongArrow; sub less.case [endash emdash endash.case emdash.case] by leftLongArrow.case; # ignore e.g. "<-3" ("less than negative") ignore sub less' hyphen' @Numeral; ignore sub less.case' [hyphen hyphen.case]' @Numeral; # <- sub less' hyphen' by leftArrow; sub less.case' [hyphen hyphen.case]' by leftArrow.case; # <-> sub less rightArrow by leftRightArrow; # <,-> sub [less less.case] rightArrow.case by leftRightArrow.case; sub leftArrow greater by leftRightArrow; # <-,- sub leftArrow.case [greater greater.case] by leftRightArrow.case; # <--> sub less rightLongArrow by leftRightLongArrow; # <,--> sub [less less.case] rightLongArrow.case by leftRightLongArrow.case; sub leftLongArrow greater by leftRightLongArrow; # <--,> sub leftLongArrow.case [greater greater.case] by leftRightLongArrow.case; # <=> sub less equal greater by leftRightDoubleArrow; sub less.case [equal equal.case] [greater greater.case] by leftRightDoubleArrow.case; sub less equal equal greater by leftRightLongDoubleArrow; sub less.case [equal equal.case] [equal equal.case] [greater greater.case] by leftRightLongDoubleArrow.case; # => sub equal equal greater by rightLongDoubleArrow; sub [equal equal.case] [equal equal.case] greater.case by rightLongDoubleArrow.case; sub equal greater by rightDoubleArrow; sub [equal equal.case] greater.case by rightDoubleArrow.case; # <== sub less equal equal by leftLongDoubleArrow; sub less.case [equal equal.case] [equal equal.case] by leftLongDoubleArrow.case; # Note: We do NOT (sub less equal by leftDoubleArrow) as that would # interfere with "<=" (less than or equal to) # END arrow replacements # ------------------------------------------------------------------------------------- # BEGIN smiley # :-) sub colon' [ @DASH_ANY minus minus.case bullet ] [parenright parenright.case] by colon.case; sub [colon colon.case] hyphen' [parenright parenright.case] by hyphen.case; sub [colon colon.case] endash' [parenright parenright.case] by endash.case; sub [colon colon.case] emdash' [parenright parenright.case] by emdash.case; sub [colon colon.case] bullet' [parenright parenright.case] by bullet.case; sub [colon colon.case] [ @DASH_ANY minus minus.case bullet ] parenright' by parenright.case; # END smiley # ------------------------------------------------------------------------------------- # BEGIN case # Force lower-case parens if any one is lower case. # I.e. right paren in "(abC)" is always lower case. ignore sub parenleft @All @All parenright' ; # "(aB)" ignore sub parenleft @All @All @All parenright' ; # "(abC)" ignore sub parenleft @All @All @All @All parenright' ; # "(abcD)" ignore sub parenleft @All @All @All @All @All parenright' ; # "(abcdE)" ignore sub parenleft @All @All @All @All @All @All parenright' ; # "(abcdeF)" ignore sub braceleft @All @All braceright' ; # "{aB}" ignore sub braceleft @All @All @All braceright' ; # "{abC}" ignore sub braceleft @All @All @All @All braceright' ; # "{abcD}" ignore sub braceleft @All @All @All @All @All braceright' ; # "{abcdE}" ignore sub braceleft @All @All @All @All @All @All braceright' ; # "{abcdeF}" ignore sub bracketleft @All @All bracketright' ; # "[aB]" ignore sub bracketleft @All @All @All bracketright' ; # "[abC]" ignore sub bracketleft @All @All @All @All bracketright' ; # "[abcD]" ignore sub bracketleft @All @All @All @All @All bracketright' ; # "[abcdE]" ignore sub bracketleft @All @All @All @All @All @All bracketright' ; # "[abcdeF]" # "3+" EXCEPT "3+" ignore sub @UC @CASE_L' @LC; ignore sub @UC @CASE_L' @Whitespace @LC; ignore sub @UC @CASE_L' @Whitespace @Whitespace @LC; sub @UC @CASE_L' by @CASE_R; # "+3" EXCEPT "+3" (including backtrack, e.g. "---X") ignore sub @LC @CASE_L' @UC; # "x-X" ignore sub @LC @CASE_L @CASE_L' @UC; # "x--X" ignore sub @LC @CASE_L @CASE_L @CASE_L' @UC; # "x---X" ignore sub @LC @CASE_L @CASE_L @CASE_L @CASE_L' @UC; # "x---X" ignore sub @LC @CASE_L @CASE_L @CASE_L @CASE_L @CASE_L' @UC; # "x----X" ignore sub @LC @CASE_L' @CASE_L @UC; # "x-" sub @CASE_L' @UC by @CASE_R; sub @CASE_L' @CASE_L @UC by @CASE_R; sub @CASE_L' @CASE_L @CASE_L @UC by @CASE_R; sub @CASE_L' @CASE_L @CASE_L @CASE_L @UC by @CASE_R; sub @CASE_L' @CASE_L @CASE_L @CASE_L @CASE_L @UC by @CASE_R; # "A-B", "A- B", "A- B" sub @UC @CASE_L' @UC by @CASE_R; sub @UC @CASE_L' @Whitespace @UC by @CASE_R; sub @UC @CASE_L' @Whitespace @Whitespace @UC by @CASE_R; # "A -B", "A - B", "A - B" sub @UC @Whitespace @CASE_L' @UC by @CASE_R; sub @UC @Whitespace @CASE_L' @Whitespace @UC by @CASE_R; sub @UC @Whitespace @CASE_L' @Whitespace @Whitespace @UC by @CASE_R; # "A -B", "A - B", "A - B" sub @UC @Whitespace @Whitespace @CASE_L' @UC by @CASE_R; sub @UC @Whitespace @Whitespace @CASE_L' @Whitespace @UC by @CASE_R; sub @UC @Whitespace @Whitespace @CASE_L' @Whitespace @Whitespace @UC by @CASE_R; # cascade sub @CASE_R @CASE_L' by @CASE_R; # unconditional parenright.case if opening paren is parenleft.case # e.g. "(Abc)" = /parenleft.case/A/b/c/parenright.case sub parenleft.case @All @All parenright' by parenright.case; sub parenleft.case @All @All @All parenright' by parenright.case; sub parenleft.case @All @All @All @All parenright' by parenright.case; sub parenleft.case @All @All @All @All @All parenright' by parenright.case; sub parenleft.case @All @All @All @All @All @All parenright' by parenright.case; sub braceleft.case @All @All braceright' by braceright.case; sub braceleft.case @All @All @All braceright' by braceright.case; sub braceleft.case @All @All @All @All braceright' by braceright.case; sub braceleft.case @All @All @All @All @All braceright' by braceright.case; sub braceleft.case @All @All @All @All @All @All braceright' by braceright.case; sub bracketleft.case @All @All bracketright' by bracketright.case; sub bracketleft.case @All @All @All bracketright' by bracketright.case; sub bracketleft.case @All @All @All @All bracketright' by bracketright.case; sub bracketleft.case @All @All @All @All @All bracketright' by bracketright.case; sub bracketleft.case @All @All @All @All @All @All bracketright' by bracketright.case; # END case # ------------------------------------------------------------------------------------- # BEGIN NxN # x surrounded by numbers, e.g: # 3x4 -> 3×4 # 10x20 -> 10×20 # 0x10 -> 0x10 No substitution # @NumNoZero = [ one two three four five six seven eight nine one.ss01 three.1 four.ss01 six.ss01 nine.ss01 one.tf two.tf three.tf four.tf five.tf six.tf seven.tf eight.tf nine.tf one.tf.ss01 three.1.tf four.tf.ss01 six.tf.ss01 nine.tf.ss01 ]; sub @NumNoZero x' @Numeral by multiply.case; # "3x9" "1x0" sub @Numeral @Numeral x' @Numeral by multiply.case; # "10x0" sub @NumNoZero @Whitespace x' @Numeral by multiply.case; # "3 x9" "1 x0" sub @NumNoZero @Whitespace x' @Whitespace @Numeral by multiply.case; # "3 x 9" "1 x 0" sub @NumNoZero x' @Whitespace @Numeral by multiply.case; # "3x 9" "1x 0" sub @Numeral @Numeral @Whitespace x' @Numeral by multiply.case; # "10 x0" sub @Numeral @Numeral @Whitespace x' @Whitespace @Numeral by multiply.case; # "10 x 0" sub @Numeral @Numeral x' @Whitespace @Numeral by multiply.case; # "10x 0" # END NxN # -------------------------------------------------------------------------------------