Ejemplo n.º 1
0
        /// <summary> gets a Parser object to parse TokenQuoted.</summary>
        /// <param name="fc">the mapping to map the quoted string to an object returned by the parser.
        /// </param>
        /// <returns> the parser
        /// </returns>
        public static Parser <T> OnQuotedWord <T>(FromRange <string, string, string, T> fc)
        {
            FromToken <T> recognizer = delegate(Tok tok, ref T result)
            {
                object obj = tok.Token;
                if (obj is TokenQuoted)
                {
                    TokenQuoted quoted = obj as TokenQuoted;
                    result = fc(tok.Index, tok.Length, quoted.Open, quoted.Quoted, quoted.Close);
                    return(true);
                }
                else
                {
                    return(false);
                }
            };

            return(Parsers.FromToken(recognizer));
        }
Ejemplo n.º 2
0
 public bool Equals(TokenQuoted other)
 {
     return(open.Equals(other.open) && close.Equals(other.close) && quoted.Equals(other.quoted));
 }
Ejemplo n.º 3
0
 /// <summary> creates a Tokenizer instance that can parse a string quoted by open and close.</summary>
 /// <param name="open">the opening quote
 /// </param>
 /// <param name="close">the closeing quote
 /// </param>
 /// <returns> the tokenizer.
 /// </returns>
 public static Tokenizer ForQuotedString(string open, string close)
 {
     return(TokenQuoted.GetTokenizer(open, close));
 }
Ejemplo n.º 4
0
 /// <summary> creates a Tokenizer instance that can parse a string quoted by open and close.</summary>
 /// <param name="open">the open quote
 /// </param>
 /// <param name="close">the close quote
 /// </param>
 /// <returns> the tokenizer.
 /// </returns>
 public static Tokenizer ForQuotedString(char open, char close)
 {
     return(TokenQuoted.GetTokenizer(open, close));
 }