| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * A keyword in the Dart programming language. | 6 * A keyword in the Dart programming language. |
| 7 */ | 7 */ |
| 8 class Keyword implements SourceString { | 8 class Keyword implements SourceString { |
| 9 static const List<Keyword> values = const <Keyword> [ | 9 static const List<Keyword> values = const <Keyword> [ |
| 10 const Keyword("break"), | 10 const Keyword("break"), |
| 11 const Keyword("case"), | 11 const Keyword("case"), |
| 12 const Keyword("catch"), | 12 const Keyword("catch"), |
| 13 const Keyword("class"), | 13 const Keyword("class"), |
| 14 const Keyword("const"), | 14 const Keyword("const"), |
| 15 const Keyword("continue"), | 15 const Keyword("continue"), |
| 16 const Keyword("default"), | 16 const Keyword("default"), |
| 17 const Keyword("do"), | 17 const Keyword("do"), |
| 18 const Keyword("else"), | 18 const Keyword("else"), |
| 19 const Keyword("extends"), | 19 const Keyword("extends"), |
| 20 const Keyword("false"), | 20 const Keyword("false"), |
| 21 const Keyword("final"), | 21 const Keyword("final"), |
| 22 const Keyword("finally"), | 22 const Keyword("finally"), |
| 23 const Keyword("for"), | 23 const Keyword("for"), |
| 24 const Keyword("if"), | 24 const Keyword("if"), |
| 25 const Keyword("in"), | 25 const Keyword("in"), |
| 26 // TODO(ahe): Don't think this is a reserved word. | |
| 27 // See: http://dartbug.com/5579 | |
| 28 const Keyword("is", info: IS_INFO), | |
| 29 const Keyword("new"), | 26 const Keyword("new"), |
| 30 const Keyword("null"), | 27 const Keyword("null"), |
| 31 const Keyword("return"), | 28 const Keyword("return"), |
| 32 const Keyword("super"), | 29 const Keyword("super"), |
| 33 const Keyword("switch"), | 30 const Keyword("switch"), |
| 34 const Keyword("this"), | 31 const Keyword("this"), |
| 35 const Keyword("throw"), | 32 const Keyword("throw"), |
| 36 const Keyword("true"), | 33 const Keyword("true"), |
| 37 const Keyword("try"), | 34 const Keyword("try"), |
| 38 const Keyword("var"), | 35 const Keyword("var"), |
| 39 const Keyword("void"), | 36 const Keyword("void"), |
| 40 const Keyword("while"), | 37 const Keyword("while"), |
| 41 | 38 |
| 39 // TODO(ahe): Don't think this is a reserved word. |
| 40 // See: http://dartbug.com/5579 |
| 41 const Keyword("is", info: IS_INFO), |
| 42 |
| 42 const Keyword("abstract", isBuiltIn: true), | 43 const Keyword("abstract", isBuiltIn: true), |
| 43 const Keyword("as", info: AS_INFO, isBuiltIn: true), | 44 const Keyword("as", info: AS_INFO, isBuiltIn: true), |
| 44 const Keyword("assert", isBuiltIn: true), | 45 const Keyword("assert", isBuiltIn: true), |
| 45 const Keyword("dynamic", isBuiltIn: true), | 46 const Keyword("dynamic", isBuiltIn: true), |
| 47 const Keyword("export", isBuiltIn: true), |
| 46 const Keyword("external", isBuiltIn: true), | 48 const Keyword("external", isBuiltIn: true), |
| 47 const Keyword("factory", isBuiltIn: true), | 49 const Keyword("factory", isBuiltIn: true), |
| 48 const Keyword("get", isBuiltIn: true), | 50 const Keyword("get", isBuiltIn: true), |
| 49 const Keyword("implements", isBuiltIn: true), | 51 const Keyword("implements", isBuiltIn: true), |
| 52 const Keyword("import", isBuiltIn: true), |
| 50 const Keyword("interface", isBuiltIn: true), | 53 const Keyword("interface", isBuiltIn: true), |
| 54 const Keyword("library", isBuiltIn: true), |
| 51 const Keyword("operator", isBuiltIn: true), | 55 const Keyword("operator", isBuiltIn: true), |
| 56 const Keyword("part", isBuiltIn: true), |
| 52 const Keyword("set", isBuiltIn: true), | 57 const Keyword("set", isBuiltIn: true), |
| 53 const Keyword("static", isBuiltIn: true), | 58 const Keyword("static", isBuiltIn: true), |
| 54 const Keyword("typedef", isBuiltIn: true), | 59 const Keyword("typedef", isBuiltIn: true), |
| 55 | 60 |
| 56 const Keyword("export", isPseudo: true), | |
| 57 const Keyword("hide", isPseudo: true), | 61 const Keyword("hide", isPseudo: true), |
| 58 const Keyword("import", isPseudo: true), | |
| 59 const Keyword("library", isPseudo: true), | |
| 60 const Keyword("native", isPseudo: true), | 62 const Keyword("native", isPseudo: true), |
| 61 const Keyword("of", isPseudo: true), | 63 const Keyword("of", isPseudo: true), |
| 62 const Keyword("on", isPseudo: true), | 64 const Keyword("on", isPseudo: true), |
| 63 const Keyword("part", isPseudo: true), | |
| 64 const Keyword("show", isPseudo: true), | 65 const Keyword("show", isPseudo: true), |
| 65 const Keyword("source", isPseudo: true) ]; | 66 const Keyword("source", isPseudo: true) ]; |
| 66 | 67 |
| 67 // TODO(aprelev@gmail.com): Remove deprecated Dynamic keyword support. | 68 // TODO(aprelev@gmail.com): Remove deprecated Dynamic keyword support. |
| 68 static const DYNAMIC_DEPRECATED = const Keyword("Dynamic", isBuiltIn: true); | 69 static const DYNAMIC_DEPRECATED = const Keyword("Dynamic", isBuiltIn: true); |
| 69 | 70 |
| 70 final String syntax; | 71 final String syntax; |
| 71 final bool isPseudo; | 72 final bool isPseudo; |
| 72 final bool isBuiltIn; | 73 final bool isBuiltIn; |
| 73 final PrecedenceInfo info; | 74 final PrecedenceInfo info; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 final Keyword keyword; | 222 final Keyword keyword; |
| 222 | 223 |
| 223 LeafKeywordState(String syntax) : keyword = Keyword.keywords[syntax]; | 224 LeafKeywordState(String syntax) : keyword = Keyword.keywords[syntax]; |
| 224 | 225 |
| 225 bool isLeaf() => true; | 226 bool isLeaf() => true; |
| 226 | 227 |
| 227 KeywordState next(int c) => null; | 228 KeywordState next(int c) => null; |
| 228 | 229 |
| 229 String toString() => keyword.syntax; | 230 String toString() => keyword.syntax; |
| 230 } | 231 } |
| OLD | NEW |