Skip to content

Commit

Permalink
Add :InFoo block shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Dec 23, 2011
1 parent 7450fe2 commit 2f49fa3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/UCD.cs
Expand Up @@ -42,9 +42,13 @@ class LimitedProperty : Property {

public Property Proxify(bool neg, string prefix) {
string[][] nvalues = new string[values.Length][];
prefix = prefix.Substring(prefix.IndexOf('+')+1);
for (int i = 0; i < nvalues.Length; i++) {
//Console.WriteLine("{0}/{1}", values[i][0], prefix);
bool ok = values[i][0].Substring(0, prefix.Length) == prefix;
bool ok = (prefix.Length <= 1) ?
values[i][0].Substring(0, prefix.Length) == prefix :
StringProperty.Loosen(values[i][0]) ==
StringProperty.Loosen(prefix);
nvalues[i] = (neg ? !ok : ok) ? YES : NO;
}

Expand Down Expand Up @@ -382,10 +386,11 @@ static class DataSet {
//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") {
if (tbl == "sc" || tbl == "gc" || tbl == "blk") {
foreach (string a in aset)
aliases[StringProperty.Loosen(a)] = canon;
proxy_aliases[canon] = tbl == "sc" ? "Script" : tbl;
aliases[(tbl == "blk" ? "IN" : "") +
StringProperty.Loosen(a)] = tbl + "+" + canon;
proxy_aliases[tbl+"+"+canon] = tbl == "sc" ? "Script" : tbl;
}
aset.Clear();
}
Expand Down Expand Up @@ -533,10 +538,10 @@ static class DataSet {

if (name == "ASSIGNED")
return cache[name] = ((LimitedProperty) GetTable("gc"))
.Proxify(true, "Cn");
.Proxify(true, "+Cn");
if (name == "ANY")
return cache[name] = ((LimitedProperty) GetTable("gc"))
.Proxify(false, "");
.Proxify(false, "+");
if (name == "ASCII")
return cache[name] = new LimitedProperty(
new int[] { 0, 1, 128, 0 },
Expand Down
1 change: 1 addition & 0 deletions t/spectest.data
Expand Up @@ -213,6 +213,7 @@ S05-grammar/protoregex.t
S05-grammar/signatures.t
S05-interpolation/lexicals.t
S05-mass/named-chars.t
S05-mass/properties-block.t
S05-mass/properties-general.t
S05-mass/properties-script.t
S05-mass/recursive.t
Expand Down

0 comments on commit 2f49fa3

Please sign in to comment.