/// <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>(); }
/// <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)); }
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()); } }
/// <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> /// 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 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>(); }
public void ReserveNamespace(string ns) { ReservedWords.Add(PackageNameFromNamespace(ns)); }
/// <summary> /// Initializes a new instance of GoCodeNamingFramework. /// </summary> public GoCodeNamer() { new HashSet <string> { // 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" }.ToList().ForEach(s => ReservedWords.Add(s)); _normalizedTypes = new Dictionary <IType, IType>(); }
/// <summary> /// Initializes a new instance of CSharpCodeNamingFramework. /// </summary> public NodeJsCodeNamer() { // List retrieved from // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords new HashSet <string> { "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" }.ForEach(s => ReservedWords.Add(s)); _normalizedTypes = new HashSet <IType>(); }
// Refactor -> Namer public void ReserveNamespace(string ns) { ReservedWords.Add(ns); }
public ImpalaDialect3() { // Add SQL:2016 reserved words foreach (var reservedWord in new[] { "abs", "acos", "allocate", "any", "are", "array_agg", "array_max_cardinality", "asensitive", "asin", "asymmetric", "at", "atan", "atomic", "avg", "begin", "begin_frame", "begin_partition", "blob", "both", "call", "called", "cardinality", "cascaded", "ceil", "ceiling", "char_length", "character", "character_length", "check", "classifier", "clob", "close", "coalesce", "collate", "collect", "commit", "condition", "connect", "constraint", "contains", "convert", "copy", "corr", "corresponding", "cos", "cosh", "count", "covar_pop", "covar_samp", "cube", "cume_dist", "current_catalog", "current_date", "current_default_transform_group", "current_path", "current_path", "current_role", "current_role", "current_row", "current_schema", "current_time", "current_timestamp", "current_transform_group_for_type", "current_user", "cursor", "cycle", "day", "deallocate", "dec", "decfloat", "declare", "define", "dense_rank", "deref", "deterministic", "disconnect", "dynamic", "each", "element", "empty", "end-exec", "end_frame", "end_partition", "equals", "escape", "every", "except", "exec", "execute", "exp", "extract", "fetch", "filter", "first_value", "floor", "foreign", "frame_row", "free", "fusion", "get", "global", "grouping", "groups", "hold", "hour", "identity", "indicator", "initial", "inout", "insensitive", "integer", "intersect", "intersection", "json_array", "json_arrayagg", "json_exists", "json_object", "json_objectagg", "json_query", "json_table", "json_table_primitive", "json_value", "lag", "language", "large", "last_value", "lateral", "lead", "leading", "like_regex", "listagg", "ln", "local", "localtime", "localtimestamp", "log", "log10 ", "lower", "match", "match_number", "match_recognize", "matches", "max", "member", "merge", "method", "min", "minute", "mod", "modifies", "module", "month", "multiset", "national", "natural", "nchar", "nclob", "new", "no", "none", "normalize", "nth_value", "ntile", "nullif", "numeric", "occurrences_regex", "octet_length", "of", "old", "omit", "one", "only", "open", "out", "overlaps", "overlay", "parameter", "pattern", "per", "percent", "percent_rank", "percentile_cont", "percentile_disc", "period", "portion", "position", "position_regex", "power", "precedes", "precision", "prepare", "procedure", "ptf", "rank", "reads", "real", "recursive", "ref", "references", "referencing", "regr_avgx", "regr_avgy", "regr_count", "regr_intercept", "regr_r2", "regr_slope", "regr_sxx", "regr_sxy", "regr_syy", "release", "result", "return", "rollback", "rollup", "row_number", "running", "savepoint", "scope", "scroll", "search", "second", "seek", "sensitive", "session_user", "similar", "sin", "sinh", "skip", "some", "specific", "specifictype", "sql", "sqlexception", "sqlstate", "sqlwarning", "sqrt", "start", "static", "stddev_pop", "stddev_samp", "submultiset", "subset", "substring", "substring_regex", "succeeds", "sum", "symmetric", "system", "system_time", "system_user", "tan", "tanh", "time", "timezone_hour", "timezone_minute", "trailing", "translate", "translate_regex", "translation", "treat", "trigger", "trim", "trim_array", "uescape", "unique", "unknown", "unnest", "update ", "upper", "user", "value", "value_of", "var_pop", "var_samp", "varbinary", "varying", "versioning", "whenever", "width_bucket", "window", "within", "without", "year" }) { ReservedWords.Add(reservedWord); } // Remove whitelist words. These words might be heavily used in production, and // impala is unlikely to implement SQL features around these words in the near future. foreach (var reservedWord in new[] { // time units "year", "month", "day", "hour", "minute", "second", "begin", "call", "check", "classifier", "close", "identity", "language", "localtime", "member", "module", "new", "nullif", "old", "open", "parameter", "period", "result", "return", "sql", "start", "system", "time", "user", "value" }) { ReservedWords.Remove(reservedWord); } }