コード例 #1
0
        private static SymbolBase GetMatcherOutcomeSymbol(
            Grammar grammar,
            ICilSymbolResolver symbolResolver,
            CilSymbolRef mainOutcome,
            IEnumerable <CilSymbolRef> allOutcomes)
        {
            Symbol main = symbolResolver.GetSymbol(mainOutcome);

            Symbol[] all = (from outcome in allOutcomes
                            select symbolResolver.GetSymbol(outcome))
                           .ToArray();

            switch (all.Length)
            {
            case 0:  return(null);

            case 1:  return(main);

            default: return(new AmbiguousSymbol(main, all));
            }
        }
コード例 #2
0
        private static SymbolBase GetMatcherOutcomeSymbol(
            Grammar                   grammar,
            ICilSymbolResolver        symbolResolver,
            CilSymbolRef              mainOutcome,
            IEnumerable<CilSymbolRef> allOutcomes)
        {
            Symbol main = symbolResolver.GetSymbol(mainOutcome);
            Symbol[] all = (from outcome in allOutcomes
                             select symbolResolver.GetSymbol(outcome))
                             .ToArray();

            switch (all.Length)
            {
                case 0:  return null;
                case 1:  return main;
                default: return new AmbiguousSymbol(main, all);
            }
        }