Exemplo n.º 1
0
 public static void CheckStaticFieldDef(RangeFinderState s, StaticFieldDef a)
 {
     CheckAny(s, a.Name);
     CheckAny(s, a.Type);
     CheckList(s, a.Attributes);
     CheckAny(s, a.InitializerExpr);
 }
Exemplo n.º 2
0
 public static void PrintStaticFieldDef(PrintState s, StaticFieldDef a)
 {
     PrintDescWithToken(s, "StaticFieldDef", a.Name);
     Indent(s);
     PrintDescWithAny(s, "Type", a.Type);
     UnIndent(s);
 }
Exemplo n.º 3
0
        public static StaticFieldDef ParseEnumMemberTail(ParserState s, Token name, NamespaceDef parent)
        {
            var def = new StaticFieldDef {
                Name = name, IsEnumOption = true, Parent = parent
            };

            if (s.Token.Type == TokenType.Operator && s.Token.Value == "=")
            {
                ReadToken(s);
                def.InitializerExpr = ParseExpression(s, 0, true);
            }
            return(def);
        }
Exemplo n.º 4
0
        public static StaticFieldDef ParseStaticField(ParserState s, NamespaceDef parent)
        {
            ParseTokenWithType(s, TokenType.Colon);
            var id  = ParseTokenWithType(s, TokenType.Identifier);
            var def = new StaticFieldDef {
                Name = id, Parent = parent
            };

            if (s.Token.Type == TokenType.Identifier || (s.Token.Type == TokenType.Operator && (s.Token.Value == "*" || s.Token.Value == "$" || s.Token.Value == "::")))
            {
                def.Type = ParseType(s);
            }
            def.Attributes = TryParseAttributes(s);
            if (s.Token.Type == TokenType.Operator && s.Token.Value == "=")
            {
                ReadToken(s);
                def.InitializerExpr = ParseExpression(s, 0, true);
            }
            return(def);
        }