1 2 //////////////////////////////////////////////////////////////////////////////////////////// 3 // Copyright (c) 2012 Christopher Nicholson-Sauls // 4 // // 5 // Permission is hereby granted, free of charge, to any person obtaining a copy of this // 6 // software and associated documentation files (the "Software"), to deal in the // 7 // Software without restriction, including without limitation the rights to use, copy, // 8 // modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, // 9 // and to permit persons to whom the Software is furnished to do so, subject to the // 10 // following conditions: // 11 // // 12 // The above copyright notice and this permission notice shall be included in all // 13 // copies or substantial portions of the Software. // 14 // // 15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // 16 // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A // 17 // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT // 18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF // 19 // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE // 20 // OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // 21 //////////////////////////////////////////////////////////////////////////////////////////// 22 23 module zeal.utils.keyword; 24 25 26 bool isKeyword ( string s ) { 27 switch ( s ) { 28 case `abstract`: 29 case `alias`: 30 case `align`: 31 case `asm`: 32 case `assert`: 33 case `auto`: 34 case `body`: 35 case `bool`: 36 case `break`: 37 case `byte`: 38 case `case`: 39 case `cast`: 40 case `catch`: 41 case `cdouble`: 42 case `cent`: 43 case `cfloat`: 44 case `char`: 45 case `class`: 46 case `const`: 47 case `continue`: 48 case `creal`: 49 case `dchar`: 50 case `debug`: 51 case `default`: 52 case `delegate`: 53 case `delete`: 54 case `deprecated`: 55 case `do`: 56 case `double`: 57 case `else`: 58 case `enum`: 59 case `export`: 60 case `extern`: 61 case `false`: 62 case `final`: 63 case `finally`: 64 case `float`: 65 case `for`: 66 case `foreach`: 67 case `foreach_reverse`: 68 case `function`: 69 case `goto`: 70 case `idouble`: 71 case `if`: 72 case `ifloat`: 73 case `immutable`: 74 case `import`: 75 case `in`: 76 case `inout`: 77 case `int`: 78 case `interface`: 79 case `invariant`: 80 case `ireal`: 81 case `is`: 82 case `lazy`: 83 case `long`: 84 case `macro`: 85 case `mixin`: 86 case `module`: 87 case `new`: 88 case `nothrow`: 89 case `null`: 90 case `out`: 91 case `override`: 92 case `package`: 93 case `pragma`: 94 case `private`: 95 case `protected`: 96 case `public`: 97 case `pure`: 98 case `real`: 99 case `ref`: 100 case `return`: 101 case `scope`: 102 case `shared`: 103 case `short`: 104 case `static`: 105 case `struct`: 106 case `super`: 107 case `switch`: 108 case `synchronized`: 109 case `template`: 110 case `this`: 111 case `throw`: 112 case `true`: 113 case `try`: 114 case `typedef`: 115 case `typeid`: 116 case `typeof`: 117 case `ubyte`: 118 case `ucent`: 119 case `uint`: 120 case `ulong`: 121 case `union`: 122 case `unittest`: 123 case `ushort`: 124 case `version`: 125 case `void`: 126 case `volatile`: 127 case `wchar`: 128 case `while`: 129 case `with`: 130 return true; 131 132 default: 133 return false; 134 } 135 }