Skip to content

Commit

Permalink
improvements to calt, primarily reducing substitutions
Browse files Browse the repository at this point in the history
closes #193
  • Loading branch information
rsms committed Sep 7, 2019
1 parent 8215408 commit d8d4e0c
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 23 deletions.
22 changes: 18 additions & 4 deletions docs/lab/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
\u215F\u2080\u2081\u2082\u2083\u2084\u2085\u2086\u2087\u2088\u2089
Arbitrary fractions with frac feature:
1/2 1/4 3/4 5/6 7/8 1/8 5/8 3/8
1/2 1/4 3/4 5/6 7/8 1/8 5/8 3/8 18/29 16/5
0/0 451/980 000/000 0000000000/0000000000
Arbitrary fractions of "onefraction" with frac feature:
Expand Down Expand Up @@ -231,8 +231,8 @@


samples.set('Feature: calt', `
(m) (M) (6) [m] [M] [6] {m} {M} {6}
m@n M@N
(m). (M). (6). [m]. [M]. [6]. {m}. {M}. {6}.
m@n. M@N
3×5 3 × 5 ×9 8×
3−5 3 − 5 −5 8− 3+5 +5 3+
3÷5 3 ÷ 5 ÷5 8÷ 3±5 ±5 8±
Expand Down Expand Up @@ -283,7 +283,7 @@
@@@@@@M@@@@@@
++++++M++++++
x[x] [X] x lc x lc followed by .case C .case
x[x]. [X] x lc x lc followed by .case C .case
(Xx) lc uc uc lc
[Zzz] lc uc lc lc lc
(XX)
Expand All @@ -294,6 +294,20 @@
()M
X(_) .case around underscore next to uc
(_) lc otherwise
Foo::Bar() foo::bar() Foo
foo::bar( ) Foo
foo::bar()Foo
foo::bar( )Foo
FOO::bar This is (a)Thing
:: dog :: Kitten
:: dog ::: Kitten
::Kitten
::8::
:8
X() X()
x- X
x -- X
`)


Expand Down
55 changes: 36 additions & 19 deletions src/features/calt.fea
Original file line number Diff line number Diff line change
Expand Up @@ -158,32 +158,50 @@ sub [colon colon.case] @DASH parenright' by parenright.case;
# ignore subs adjacent to lower case
#
# x[]X
ignore sub @LC @CASE_DELIM_L @CASE_DELIM_L @UC;
ignore sub @LC @CASE_DELIM_L @UC;
ignore sub @LC @CASE_DELIM_L @Whitespace @UC;
ignore sub @LC @CASE_DELIM_L @Whitespace @Whitespace @UC;
ignore sub @LC @CASE_DELIM_L @CASE_DELIM_L @UC; # x[]X
ignore sub @LC @CASE_DELIM_L @UC; # x[X
ignore sub @LC @CASE_DELIM_L @Whitespace @UC; # x[ X
ignore sub @LC @CASE_DELIM_L @Whitespace @Whitespace @UC; # x[ X
ignore sub @LC @CASE_DELIM_L @CASE_DELIM_L @Whitespace @UC; # x[] X
ignore sub @LC @CASE_DELIM_L @CASE_DELIM_L @Whitespace @Whitespace @UC; # x[] X
#
# short runs of uc-lc, e.g "(Xx)", "[Zzz]"
ignore sub @CASE_DELIM_L @UC @LC @CASE_DELIM_L;
ignore sub @CASE_DELIM_L @UC @All @LC @CASE_DELIM_L;
ignore sub @CASE_DELIM_L @LC @UC @CASE_DELIM_L;
ignore sub @CASE_DELIM_L @LC @All @UC @CASE_DELIM_L;
# short runs of uc-lc, e.g "(Xx)", "[xxX]"
ignore sub @CASE_DELIM_L @UC @LC @CASE_DELIM_L; # (Xx)
ignore sub @CASE_DELIM_L @UC @All @LC @CASE_DELIM_L; # (X.x)
ignore sub @CASE_DELIM_L @LC @UC @CASE_DELIM_L; # (xX)
ignore sub @CASE_DELIM_L @LC @All @UC @CASE_DELIM_L; # (x.X)
#
# e.g. "x-"
# TODO: figure out how to ignore "x--A"
ignore sub @LC @CASE_L;
ignore sub @LC @CASE_L'; # x-
ignore sub @LC [@CASE_L @Whitespace] @CASE_L'; # x--, x -
ignore sub @LC [@CASE_L @Whitespace] [@CASE_L @Whitespace] @CASE_L'; # x---, x --, x -, x- -
ignore sub @LC
[@CASE_L @Whitespace]
[@CASE_L @Whitespace]
[@CASE_L @Whitespace]
@CASE_L'; # x----, x ---, x --, x -, x- --, x- -, x-- -
ignore sub @LC
[@CASE_L @Whitespace]
[@CASE_L @Whitespace]
[@CASE_L @Whitespace]
[@CASE_L @Whitespace]
@CASE_L'; # x----- ...
#
# e.g. "-x", "--x", "---x", "----x", "-----x"
ignore sub @CASE_L @LC;
ignore sub @CASE_L @CASE_L @LC;
ignore sub @CASE_L @CASE_L @CASE_L @LC;
ignore sub @CASE_L @CASE_L @CASE_L @CASE_L @LC;
ignore sub @CASE_L @CASE_L @CASE_L @CASE_L @CASE_L @LC;
# e.g. "x- "
ignore sub @LC @CASE_L' @Whitespace; # "x- "
ignore sub @LC @CASE_L' @Whitespace @Whitespace; # "x- "
#
# e.g. "-x"
ignore sub @CASE_L @LC; # -x
ignore sub @CASE_L @CASE_L @LC; # --x
ignore sub @CASE_L @CASE_L @CASE_L @LC; # ---x
ignore sub @CASE_L @CASE_L @CASE_L @CASE_L @LC; # ----x
ignore sub @CASE_L @CASE_L @CASE_L @CASE_L @CASE_L @LC; # -----x

#
# pairs with space, e.g. "( ) M" since we don't support subbing
# all on the left side.
ignore sub @CASE_DELIM_L @Whitespace @CASE_DELIM_L @Whitespace [ @UC @CASE_R ];
ignore sub @CASE_DELIM_L @CASE_DELIM_L @Whitespace [ @UC @CASE_R ];
#
# e.g. "A-", "A -", "A -"
sub [ @UC @CASE_R ] @CASE_L' by @CASE_R;
Expand Down Expand Up @@ -218,7 +236,6 @@ sub @CASE_L' @CASE_L @Whitespace @Whitespace [ @CASE_R @UC ] by @CASE_R;
sub @CASE_L' @CASE_L @CASE_L @Whitespace @Whitespace [ @CASE_R @UC ] by @CASE_R;
sub @CASE_L' @CASE_L @CASE_L @CASE_L @Whitespace @Whitespace [ @CASE_R @UC ] by @CASE_R;
sub @CASE_L' @CASE_L @CASE_L @CASE_L @CASE_L @Whitespace @Whitespace [ @CASE_R @UC ] by @CASE_R;
sub @CASE_L' @Whitespace @Whitespace @Whitespace [ @UC @CASE_R ] by @CASE_R; # e.g. "- A"

# X(_)
@Punctuation = [
Expand Down

0 comments on commit d8d4e0c

Please sign in to comment.