当前位置: 首页>>代码示例>>C#>>正文


C# AstNode.Accept方法代码示例

本文整理汇总了C#中AstNode.Accept方法的典型用法代码示例。如果您正苦于以下问题:C# AstNode.Accept方法的具体用法?C# AstNode.Accept怎么用?C# AstNode.Accept使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AstNode的用法示例。


在下文中一共展示了AstNode.Accept方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Apply

 public static void Apply(AstNode node)
 {
     if (node != null)
     {
         node.Accept(s_instance); 
     }
 }
开发者ID:Aliceljm1,项目名称:kiss-project.web,代码行数:7,代码来源:DetachReferences.cs

示例2: RegularTree

        public RegularTree(AstNode root)
        {
            this.EoiCharSetNode = CharSetNode.Create(EoiChar);
            this.AugmentedRoot = new CatNode(new List<AstNode> { root, EoiCharSetNode });

            var positionBuilder = new PositionBuilder();
            AugmentedRoot.Accept(positionBuilder, null);
            Positions = positionBuilder.Positions;

            EoiPosition = Positions.FindIndex(pos => pos.Characters.Contains(EoiChar));
            Debug.Assert(EoiPosition >= 0);

            var firstPosVisitor = new FirstPosGetter();
            this.FirstPos = AugmentedRoot.Accept(firstPosVisitor, 0);

            var followPosBuilder = new FollowPosBuilder(Positions);
            AugmentedRoot.Accept(followPosBuilder, 0);
        }
开发者ID:bkushnir,项目名称:IronTextLibrary,代码行数:18,代码来源:RegularTree.cs

示例3: Apply

        public static bool Apply(TextWriter writer, AstNode node)
        {
            if (node != null)
            {
                var visitor = new JSONOutputVisitor(writer);
                node.Accept(visitor);
                return visitor.IsValid;
            }

            return false;
        }
开发者ID:Aliceljm1,项目名称:kiss-project.web,代码行数:11,代码来源:JSONOutputVisitor.cs

示例4: Match

        public bool Match(AstNode node, string identifiers)
        {
            // set the match to false
            m_isMatch = false;

            // identifiers cannot be null or blank and must match: IDENT(.IDENT)*
            // since for JS there has to be at least a global object, the dot must be AFTER the first character.
            if (node != null && !string.IsNullOrEmpty(identifiers))
            {
                // get all the parts
                var parts = identifiers.Split('.');

                // each part must be a valid JavaScript identifier. Assume everything is valid
                // unless at least one is invalid -- then forget it
                var isValid = true;
                foreach (var part in parts)
                {
                    if (!JSScanner.IsValidIdentifier(part))
                    {
                        isValid = false;
                        break;
                    }
                }

                // must be valid to continue
                if (isValid)
                {
                    // save the parts and start the index on the last one, since we'll be walking backwards
                    m_parts = parts;
                    m_index = parts.Length - 1;

                    node.Accept(this);
                }
            }

            return m_isMatch;
        }
开发者ID:Aliceljm1,项目名称:kiss-project.web,代码行数:37,代码来源:MatchPropertiesVisitor.cs

示例5: Visit

 public void Visit(AstNode node)
 {
     if (node != null)
         node.Accept(this);
 }
开发者ID:Turbo87,项目名称:DGrok,代码行数:5,代码来源:Visitor.cs

示例6: VisitChild

 private CodeDomArg VisitChild(AstNode node, CodeDomArg arg)
 {
     _codeStack.Push(arg);
     node.Accept(this);
     return _codeStack.Pop();
 }
开发者ID:bitsummation,项目名称:pickaxe,代码行数:6,代码来源:Visitor.CodeDomGenerator.cs

示例7: Apply

        public static void Apply(AstNode node, ActivationObject scope, CodeSettings settings)
        {
            if (node != null && scope != null)
            {
                // create the visitor and run it. This will create all the child
                // scopes and populate all the scopes with the var-decl, lex-decl,
                // and lookup references within them.
                var visitor = new ResolutionVisitor(scope, settings);
                node.Accept(visitor);

                // now that all the scopes are created and they all know what decls
                // they contains, create all the fields
                CreateFields(scope);

                // now that all the fields have been created in all the scopes,
                // let's go through and resolve all the references
                ResolveLookups(scope, settings);

                // now that everything is declared and resolved as per the language specs,
                // we need to go back and add ghosted fields for older versions of IE that
                // incorrectly implement catch-variables and named function expressions.
                AddGhostedFields(scope);
            }
        }
开发者ID:Aliceljm1,项目名称:kiss-project.web,代码行数:24,代码来源:ResolutionVisitor.cs

示例8: IsNullable

 private static bool IsNullable(AstNode root)
 {
     bool result = root.Accept(NullableGetter.Instance);
     return result;
 }
开发者ID:bkushnir,项目名称:IronTextLibrary,代码行数:5,代码来源:ScannerDescriptor.cs

示例9: NeedsParens

 public static bool NeedsParens(AstNode expression, bool outerHasNoArguments)
 {
     var visitor = new NewParensVisitor(outerHasNoArguments);
     expression.Accept(visitor);
     return visitor.m_needsParens;
 }
开发者ID:Aliceljm1,项目名称:kiss-project.web,代码行数:6,代码来源:NewParensVisitor.cs


注:本文中的AstNode.Accept方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。