Exemple #1
0
        /*?*/
        internal static Keyword[] InitSpecKeywords()
        {
            Keyword/*?*/[] keywords = new Keyword/*?*/[26];
              Keyword keyword;

              keyword = new Keyword(Token.SpecAtomic, "atomic");
              keyword = new Keyword(Token.SpecAssume, "assume", keyword);
              keyword = new Keyword(Token.SpecAssert, "assert", keyword);
              keyword = new Keyword(Token.SpecAxiom, "axiom", keyword);
              keywords['a' - 'a'] = keyword;

              keyword = new Keyword(Token.SpecDecreases, "decreases");
              keywords['d' - 'a'] = keyword;

              keyword = new Keyword(Token.SpecEnsures, "ensures");
              keywords['e' - 'a'] = keyword;

              keyword = new Keyword(Token.SpecGroup, "group");
              keyword = new Keyword(Token.SpecGhost, "ghost", keyword);
              keywords['g' - 'a'] = keyword;

              keyword = new Keyword(Token.SpecInvariant, "invariant");
              keywords['i' - 'a'] = keyword;

              keyword = new Keyword(Token.SpecLogic, "logic");
              keywords['l' - 'a'] = keyword;

              keyword = new Keyword(Token.SpecOut, "out");
              keywords['o' - 'a'] = keyword;

              keyword = new Keyword(Token.SpecRequires, "requires");
              keyword = new Keyword(Token.SpecReads, "reads", keyword);
              keywords['r' - 'a'] = keyword;

              keyword = new Keyword(Token.SpecUnwrapping, "unwrapping");
              keyword = new Keyword(Token.Unchecked, "unchecked", keyword);
              keywords['u' - 'a'] = keyword;

              keyword = new Keyword(Token.SpecWrites, "writes");
              keywords['w' - 'a'] = keyword;
              return keywords;
        }
Exemple #2
0
        /*?*/
        internal static Keyword[] InitKeywords()
        {
            // There is a linked list for each letter.
              // In each list, the keywords are sorted first by length, and then lexicographically.
              // So the constructor invocations must occur in the opposite order.
              Keyword/*?*/[] keywords = new Keyword/*?*/[26];
              Keyword keyword;
              // a
              keyword = new Keyword(Token.Auto, "auto");
              keywords['a' - 'a'] = keyword;
              // b+
              keyword = new Keyword(Token.Break, "break");
              keywords['b' - 'a'] = keyword;
              // c
              keyword = new Keyword(Token.Continue, "continue");
              keyword = new Keyword(Token.Const, "const", keyword);
              keyword = new Keyword(Token.Char, "char", keyword);
              keyword = new Keyword(Token.Case, "case", keyword);
              keywords['c' - 'a'] = keyword;
              // d
              keyword = new Keyword(Token.Default, "default", keyword);
              keyword = new Keyword(Token.Double, "double", keyword);
              keyword = new Keyword(Token.Do, "do", keyword);
              keywords['d' - 'a'] = keyword;
              // e
              keyword = new Keyword(Token.Extern, "extern");
              keyword = new Keyword(Token.Enum, "enum", keyword);
              keyword = new Keyword(Token.Else, "else", keyword);
              keywords['e' - 'a'] = keyword;
              // f
              keyword = new Keyword(Token.Float, "float");
              keyword = new Keyword(Token.For, "for", keyword);
              keywords['f' - 'a'] = keyword;
              // g
              keyword = new Keyword(Token.Goto, "goto");
              keywords['g' - 'a'] = keyword;
              // i
              keyword = new Keyword(Token.Inline, "inline");
              keyword = new Keyword(Token.Int, "int", keyword);
              keyword = new Keyword(Token.If, "if", keyword);
              keywords['i' - 'a'] = keyword;
              //l
              keyword = new Keyword(Token.Long, "long");
              keywords['l' - 'a'] = keyword;
              // r
              keyword = new Keyword(Token.Register, "register");
              keyword = new Keyword(Token.Return, "return", keyword);
              keywords['r' - 'a'] = keyword;
              // s
              keyword = new Keyword(Token.Switch, "switch");
              keyword = new Keyword(Token.Struct, "struct", keyword);
              keyword = new Keyword(Token.Static, "static", keyword);
              keyword = new Keyword(Token.Sizeof, "sizeof", keyword);
              keyword = new Keyword(Token.Signed, "signed", keyword);
              keyword = new Keyword(Token.Short, "short", keyword);
              keywords['s' - 'a'] = keyword;
              // t
              keyword = new Keyword(Token.Typename, "typename");
              keyword = new Keyword(Token.Template, "template", keyword);
              keyword = new Keyword(Token.Typedef, "typedef", keyword);
              keywords['t' - 'a'] = keyword;
              // u
              keyword = new Keyword(Token.Unsigned, "unsigned");
              keyword = new Keyword(Token.Union, "union", keyword);
              keywords['u' - 'a'] = keyword;
              // v
              keyword = new Keyword(Token.Volatile, "volatile");
              keyword = new Keyword(Token.Void, "void", keyword);
              keywords['v' - 'a'] = keyword;
              // w
              keyword = new Keyword(Token.While, "while");
              keywords['w' - 'a'] = keyword;

              return keywords;
        }
