/// <summary> /// Parse the next token as an identifier. If `liberal` is true (used /// when parsing properties), it will also convert keywords into /// identifiers. /// </summary> private Node ParseIdentifier(bool liberal = false) { var node = StartNode(); if (Match(TokenType.Types["name"])) { if (!liberal && State.Strict && ReservedWords["strict"]((string)State.Value)) { Raise(State.Start, $"The keyword '{State.Value}' is reserved"); } node.Name = (string)State.Value; } else if (liberal && !string.IsNullOrEmpty(State.Type.Keyword)) { node.Name = State.Type.Keyword; } else { Unexpected(); } if (!liberal && node.Name as string == "await" && State.InAsync) { Raise(node.Start, "invalid use of await inside of an async function"); } Next(); return(FinishNode(node, "Identifier")); }
private string GetEscapedReservedName(string name, string appendValue, bool checkExtraReserved) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (appendValue == null) { throw new ArgumentNullException(nameof(appendValue)); } // Use case-sensitive comparisons to reduce generated names if (ReservedWords.Contains(name, StringComparer.Ordinal)) { name += appendValue; } // If checkExtraReserved is true, we also includes some more words to escape if (checkExtraReserved && ExtraReservedWords.Contains(name, StringComparer.Ordinal)) { name += appendValue; } return(name); }
/// <summary> /// Initializes a new instance of CSharpCodeNamingFramework. /// </summary> public CSharpCodeNamer() { new HashSet <string> { "abstract", "as", "async", "await", "base", "bool", "break", "byte", "case", "catch", "char", "checked", "class", "const", "continue", "decimal", "default", "delegate", "do", "double", "dynamic", "else", "enum", "event", "explicit", "extern", "false", "finally", "fixed", "float", "for", "foreach", "from", "global", "goto", "if", "implicit", "in", "int", "interface", "internal", "is", "lock", "long", "namespace", "new", "null", "object", "operator", "out", "override", "params", "private", "protected", "public", "readonly", "ref", "return", "sbyte", "sealed", "short", "sizeof", "stackalloc", "static", "string", "struct", "switch", "this", "throw", "true", "try", "typeof", "uint", "ulong", "unchecked", "unsafe", "ushort", "using", "virtual", "void", "volatile", "while", "yield", "var" }.ForEach(s => ReservedWords.Add(s)); _normalizedTypes = new HashSet <IType>(); }
public static void PrepareQueryAndAliases(this SqlSelectStatement sqlSelectStatement) { _aliases = null; var allAliases = new HashSet <string>(StringComparer.OrdinalIgnoreCase); var paramsVisited = new HashSet <SqlParameter>(); var tablesVisited = new HashSet <SqlTableSource>(); new QueryVisitor().VisitAll(sqlSelectStatement, expr => { switch (expr.ElementType) { case QueryElementType.MergeSourceTable: { var source = (SqlMergeSourceTable)expr; Utils.MakeUniqueNames( source.SourceFields, null, (n, a) => !ReservedWords.IsReserved(n), f => f.PhysicalName, (f, n, a) => { f.PhysicalName = n; }, f => { var a = f.PhysicalName; return(a.IsNullOrEmpty() ? "c1" : a + (a !.EndsWith("_") ? string.Empty : "_") + "1"); },
public override string IsNameLegal(string desiredName, IIdentifier whoIsAsking) { if (whoIsAsking is Property && ReservedWords.Contains(desiredName, StringComparer.OrdinalIgnoreCase)) { // ignore case in case of properties, since the property will be used with altered case in the model constructor => bad return(desiredName); } return(base.IsNameLegal(desiredName, whoIsAsking)); }
public void SetBuiltInFunctions(IEnumerable <string> builtInFunctions) { // Remove impala builtin function names foreach (var builtInFunction in builtInFunctions) { ReservedWords.Remove(builtInFunction); } }
private static void InitializeReservedWords() { var startIndex = (int)PascalTokenType.And; var endIndex = (int)PascalTokenType.With; for (var i = startIndex; i <= endIndex; i++) { var t = (PascalTokenType)i; ReservedWords.Add(TokenTypes[t].Text.ToLower()); } }
public string GetObjectName(string name, bool quote = true) { if (name.Contains(" ") && name.IndexOf('[') == -1 || ReservedWords.ContainsKey(name)) { return("[" + name + "]"); } else { return(name); } }
/// <summary> /// Initializes a new instance of CSharpCodeNamingFramework. /// </summary> public JavaCodeNamer(string nameSpace) { // List retrieved from // http://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html _package = nameSpace != null?nameSpace.ToLower(CultureInfo.InvariantCulture) : string.Empty; new HashSet <string> { "abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "default", "do", "double", "else", "enum", "extends", "false", "final", "finally", "float", "for", "goto", "if", "implements", "import", "int", "long", "interface", "instanceof", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "strictfp", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try", "void", "volatile", "while", "date", "datetime", "period", "stream", "string", "object", "header" }.ForEach(s => ReservedWords.Add(s)); PrimaryTypes = new HashSet <string>(); new HashSet <string> { "int", "Integer", "long", "Long", "object", "Object", "bool", "Boolean", "double", "Double", "float", "Float", "byte", "Byte", "byte[]", "Byte[]", "String", "LocalDate", "DateTime", "DateTimeRfc1123", "Duration", "Period", "BigDecimal", "InputStream" }.ForEach(s => PrimaryTypes.Add(s)); JavaBuiltInTypes = new HashSet <string>(); new HashSet <string> { "int", "long", "bool", "double", "float", "byte", "byte[]" }.ForEach(s => PrimaryTypes.Add(s)); }
/// <summary> /// Initializes a new instance of CSharpCodeNamingFramework. /// </summary> public PythonCodeNamer() { // List retrieved from // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords new HashSet <string> { "and", "as", "assert", "break", "class", "continue", "def", "del", "elif", "else", "except", "exec", "finally", "for", "from", "global", "if", "import", "in", "is", "lambda", "not", "or", "pass", "print", "raise", "return", "try", "while", "with", "yield", // Though the following word is not python keyword, but it will cause trouble if we use them as variable, field, etc. "int", "bool", "bytearray", "date", "datetime", "float", "long", "object", "Decimal", "str", "timedelta" }.ForEach(s => ReservedWords.Add(s)); _normalizedTypes = new HashSet <IType>(); }
/// <summary> /// Is a word not reserved or ill-formed? /// Throws ScriptException if not. /// </summary> /// <param name="name">Name to check</param> public static void ValidateName(string name) { if (ReservedWords.Contains(name)) { throw new ScriptException("Name is reserved: " + name); } if (!ValidNames.IsMatch(name)) { throw new ScriptException("Names must start with a letter and contain only letters, digits, or underscores: " + name); } }
protected sealed override bool IsReserved(string word) { // TODO: now we use static 11g list // proper solution will be use version-based list or load it from V$RESERVED_WORDS (needs research) // right now list is a merge of two lists: // SQL reserved words: https://docs.oracle.com/database/121/SQLRF/ap_keywd001.htm // PL/SQL reserved words: https://docs.oracle.com/cd/B28359_01/appdev.111/b28370/reservewords.htm // keywords are not included as they are keywords :) // // V$RESERVED_WORDS: https://docs.oracle.com/cd/B28359_01/server.111/b28320/dynviews_2126.htm return(ReservedWords.IsReserved(word, ProviderName.Oracle)); }
/// <summary> /// Constructs an instance of the class implementing the base class. /// </summary> /// <param name="controller">The <see cref="T:DotNetAsm.IAssemblyController"/>.</param> protected AssemblerBase(IAssemblyController controller) { Controller = controller; if (controller == null) { Reserved = new ReservedWords(); } else { Reserved = new ReservedWords(Controller.Options.StringComparar); } }
void ReadReserved() { if (char.IsLetter(this.reader.Current)) { this.ReadName(); ReservedWord word = ReservedWords.Lookup(this.TokenString); if (null != word) { this.token = word.Token; this.op = word.Operator; } } }
public COOPClassParser() { startSymbol = SyntacticCategories.start; RuleManager = new RuleManager <string>(); RuleManager.AddSet("reserved", ReservedWords.getReservedWords()); RuleManager.AddToSet("reserved", "int", "double", "float", "char", "long"); RuleManager.AddSet("reserved_types", "int", "double", "float", "char", "long"); var classDefCollector = StandardCollectors.CategoryCollectorMulti("symbol", "class_name", "class"); Rule classNameRule = new RuleOutOfSet(RuleManager["reserved"], classDefCollector); RuleManager.AddRule(classNameRule); }
public string GetObjectName(string name, bool quote = true) { name = getObjectName(name); if (string.IsNullOrWhiteSpace(name)) { return(name); } if (name.Contains(" ") && name.IndexOf('"') == -1 || ReservedWords.ContainsKey(name)) { return("\"" + name + "\""); } else { return(name); } }
/// <summary> /// Initializes a new instance of RubyCodeNamer. /// </summary> public RubyCodeNamer() { new HashSet <string> { "begin", "do", "next", "then", "end", "else", "nil", "true", "alias", "elsif", "not", "undef", "and", "end", "or", "unless", "begin", "ensure", "redo", "until", "break", "false", "rescue", "when", "case", "for", "retry", "while", "class", "if", "return", "while", "def", "in", "self", "__file__", "defined?", "module", "super", "__line__", "yield" }.ForEach(s => ReservedWords.Add(s)); normalizedTypes = new HashSet <IType>(); }
/// <summary> /// Initializes a new instance of Python's CodeNamer. /// </summary> public CodeNamerPy() { // List retrieved from // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords ReservedWords.AddRange( new[] { "and", "as", "assert", "break", "class", "continue", "def", "del", "elif", "else", "except", "exec", "finally", "for", "from", "global", "if", "import", "in", "is", "lambda", "not", "or", "pass", "print", "raise", "return", "try", "while", "with", "yield", "async", "await", // Though the following word is not python keyword, but it will cause trouble if we use them as variable, field, etc. "int", "bool", "bytearray", "date", "datetime", "float", "long", "object", "decimal", "str", "timedelta", "mro", "self" }); }
/// <summary> /// Initializes a new instance of TypeScriptCodeNamingFramework. /// </summary> public CodeNamerTS() { ReservedWords.AddRange(new[] { "arguments", "array", "await", "abstract", "boolean", "buffer", "break", "byte", "case", "catch", "char", "class", "const", "continue", "debugger", "default", "delete", "do", "double", "date", "else", "enum", "error", "export", "extends", "false", "final", "finally", "float", "for", "function", "goto", "if", "implements", "import", "in", "int", "interface", "instanceof", "let", "long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "super", "switch", "synchronized", "this", "throw", "transient", "true", "try", "typeof", "util", "var", "void", "volatile", "while", "with", "yield", "pipeline" }); }
private static string ValidateName(NWPlayer player) { string error = string.Empty; string name = player.Name.ToLower(); string[] words = name.Split(null); foreach (var word in words) { if (ReservedWords.Contains(word)) { error = "Your character has a reserved word in his or her name. Please remake your character and use a different name. Note that famous Star Wars names are not allowed to be used for your character. Offending word: " + word; break; } } return(error); }
/// <summary> /// Converts names the conflict with Go reserved terms by appending the passed appendValue. /// </summary> /// <param name="name">Name.</param> /// <param name="appendValue">String to append.</param> /// <returns>The transformed reserved name</returns> protected override string GetEscapedReservedName(string name, string appendValue) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (appendValue == null) { throw new ArgumentNullException(nameof(appendValue)); } // Use case-sensitive comparisons to reduce generated names if (ReservedWords.Contains(name, StringComparer.Ordinal)) { name += appendValue; } return(name); }
public string ToString(TokenClass classNumber, int tokenNumber) { var token = "?"; switch (classNumber) { case TokenClass.ReservedWord: token = ReservedWords.ElementAt(tokenNumber); break; case TokenClass.OperationSign: token = OperationSigns.ElementAt(tokenNumber); break; case TokenClass.Delmer: token = Delmers.ElementAt(tokenNumber); break; } return($"{classNumber}:{token}"); }
/// <summary> /// Initializes a new instance of CSharpCodeNamingFramework. /// </summary> public CodeNamerOc() { // List retrieved from // http://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html ReservedWords.AddRange(new [] { "if", "else", "switch", "case", "default", "break", "int", "float", "char", "double", "long", "for", "while", "do", "void", "goto", "auto", "signed", "const", "extern", "register", "unsigned", "return", "continue", "enum", "sizeof", "struct", "typedef", "union", "volatile", "description", "id" }); PrimaryTypes = new HashSet <string> { "int", "long", "double", "float", "byte", "byte[]" }; }
/// <summary> /// Initializes a new instance of CSharpCodeNamingFramework. /// </summary> public JavaCodeNamer() { // List retrieved from // http://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html new HashSet <string> { "abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "default", "do", "double", "else", "enum", "extends", "false", "final", "finally", "float", "for", "goto", "if", "implements", "import", "int", "long", "interface", "instanceof", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "strictfp", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try", "void", "volatile", "while", "date", "datetime", "period", "stream", "string", "object", "header" }.ForEach(s => ReservedWords.Add(s)); _normalizedTypes = new HashSet <IType>(); }
internal static void SetCodeCollection( CodeDefinition codeDefinition, List <string> codeCollection, DataContainer dataContainer) { var code = string.Empty; dataContainer .XlsIoCollection[dataContainer.DefinitionName] .XlsSheet .AsEnumerable() .Skip(1) .Where(o => o[0].ToString() != string.Empty) .ForEach(definitionRow => Creators.SetCodeCollection( ref code, codeCollection, codeDefinition, dataContainer, () => code = code.Replace( "#Id#", ReservedWords.ValidName(definitionRow[0].ToString())))); }
protected sealed override bool IsReserved(string word) { return(ReservedWords.IsReserved(word, ProviderName.PostgreSQL)); }
protected sealed override bool IsReserved(string word) { return(ReservedWords.IsReserved(word, ProviderName.Firebird)); }
public static bool IsReservedWord(string word) { return(ReservedWords.Contains(word.ToUpper())); }
/// <summary> /// 转换描述文本为表达式数组 /// </summary> /// <remarks> /// a: {#$ TrimHTML(%Title%) $#} /// b: {#$ Repeat(5,%Title%) $#} /// c: {#$ Length(TrimHTML(%Title%)) $#} /// d: {#$ Length(TrimHTML(%Title%)) > 3 ? "太长" : "OK" $#} /// e: {#$ Replace(TrimHTML(%Title%), "电子"," ") $#} /// f: {#$ ReplaceX(TrimHTML(%Title%), "\w","") $#} /// </remarks> public static List<InnerExpression> GetInnerExpressions(string ExpPaper, IResourceDependency Res) { //OleDbHelper.AppendToFile("~/debug.txt", "\n\n 解析:" + ExpPaper); List<InnerExpression> expList = new List<InnerExpression>(); int lenT = ExpPaper.Length; int cursor = 0, iflag = 0; char chr = ExpPaper[cursor]; string strTemp = "", strExpression = ""; ReservedWords words = null; while (cursor < lenT) { #region 字符扫描 chr = ExpPaper[cursor]; if (!ReservedWords.IsReservedChar(chr)) { ++cursor; continue; } else { if (cursor > iflag) { strTemp = ExpPaper.Substring(iflag, cursor - iflag).Trim(); } iflag = cursor; words = new ReservedWords(chr); if (words.IsBraceChar()) { #region 配对字符解析 ReservedWords.MoveToCharBrace(chr, ReservedWords.GetBraceChar(chr), ref cursor, ref ExpPaper); if (chr == '(') { //Function strExpression = ExpPaper.Substring(iflag + 1, cursor - iflag - 1); //OleDbHelper.AppendToFile("~/debug.txt", "\n 函数体:" + strExpression); if (strTemp.Length == 0) strTemp = null; expList.Add(new InnerExpression(strTemp, strExpression, Res)); } else if (chr == '?') { strExpression = ExpPaper.Substring(iflag + 1, cursor - iflag - 1).Trim(); #region 跳出双引号里面的 : 操作符号 if (strExpression.IndexOf('"') != -1 && strExpression[0] != '"') { ReservedWords.MoveToCharBrace('"', '"', ref cursor, ref ExpPaper); ReservedWords.MoveToCharBrace(ExpPaper[cursor], ':', ref cursor, ref ExpPaper); strExpression = ExpPaper.Substring(iflag + 1, cursor - iflag - 1).Trim(); } #endregion #region 跳出单引号里面的 : 操作符号 if (strExpression.IndexOf('\'') != -1 && strExpression[0] != '\'') { ReservedWords.MoveToCharBrace('\'', '\'', ref cursor, ref ExpPaper); ReservedWords.MoveToCharBrace(ExpPaper[cursor], ':', ref cursor, ref ExpPaper); strExpression = ExpPaper.Substring(iflag + 1, cursor - iflag - 1).Trim(); } #endregion if (strTemp.Length > 0) { expList.Add(new InnerExpression(strTemp)); } expList.Add(new InnerExpression("?")); expList.Add(new InnerExpression(strExpression)); expList.Add(new InnerExpression(":")); //Util.Debug(false, ExpPaper.Substring(cursor)); } else if (chr == '[') { // {#$["首页","新闻","动态","联系"][2]$#} = "动态" #region 数组情况 if (cursor < lenT - 1) { char aIdx = ExpPaper[cursor + 1]; while (aIdx == '[') { cursor++; ReservedWords.MoveToCharBrace(aIdx, ReservedWords.GetBraceChar(aIdx), ref cursor, ref ExpPaper); if (cursor < (lenT - 1)) { aIdx = ExpPaper[cursor + 1]; } else { break; } } strExpression = ExpPaper.Substring(iflag, cursor - iflag + 1); expList.Add(new InnerExpression(strExpression, ',', Res)); } else { #region 获取数组下标操作TODO strExpression = ExpPaper.Substring(iflag, cursor - iflag + 1); expList.Add(new InnerExpression(strExpression, Res)); #endregion } #endregion } else if (chr == '$') { #region 内置系统标签 strExpression = ExpPaper.Substring(iflag, cursor - iflag + 1); SystemTag sysTag = new SystemTag(string.Concat("{#", strExpression, "#}")); sysTag.SetResourceDependency(Res); //OleDbHelper.AppendToFile("~/debug.log", System.Environment.NewLine + string.Concat("{#", strExpression, "#}", "\n", sysTag.ToString())); expList.Add(new InnerExpression(sysTag.ToString())); #endregion } else if (chr == '"' || chr == '\'') { strExpression = ExpPaper.Substring(iflag, cursor - iflag + 1); //Util.Debug(false, "Find String:" + strExpression); expList.Add(new InnerExpression(strExpression)); } #endregion iflag = cursor + 1; } else if (words.IsOperator()) { strExpression = strTemp; if (strExpression.Length > 0) { InnerExpression exp = new InnerExpression(strExpression); expList.Add(exp); } #region 处理操作符号 ParseOperator: char chrNext = ExpPaper[cursor + 1]; if ((chr == '+' || chr == '-') && char.IsNumber(chrNext)) { #region 正负号处理 ++cursor; if (cursor < lenT) { ReservedWords.MoveToCharInRange(ref cursor, ref ExpPaper, ' ', '*', '/', '%', '+', '-', '>', '<', '=', '!', '&', '^', '|'); expList.Add(new InnerExpression(ExpPaper.Substring(iflag, cursor - iflag))); #region 如遇操作符 if (cursor < lenT && ExpPaper[cursor] != ' ') { iflag = cursor; chr = ExpPaper[cursor]; //Util.Debug(false, "new char: = [" + chr.ToString() + "]"); goto ParseOperator; } #endregion } #endregion } else { // *= += -= ++ -- <> if (ReservedWords.IsCharInRange(chrNext, '=', '+', '-', '>')) { expList.Add(new InnerExpression(chr.ToString() + chrNext.ToString())); ++cursor; } else { expList.Add(new InnerExpression(chr.ToString())); } } #endregion iflag = cursor + 1; } else { if (strTemp.Length > 0) { expList.Add(new InnerExpression(strTemp)); } //Util.Debug(false, "11 - [" + strTemp.Trim() + "]" + "chr=[" + chr.ToString() + "]"); } } ++cursor; #endregion } if (iflag < cursor) { expList.Add(new InnerExpression(ExpPaper.Substring(iflag, cursor - iflag).Trim())); } //#region 解析结果查看 //foreach (InnerExpression ext in expList) //{ // //Util.Debug(false, string.Concat("Exp定义:", ext.TagDefinition)); // OleDbHelper.AppendToFile("~/debug.log", System.Environment.NewLine + string.Concat("Exp定义:", ext.TagDefinition)); //} //#endregion return expList; }
/// <summary> /// Initializes a new instance of CodeNamerGo. /// </summary> public CodeNamerGo() { // Create a map from HttpStatusCode to the appropriate Go http.StatusXxxxx string. // -- Go does not have constants for the full HttpStatusCode enumeration; this set taken from http://golang.org/pkg/net/http/ const HttpStatusCode tooManyRequests = (HttpStatusCode)429; const HttpStatusCode failedDependency = (HttpStatusCode)424; var statusCodeMap = new Dictionary <HttpStatusCode, string>(); foreach (var sc in new HttpStatusCode[] { HttpStatusCode.Continue, HttpStatusCode.SwitchingProtocols, HttpStatusCode.OK, HttpStatusCode.Created, HttpStatusCode.Accepted, HttpStatusCode.NonAuthoritativeInformation, HttpStatusCode.NoContent, HttpStatusCode.ResetContent, HttpStatusCode.PartialContent, HttpStatusCode.MultipleChoices, HttpStatusCode.MovedPermanently, HttpStatusCode.Found, HttpStatusCode.SeeOther, HttpStatusCode.NotModified, HttpStatusCode.UseProxy, HttpStatusCode.TemporaryRedirect, HttpStatusCode.BadRequest, HttpStatusCode.Unauthorized, HttpStatusCode.PaymentRequired, HttpStatusCode.Forbidden, HttpStatusCode.NotFound, HttpStatusCode.MethodNotAllowed, HttpStatusCode.NotAcceptable, HttpStatusCode.ProxyAuthenticationRequired, HttpStatusCode.RequestTimeout, HttpStatusCode.Conflict, HttpStatusCode.Gone, HttpStatusCode.LengthRequired, HttpStatusCode.PreconditionFailed, HttpStatusCode.RequestEntityTooLarge, HttpStatusCode.RequestUriTooLong, HttpStatusCode.UnsupportedMediaType, HttpStatusCode.RequestedRangeNotSatisfiable, HttpStatusCode.ExpectationFailed, failedDependency, tooManyRequests, HttpStatusCode.InternalServerError, HttpStatusCode.NotImplemented, HttpStatusCode.BadGateway, HttpStatusCode.ServiceUnavailable, HttpStatusCode.GatewayTimeout, HttpStatusCode.HttpVersionNotSupported }) { statusCodeMap.Add(sc, string.Format("http.Status{0}", sc)); } // Go names some constants slightly differently than the HttpStatusCode enumeration -- correct those statusCodeMap[HttpStatusCode.Redirect] = "http.StatusFound"; statusCodeMap[HttpStatusCode.NonAuthoritativeInformation] = "http.StatusNonAuthoritativeInfo"; statusCodeMap[HttpStatusCode.ProxyAuthenticationRequired] = "http.StatusProxyAuthRequired"; statusCodeMap[HttpStatusCode.RequestUriTooLong] = "http.StatusRequestURITooLong"; statusCodeMap[failedDependency] = "http.StatusFailedDependency"; statusCodeMap[tooManyRequests] = "http.StatusTooManyRequests"; statusCodeMap[HttpStatusCode.HttpVersionNotSupported] = "http.StatusHTTPVersionNotSupported"; // Add the status which are not in the System.Net.HttpStatusCode enumeration statusCodeMap[(HttpStatusCode)207] = "http.StatusMultiStatus"; StatusCodeToGoString = statusCodeMap; ReservedWords.AddRange( new[] { // Reserved keywords -- list retrieved from http://golang.org/ref/spec#Keywords "break", "default", "func", "interface", "select", "case", "defer", "go", "map", "struct", "chan", "else", "goto", "package", "switch", "const", "fallthrough", "if", "range", "type", "continue", "for", "import", "return", "var", // Reserved predeclared identifiers -- list retrieved from http://golang.org/ref/spec#Predeclared_identifiers "bool", "byte", "complex64", "complex128", "error", "float32", "float64", "int", "int8", "int16", "int32", "int64", "rune", "string", "uint", "uint8", "uint16", "uint32", "uint64", "uintptr", "true", "false", "iota", "nil", "append", "cap", "close", "complex", "copy", "delete", "imag", "len", "make", "new", "panic", "print", "println", "real", "recover", // Reserved packages -- list retrieved from http://golang.org/pkg/ // -- Since package names serve as partial identifiers, exclude the standard library "archive", "tar", "zip", "bufio", "builtin", "bytes", "compress", "bzip2", "flate", "gzip", "lzw", "zlib", "container", "heap", "list", "ring", "crypto", "aes", "cipher", "des", "dsa", "ecdsa", "elliptic", "hmac", "md5", "rand", "rc4", "rsa", "sha1", "sha256", "sha512", "subtle", "tls", "x509", "pkix", "database", "sql", "driver", "debug", "dwarf", "elf", "gosym", "macho", "pe", "plan9obj", "encoding", "ascii85", "asn1", "base32", "base64", "binary", "csv", "gob", "hex", "json", "pem", "xml", "errors", "expvar", "flag", "fmt", "go", "ast", "build", "constant", "doc", "format", "importer", "parser", "printer", "scanner", "token", "types", "hash", "adler32", "crc32", "crc64", "fnv", "html", "template", "image", "color", "palette", "draw", "gif", "jpeg", "png", "index", "suffixarray", "io", "ioutil", "log", "syslog", "math", "big", "cmplx", "rand", "mime", "multipart", "quotedprintable", "net", "http", "cgi", "cookiejar", "fcgi", "httptest", "httputil", "pprof", "mail", "rpc", "jsonrpc", "smtp", "textproto", "url", "os", "exec", "signal", "user", "path", "filepath", "reflect", "regexp", "syntax", "runtime", "cgo", "debug", "pprof", "race", "trace", "sort", "strconv", "strings", "sync", "atomic", "syscall", "testing", "iotest", "quick", "text", "scanner", "tabwriter", "template", "parse", "time", "unicode", "utf16", "utf8", "unsafe", // Other reserved names and packages (defined by the base libraries this code uses) "autorest", "client", "date", "err", "req", "resp", "result", "sender", "to", "validation", "m", "v", "k", "objectMap", // reserved method names "Send" }); }
public void ReserveNamespace(string ns) { ReservedWords.Add(PackageNameFromNamespace(ns)); }