Exemple #1
0
 public DimAST(FileAST astFile, SectionNameRaw nameSection, SectionExtendsRaw extendsSection, SectionPropertiesRaw propertiesSection)
     : base(astFile)//, nameSection)
 {
     DimNameSection = new SectionDimName(nameSection);
     Extends        = new SectionExtendsDim(extendsSection);
     Properties     = new SectionPropertiesDim(this, propertiesSection);
 }
Exemple #2
0
        private SectionRaw ParseSection()
        {
            string headText      = tape.Current.FirstToken.Text;
            bool   secondIsColon = tape.Current.SecondToken.IsKind(TokenKindSymbol.Colon);

            if (false)
            {
                //<<重新编写分析,同行换行都可以>>
            }
            else if (secondIsColon && headText == "导入包")
            {
                SectionImportRaw section = ParseImport();
                return(section);
            }
            else if (secondIsColon && headText == "导入类")
            {
                SectionUseRaw section = ParseUse();
                return(section);
            }
            //else if (secondIsColon && headText == "约定")
            //{
            //    SectionEnum section = ParseEnum();
            //    return section;
            //}
            else if (secondIsColon && headText == "名称")
            {
                SectionNameRaw section = ParseClassName();
                return(section);
            }
            else if (secondIsColon && headText == "属于")
            {
                SectionExtendsRaw section = ParseExtends();
                return(section);
            }
            //else if (secondIsColon && headText == "声明" )
            //{
            //    SectionDim section = ParseDim();
            //    return section;
            //}
            else if (secondIsColon && headText == "属性")
            {
                SectionPropertiesRaw section = ParseProperties();
                return(section);
            }
            else
            {
                SectionProcRaw section = ParseProc();
                return(section);
            }
        }
Exemple #3
0
        public ClassAST(FileAST astFile, SectionNameRaw nameSection, SectionExtendsRaw extendsSection
                        , SectionPropertiesRaw propertiesSection)
            : base(astFile)
        {
            this.ClassContext = new ContextClass(this.FileContext);
            ClassNameSection  = new SectionClassName(nameSection);
            Constructors      = new List <ProcConstructorBase>();
            Methods           = new List <ProcMethod>();


            Extends = new SectionExtendsClass(this, extendsSection);

            if (propertiesSection != null)
            {
                Properties = new SectionPropertiesClass(this, propertiesSection);
            }
        }
Exemple #4
0
        private SectionNameRaw ParseClassName()
        {
            SectionNameRaw      ast        = new SectionNameRaw();
            LexToken            headToken  = tape.Current.FirstToken;
            LineTokenCollection lineTokens = tape.Current;

            if (lineTokens.Count == 3)
            {
                ast.NameToken = (LexTokenText)lineTokens.Get(2);
            }
            else if (lineTokens.Count > 3)
            {
                error(lineTokens.Get(3), string.Format("类型名称后的'{0}'是多余的", lineTokens.Get(3)));
            }
            //string headFirstText = headToken.Text;
            //if (headFirstText.Length > 2)
            //{
            //    string baseTypeName = headFirstText.Substring(0, headFirstText.Length - 2);
            //    ast.BaseTypeToken = new LexTokenText( headToken.Line, headToken.Col,baseTypeName);
            //}
            //else
            //{
            //    ast.BaseTypeToken = null;
            //}

            //if(tape.Current.Count>=3)
            //{
            //    LexToken nameToken = tape.Current.Get(2);
            //    if (nameToken.IsKind(TokenKindKeyword.Ident))
            //    {
            //        ast.NameToken = nameToken;
            //        tape.MoveNext();
            //    }
            //}
            //if (tape.Current.Count > 3)
            //{
            //    for(int i=3;i<tape.Current.Count;i++)
            //    {
            //        LexToken tok = tape.Current.Get(i);
            //        error(tok, string.Format("类型名称后的'{0}'是多余的", tok.Text));
            //    }
            //}
            tape.MoveNext();
            return(ast);
        }
Exemple #5
0
 public SectionClassName(SectionNameRaw raw)
     : base(raw)
 {
 }
Exemple #6
0
 public SectionDimName(SectionNameRaw raw)
     : base(raw)
 {
 }
Exemple #7
0
        //public SectionNameBase( )
        //{

        //}

        public SectionNameBase(SectionNameRaw raw)
        {
            Raw = raw;
        }