Exemplo n.º 1
0
        void parseAgreement()
        {
            var tempToken = CurrentToken;

            MoveNext(); //跳过"约定"
            MoveNext(); //跳过":"
            List <Token> items = parseAgreementBlock(tempToken.Postion);

            foreach (var token in items)
            {
                TKTContentModel tc = new TKTContentModel(token.GetText(), CurrentToken.Postion);
                tktclass.EnumItems.Add(tc);
            }
        }
Exemplo n.º 2
0
 void parsePackageList()
 {
     //List<PackageAST> list = new List<PackageAST>();
     if (CurrentKind == TokenKind.Ident)
     {
         TKTContentModel uc = new TKTContentModel()
         {
             Postion = CurrentToken.Postion
         };
         string packageName = parsePackage(); //PackageAST ast = parsePackage();
         uc.Content = packageName;
         //if (ast != null)
         //{
         //    list.Add(ast);
         //}
         tktclass.UsingPackages.Add(uc);
         while (CurrentKind == TokenKind.Comma)
         {
             MoveNext();
             if (CurrentKind == TokenKind.Ident)
             {
                 string          packageName2 = parsePackage(); //PackageAST ast2 = parsePackage();
                 TKTContentModel uc2          = new TKTContentModel()
                 {
                     Postion = CurrentToken.Postion
                 };
                 uc2.Content = packageName2;
                 tktclass.UsingPackages.Add(uc2);
                 //if (ast != null)
                 //{
                 //    list.Add(ast2);
                 //}
             }
             else
             {
                 //error("错误的类型名称");
                 break;
             }
         }
     }
     else
     {
         //error("错误的开发包名称");
         MoveNext();
     }
     //return list;
 }
Exemplo n.º 3
0
        void parseAgreement()
        {
            var tempToken = CurrentToken;

            MoveNext(); //跳过"约定"
            MoveNext(); //跳过":"
            //AgreementAST agreeast = new AgreementAST();
            //agreeast.KeyToken = tempToken;
            List <Token> items = parseAgreementBlock(tempToken.Postion);

            //agreeast.ValueList.AddRange(items);
            //prog.Add(agreeast);
            foreach (var token in items)
            {
                TKTContentModel tc = new TKTContentModel(token.GetText(), CurrentToken.Postion);
                tktclass.EnumItems.Add(tc);
            }
        }
Exemplo n.º 4
0
        void ParseSimpleUse()
        {
            MoveNext();                    //跳过"使用"
            MoveNext();                    //跳过":"
            var NameTokens = parseNames(); //ast.NameTokens = parseNames();

            foreach (var token in NameTokens)
            {
                TKTContentModel tcm = new TKTContentModel()
                {
                    Postion = token.Postion
                };
                tcm.Content = token.ToCode();
                tktclass.RedirectTypes.Add(tcm);
            }
            matchSemiOrNewLine();// match(TokenKind.Semi);
            //return ast;
        }