Exemplo n.º 1
0
Arquivo: Grammar.cs Projeto: zgf/VBF
        public static ProductionBase <T2> Second <T1, T2>(this ProductionBase <Tuple <T1, T2> > tupleProduction)
        {
            CodeContract.RequiresArgumentNotNull(tupleProduction, "tupleProduction");

            return(tupleProduction.Select(t => t.Item2));
        }
Exemplo n.º 2
0
Arquivo: Parsers.cs Projeto: zgf/VBF
        public static Parser <IEnumerable <Lexeme> > Many(this Token token)
        {
            CodeContract.RequiresArgumentNotNull(token, "token");

            return(token.AsParser().Many());
        }
Exemplo n.º 3
0
Arquivo: Parsers.cs Projeto: zgf/VBF
        public static Parser <IEnumerable <Lexeme> > Many <TSeparator>(this Token token, Parser <TSeparator> separator)
        {
            CodeContract.RequiresArgumentNotNull(token, "parser");

            return(token.AsParser().Many(separator));
        }
 /// <summary>
 /// Internal constructor for unit testing.
 /// </summary>
 internal TelemetryNotificationService(ITelemetryNotificationProvider provider)
 {
     CodeContract.RequiresArgumentNotNull <ITelemetryNotificationProvider>(provider, "provider");
     this.provider = provider;
 }
Exemplo n.º 5
0
Arquivo: Parsers.cs Projeto: zgf/VBF
        public static Parser <T2> Second <T1, T2>(this Parser <Tuple <T1, T2> > tupleParser)
        {
            CodeContract.RequiresArgumentNotNull(tupleParser, "tupleParser");

            return(tupleParser.Select(t => t.Item2));
        }
Exemplo n.º 6
0
 /// <summary>
 ///     Creates an instance of the IdentitiyInformatinoProvider
 /// </summary>
 protected IdentityInformationProvider(Func <IPersistentPropertyBag> createStore)
 {
     CodeContract.RequiresArgumentNotNull <Func <IPersistentPropertyBag> >(createStore, "createStore");
     lazyMachineStore       = new Lazy <IPersistentPropertyBag>(createStore);
     lazyMachineIdentifiers = new Lazy <Dictionary <string, MachineIdentitifier> >(() => ConfigureIdentities());
 }
 public DefaultContextPropertyManager(IEnumerable <IPropertyProvider> propertyProviders)
 {
     CodeContract.RequiresArgumentNotNull <IEnumerable <IPropertyProvider> >(propertyProviders, "propertyProviders");
     cancellationTokenSource = new CancellationTokenSource();
     this.propertyProviders  = propertyProviders.ToList();
 }
Exemplo n.º 8
0
 /// <summary>
 /// Check, whether does event match conditions
 /// </summary>
 /// <param name="telemetryEvent"></param>
 /// <returns></returns>
 public bool IsEventMatch(TelemetryEvent telemetryEvent)
 {
     CodeContract.RequiresArgumentNotNull <TelemetryEvent>(telemetryEvent, "telemetryEvent");
     return(!Not.IsEventMatch(telemetryEvent));
 }
Exemplo n.º 9
0
 /// <summary>
 /// Add session channel
 /// </summary>
 /// <param name="channel"></param>
 public void AddChannel(ISessionChannel channel)
 {
     CodeContract.RequiresArgumentNotNull <ISessionChannel>(channel, "channel");
     channelList.Add(channel);
     OnUpdateChannelList();
 }
Exemplo n.º 10
0
Arquivo: Grammar.cs Projeto: zgf/VBF
        public static ProductionBase <T> Optional <T>(this ProductionBase <T> production)
        {
            CodeContract.RequiresArgumentNotNull(production, "production");

            return(production.Union(Empty(default(T))));
        }
Exemplo n.º 11
0
Arquivo: Grammar.cs Projeto: zgf/VBF
        public static ProductionBase <Lexeme> Optional(this Token token)
        {
            CodeContract.RequiresArgumentNotNull(token, "token");

            return(token.AsTerminal().Optional());
        }
Exemplo n.º 12
0
Arquivo: Grammar.cs Projeto: zgf/VBF
        public static ProductionBase <IEnumerable <Lexeme> > Many1(this Token token, Token separator)
        {
            CodeContract.RequiresArgumentNotNull(token, "token");

            return(token.AsTerminal().Many1(separator.AsTerminal()));
        }
Exemplo n.º 13
0
Arquivo: Grammar.cs Projeto: zgf/VBF
        public static ProductionBase <IEnumerable <T> > Many1 <T>(this ProductionBase <T> production, Token seperator)
        {
            CodeContract.RequiresArgumentNotNull(production, "production");

            return(production.Many1(seperator.AsTerminal()));
        }
Exemplo n.º 14
0
Arquivo: Grammar.cs Projeto: zgf/VBF
        public static ProductionBase <IEnumerable <T> > Many <T, TSeparator>(this ProductionBase <T> production, ProductionBase <TSeparator> separator)
        {
            CodeContract.RequiresArgumentNotNull(production, "production");

            return(Empty(new RepeatParserListNode <T>() as IEnumerable <T>).Union(production.Many1(separator)));
        }
Exemplo n.º 15
0
 public T Parse(string source)
 {
     CodeContract.RequiresArgumentNotNull(source, "source");
     return(Parse(new StringReader(source)));
 }
Exemplo n.º 16
0
 public EventProcessorRouter(IPersistentPropertyBag persistentPropertyBag)
 {
     CodeContract.RequiresArgumentNotNull <IPersistentPropertyBag>(persistentPropertyBag, "persistentPropertyBag");
     this.persistentPropertyBag = persistentPropertyBag;
 }
