diff --git a/lib/UCD.cs b/lib/UCD.cs index e4b03be1..4a4b6209 100644 --- a/lib/UCD.cs +++ b/lib/UCD.cs @@ -37,6 +37,20 @@ class LimitedProperty : Property { this.values = values; } + public Property Proxify(string prefix) { + var va0 = new string[] { "N", "No", "F", "False" }; + var va1 = new string[] { "Y", "Yes", "T", "True" }; + + string[][] nvalues = new string[values.Length][]; + for (int i = 0; i < nvalues.Length; i++) { + nvalues[i] = + values[i][0].Substring(0, prefix.Length) == prefix + ? va1 : va0; + } + + return new LimitedProperty(data, nvalues); + } + public override string GetValue(int cp) { int lix = 0; int hix = data.Length / 2; @@ -267,6 +281,7 @@ static class DataSet { static byte[] bits; static Dictionary directory; static Dictionary aliases; + static Dictionary proxy_aliases; static Dictionary,string[]> val_aliases; static string[] tokens; static bool Trace; @@ -339,6 +354,7 @@ static class DataSet { int[] loc = directory["!PropertyAlias"]; aliases = new Dictionary(); val_aliases = new Dictionary,string[]>(); + proxy_aliases = new Dictionary(); int rpos = loc[2]; while (rpos < loc[3]) { @@ -364,6 +380,12 @@ static class DataSet { aset.Add(alias); //if (Trace) Console.WriteLine("Alias {0},{1} -> {2}", tbl, canon, Kernel.JoinS(", ", aset)); val_aliases[Prod.C(tbl, canon)] = aset.ToArray(); + + if (tbl == "sc" || tbl == "gc") { + foreach (string a in aset) + aliases[a] = canon; + proxy_aliases[canon] = tbl; + } aset.Clear(); } } @@ -502,6 +524,9 @@ static class DataSet { if (cache.TryGetValue(name, out r)) return r; + if (proxy_aliases.TryGetValue(name, out a)) + return cache[name] = ((LimitedProperty) GetTable(a)).Proxify(name); + if (name == "!inverse_name") { var inv = (GetTable("na") as StringProperty).MakeInverseMap(); var na1 = GetTable("na1") as StringProperty; diff --git a/t/spectest.data b/t/spectest.data index 8a067365..df0538a0 100644 --- a/t/spectest.data +++ b/t/spectest.data @@ -213,6 +213,7 @@ S05-grammar/protoregex.t S05-grammar/signatures.t S05-interpolation/lexicals.t S05-mass/named-chars.t +S05-mass/properties-script.t S05-mass/recursive.t S05-mass/rx.t S05-mass/stdrules.t