Exemple #1
0
        protected KeyValuePair <string, string> ParseParameter(out bool isExtended)
        {
            if (NextToken.Type != TokenType.Identifier && NextToken.Type != TokenType.ExtendedIdentifier)
            {
                Error(string.Format("Unexpected token '{0}' (expected an identifier)", NextToken.Type));
            }
            string id = NextToken.Value;

            isExtended = (NextToken.Type == TokenType.ExtendedIdentifier);
            GetNextToken();

            if (NextToken.Type != TokenType.Assignment)
            {
                Error(string.Format("Unexpected token '{0}' (expected an assignment)", NextToken.Type));
            }

            if (id == "rel")
            {
                GetNextStringOrRelType();
            }
            else
            {
                GetNextToken();
            }

            if (NextToken.Type != TokenType.String)
            {
                Error(string.Format("Unexpected token '{0}' (expected an string)", NextToken.Type));
            }
            string value = NextToken.Value;

            if (isExtended)
            {
                value = HeaderEncodingParser.ParseExtendedHeader(value);
            }
            GetNextToken();

            return(new KeyValuePair <string, string>(id, value));
        }
Exemple #2
0
        public static string ParseExtendedHeader(string s)
        {
            HeaderEncodingParser parser = new HeaderEncodingParser();

            return(parser.Parse(s));
        }
 public static string ParseExtendedHeader(string s)
 {
     HeaderEncodingParser parser = new HeaderEncodingParser();
     return parser.Parse(s);
 }