Exemplo n.º 17
0
        internal void AddEdge(DFAEdge edge)
        {
            CodeContract.RequiresArgumentNotNull(edge, "edge");

            m_outEdges.Add(edge);
        }
Exemplo n.º 18
0
 /// <summary>
 /// Post telemetry event information
 /// </summary>
 /// <param name="telemetryEvent"></param>
 public void PostEvent(TelemetryEvent telemetryEvent)
 {
     CodeContract.RequiresArgumentNotNull <TelemetryEvent>(telemetryEvent, "telemetryEvent");
     eventBuffer.Enqueue(telemetryEvent);
 }
Exemplo n.º 19
0
 public OSInformationProvider(IRegistryTools registryTools)
 {
     CodeContract.RequiresArgumentNotNull <IRegistryTools>(registryTools, "registryTools");
     this.registryTools = registryTools;
 }
Exemplo n.º 20
0
        public void Assign <U>(Parser <U> assignedParser) where U : class, T
        {
            CodeContract.RequiresArgumentNotNull(assignedParser, "assignedParser");

            Rule = assignedParser.Rule;
        }
Exemplo n.º 21
0
 /// <summary>
 /// Adds additional property providers. Used for unit tests.
 /// </summary>
 /// <param name="propertyProvider"></param>
 public void AddPropertyProvider(IPropertyProvider propertyProvider)
 {
     CodeContract.RequiresArgumentNotNull <IPropertyProvider>(propertyProvider, "propertyProvider");
     propertyProviders.Add(propertyProvider);
 }
Exemplo n.º 22
0
        public void Assign(Parser <T> assignedParser)
        {
            CodeContract.RequiresArgumentNotNull(assignedParser, "assignedParser");

            Rule = assignedParser.Rule;
        }
Exemplo n.º 23
0
Arquivo: Parsers.cs Projeto: zgf/VBF
        public static Parser <Lexeme> AsParser(this Token token)
        {
            CodeContract.RequiresArgumentNotNull(token, "token");

            return(new TokenParser(token, null));
        }
Exemplo n.º 24
0
 public KleeneStarExpression(RegularExpression innerExp)
     : base(RegularExpressionType.KleeneStar)
 {
     CodeContract.RequiresArgumentNotNull(innerExp, "innerExp");
     InnerExpression = innerExp;
 }
Exemplo n.º 25
0
Arquivo: Parsers.cs Projeto: zgf/VBF
        public static Parser <IEnumerable <T> > Many <T, TSeparator>(this Parser <T> parser, Parser <TSeparator> separator)
        {
            CodeContract.RequiresArgumentNotNull(parser, "parser");

            return(parser.Many1(separator).Union(Succeed(new RepeatParserListNode <T>() as IEnumerable <T>)));
        }
Exemplo n.º 26
0
        public T Parse(SourceReader source)
        {
            CodeContract.RequiresArgumentNotNull(source, "source");

            if (!m_isInitialized)
            {
                OnInitialize();
            }

            Scanner scanner = m_scanner;

            scanner.SetSource(source);

            ParserEngine engine = new ParserEngine(m_transitionTable, m_errorDefinition);

            Lexeme r = scanner.Read();

            while (true)
            {
                try
                {
                    engine.Input(r);
                }
                catch (PanicRecoverException prex)
                {
                    var follow = prex.PossibleFollow;

                    HashSet <int> validTokens = new HashSet <int>(follow.Select(p =>
                    {
                        Terminal t = p as Terminal;
                        if (t != null)
                        {
                            return(t.Token.Index);
                        }
                        else
                        {
                            return(m_scannerInfo.EndOfStreamTokenIndex);
                        }
                    }));

                    while (!validTokens.Contains(r.TokenIndex) && !r.IsEndOfStream)
                    {
                        r = scanner.Read();
                    }

                    continue;
                }

                if (r.IsEndOfStream)
                {
                    break;
                }

                r = scanner.Read();
            }

            if (engine.AcceptedCount == 0)
            {
                throw new ParsingFailureException("There's no parsing result");
            }

            if (engine.AcceptedCount > 1 && engine.GetResultInfo(0).ErrorCount == 0)
            {
                throw new ParsingFailureException("Multiple parsing results are found. There's ambiguity in your grammar");
            }

            object result = engine.GetResult(0, m_errorManager);

            return((T)result);
        }
Exemplo n.º 27
0
Arquivo: Parsers.cs Projeto: zgf/VBF
        public static Parser <Lexeme> AsParser(this Token token, int lexerStateIndex)
        {
            CodeContract.RequiresArgumentNotNull(token, "token");

            return(new TokenParser(token, lexerStateIndex));
        }
Exemplo n.º 28
0
 public T Parse(TextReader source)
 {
     CodeContract.RequiresArgumentNotNull(source, "source");
     return(Parse(new SourceReader(source)));
 }
Exemplo n.º 29
0
Arquivo: Parsers.cs Projeto: zgf/VBF
        public static Parser <IEnumerable <T> > Many <T>(this Parser <T> parser, Token separator)
        {
            CodeContract.RequiresArgumentNotNull(parser, "parser");

            return(parser.Many(separator.AsParser()));
        }
Exemplo n.º 30
0
 public TelemetryVsOptinStatusReader(IRegistryTools2 registryTools)
 {
     CodeContract.RequiresArgumentNotNull <IRegistryTools2>(registryTools, "registryTools");
     this.registryTools = registryTools;
 }