// 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() }); }
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; } }
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(); }
// 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 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; }