Exemple #3
0
 internal static Keyword InitExtendedVccKeywords()
 {
     Keyword keyword = null;
       keyword         = new Keyword(Token.Result,           "\\result", keyword);
       keyword         = new Keyword(Token.Lambda,           "\\lambda", keyword);
       keyword         = new Keyword(Token.Forall,           "\\forall", keyword);
       keyword         = new Keyword(Token.Exists,           "\\exists", keyword);
       keyword         = new Keyword(Token.SetUnion,         "\\union", keyword);
       keyword         = new Keyword(Token.SetIntersection,  "\\inter", keyword);
       keyword         = new Keyword(Token.This,             "\\this", keyword);
       keyword         = new Keyword(Token.SetDifference,    "\\diff", keyword);
       keyword         = new Keyword(Token.Old,              "\\old", keyword);
       keyword         = new Keyword(Token.SetIn0,           "\\in0", keyword);
       keyword         = new Keyword(Token.SpecIs,           "\\is", keyword);
       keyword         = new Keyword(Token.SetIn,            "\\in", keyword);
       return keyword;
 }
Exemple #4
0
        public static Keyword InitMicrosoftKeywords()
        {
            // This is a linked list of keywords starting with __
              // In the list, the keywords are sorted first by length, and then lexicographically.
              // So the constructor invocations must occur in the opposite order.
              Keyword keyword = null;
              // __
              keyword = new Keyword(Token.Inline,        "__forceinline", keyword);
              keyword = new Keyword(Token.Unaligned, "__unaligned", keyword);
              keyword = new Keyword(Token.Fastcall,  "__fastcall", keyword);
              keyword = new Keyword(Token.Declspec,  "__declspec", keyword);
              keyword = new Keyword(Token.Stdcall,   "__stdcall", keyword);
              keyword = new Keyword(Token.AlignOf,   "__alignof", keyword);
              keyword = new Keyword(Token.Pragma,    "__pragma", keyword);
              keyword = new Keyword(Token.Inline,    "__inline", keyword);
              keyword = new Keyword(Token.Int64,     "__int64", keyword);
              keyword = new Keyword(Token.Int32,     "__int32", keyword);
              keyword = new Keyword(Token.Int16,     "__int16", keyword);
              keyword = new Keyword(Token.Cdecl,     "__cdecl", keyword);
              keyword = new Keyword(Token.Int8,      "__int8", keyword);
              keyword = new Keyword(Token.W64,       "__w64", keyword);

              return keyword;
        }
Exemple #5
0
        public static Keyword InitExtendedKeywords()
        {
            // This is a linked list of keywords starting with _
              // In the list, the keywords are sorted first by length, and then lexicographically.
              // So the constructor invocations must occur in the opposite order.
              Keyword keyword;
              // _
              //keyword = new Keyword(Token.Imaginary, "_Imaginary");
              //keyword = new Keyword(Token.Complex, "_Complex", keyword);
              keyword = new Keyword(Token.Bool, "_Bool");
              // keyword = new Keyword(Token.Specification, "_", keyword);

              return keyword;
        }
Exemple #6
0
 //^ requires name.Length > 0;
 private Keyword(Token token, string name, Keyword next)
 {
     this.name = name;
       this.next = next;
       this.token = token;
       this.length = name.Length;
 }