コード例 #1
0
 /// <summary>
 /// Creates a new LALR parser.
 /// </summary>
 /// <param name="tokenizer">A tokenizer.</param>
 /// <param name="states">The LALR states.</param>
 /// <param name="startState">The starting state.</param>
 /// <param name="symbols"></param>
 public LALRParser(IStringTokenizer tokenizer, StateCollection states, State startState, SymbolCollection symbols)
 {
     this.tokenizer  = tokenizer;
     this.states     = states;
     this.startState = startState;
     this.symbols    = symbols;
     storeTokens     = StoreTokensMode.NoUserObject;
 }
コード例 #2
0
ファイル: LALRParser.cs プロジェクト: pavelsavara/nMars
 /// <summary>
 /// Creates a new LALR parser.
 /// </summary>
 /// <param name="tokenizer">A tokenizer.</param>
 /// <param name="states">The LALR states.</param>
 /// <param name="startState">The starting state.</param>
 /// <param name="symbols"></param>
 public LALRParser(IStringTokenizer tokenizer, StateCollection states, State startState, SymbolCollection symbols)
 {
     this.tokenizer = tokenizer;
     this.states = states;
     this.startState = startState;
     this.symbols = symbols;
     storeTokens = StoreTokensMode.NoUserObject;
 }
コード例 #3
0
ファイル: LALRParser.cs プロジェクト: CSRedRat/pascalabcnet
		/// <summary>
		/// Creates a new LALR parser.
		/// </summary>
		/// <param name="tokenizer">A tokenizer.</param>
		/// <param name="states">The LALR states.</param>
		/// <param name="startState">The starting state.</param>
		public LALRParser(IStringTokenizer tokenizer,
			StateCollection states,
			State startState)
		{
			this.tokenizer = tokenizer;
			this.states = states;
			this.startState = startState;
			this.trimReductions = trimReductions;
			storeTokens = StoreTokensMode.NoUserObject;
		}
コード例 #4
0
        /// <summary>
        /// Gets the tokenizer with the specified ID and all its filters.
        /// </summary>
        /// <param name="id">The tokenizer identifier.</param>
        /// <returns>The tokenizer with the filters from the specified chain.
        /// </returns>
        /// <exception cref="ArgumentNullException">tokenizerId</exception>
        public IStringTokenizer GetTokenizer(string id)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            IConfigurationSection section = Configuration.GetSection("Tokenizers");

            if (!section.Exists())
            {
                return(null);
            }

            int index = 0;

            foreach (IConfigurationSection tokSection in section.GetChildren())
            {
                // Tokenizer/Id
                if (tokSection["Id"] == id)
                {
                    // Tokenizer/TypeId, Options, FilterChain
                    string typeId = tokSection["TypeId"];

                    IStringTokenizer tokenizer = GetComponent <IStringTokenizer>(
                        typeId,
                        $"Tokenizers:{index}:Options",
                        true);
                    if (tokenizer == null)
                    {
                        return(null);
                    }

                    string chainId = tokSection["FilterChain"];
                    if (!string.IsNullOrEmpty(chainId))
                    {
                        tokenizer.Filter = new CompositeTextFilter(
                            GetTextFilters(chainId)?.ToArray());
                    }
                    return(tokenizer);
                }
                index++;
            }
            return(null);
        }
コード例 #5
0
 public FlickrNounResolver(IStringTokenizer tokenizer)
 {
     Tokenizer = tokenizer;
 }
コード例 #6
0
 public FlickrNounResolver(IStringTokenizer tokenizer)
 {
     Tokenizer = tokenizer;
 }
コード例 #7
0
 public FlickrQueryStringResolver(IStringTokenizer tokenizer)
 {
     _tokenizer = tokenizer;
 }
コード例 #8
0
 public FlickrVerbResolver(IStringTokenizer tokenizer)
 {
     Tokenizer = tokenizer;
 }
コード例 #9
0
 public DefaultVerbResolver(IStringTokenizer tokenizer)
 {
     Tokenizer = tokenizer;
 }
コード例 #10
0
 public DefaultNounResolver(IStringTokenizer tokenizer)
 {
     PredefinedUrls = new Dictionary<string, string>();
     Tokenizer = tokenizer;
 }
コード例 #11
0
 public DefaultVerbResolver(IStringTokenizer tokenizer)
 {
     Tokenizer = tokenizer;
 }
コード例 #12
0
 public DefaultQueryStringResolver(IStringTokenizer tokenizer)
 {
     Tokenizer = tokenizer;
 }
コード例 #13
0
 public FlickrVerbResolver(IStringTokenizer tokenizer)
 {
     Tokenizer = tokenizer;
 }
コード例 #14
0
 public FlickrQueryStringResolver(IStringTokenizer tokenizer)
 {
     _tokenizer = tokenizer;
 }
コード例 #15
0
 public DefaultQueryStringResolver(IStringTokenizer tokenizer)
 {
     Tokenizer = tokenizer;
 }
コード例 #16
0
 public DefaultNounResolver(IStringTokenizer tokenizer)
 {
     PredefinedUrls = new Dictionary <string, string>();
     Tokenizer      = tokenizer;
 }