Beispiel #1
0
        static string RevChunk(string x, Rep[] ρ, bool ignoreConflicts)
        {
            string[]      tokens    = x.Tokenize();
            List <string> conflicts = null;

            foreach (var r in ρ)
            {
                try{
                    tokens = Rep.Rev(tokens, r, ignoreConflicts);
                    // TODO - not ready for this
                    tokens = Modifiers.NitpickSegment(tokens);
                }catch (InvOp ex) {
                    if (conflicts == null)
                    {
                        conflicts = new List <string>();
                    }
                    conflicts.Add(ex.Message);
                }
            }
            if (conflicts != null)
            {
                throw
                    new InvOp("\n" + conflicts.ToArray().Join('\n'));
            }
            return(tokens.Join());
        }
Beispiel #2
0
 public static string[] operator /(string[] tokens, Rep rule) => Rep.Rev(tokens, rule);