Exemplo n.º 1
0
 // Produce a textual name for the given keyword type.
 protected static string IdToName(KeywordId id)
 {
     if (id == KeywordId.Id)
     {
         return("a CrstType name");
     }
     return(String.Format("'{0}'", id.ToString()));
 }
 public List <string> ToList()
 {
     return(new List <string>()
     {
         AdgroupId.ToString(),
         KeywordId.ToString(),
         CampaignId.ToString()
     });
 }
Exemplo n.º 3
0
        public Token(string file, string text, int line, int column)
        {
            m_file   = file;
            m_text   = text;
            m_line   = line;
            m_column = column;

            // Map token text to keyword ID. True keywords (not identifiers) are case insensitive so normalize
            // the text to lower case before performing the keyword hash lookup.
            string canonName = m_text.ToLower();

            if (s_keywords.ContainsKey(canonName))
            {
                m_id = s_keywords[canonName];
            }
            else
            {
                m_id = KeywordId.Id;
            }
        }
Exemplo n.º 4
0
        static string FormatErrorMessage(Token errorToken, KeywordId[] expected)
        {
            StringBuilder message = new StringBuilder(String.Format("Unexpected token '{0}' at {1}",
                                                                    errorToken.Text, errorToken.Location));
            if (expected.Length == 0)
            {
            }
            else if (expected.Length == 1)
            {
                message.Append(String.Format("; expected {0}", IdToName(expected[0])));
            }
            else
            {
                message.Append("; expected one of ");
                for (int i = 0; i < expected.Length - 1; i++)
                    message.Append(String.Format("{0}, ", IdToName(expected[i])));
                message.Append(IdToName(expected[expected.Length - 1]));
                    
            }

            return message.ToString();
        }
Exemplo n.º 5
0
 // Produce a textual name for the given keyword type.
 protected static string IdToName(KeywordId id)
 {
     if (id == KeywordId.Id)
         return "a CrstType name";
     return String.Format("'{0}'", id.ToString());
 }
Exemplo n.º 6
0
        public Token(string file, string text, int line, int column)
        {
            m_file = file;
            m_text = text;
            m_line = line;
            m_column = column;

            // Map token text to keyword ID. True keywords (not identifiers) are case insensitive so normalize
            // the text to lower case before performing the keyword hash lookup.
            string canonName = m_text.ToLower();
            if (s_keywords.ContainsKey(canonName))
                m_id = s_keywords[canonName];
            else
                m_id = KeywordId.Id;
        }