本文整理汇总了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);
}
}
示例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);
}
示例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;
}
示例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;
}
示例5: Visit
public void Visit(AstNode node)
{
if (node != null)
node.Accept(this);
}
示例6: VisitChild
private CodeDomArg VisitChild(AstNode node, CodeDomArg arg)
{
_codeStack.Push(arg);
node.Accept(this);
return _codeStack.Pop();
}
示例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);
}
}
示例8: IsNullable
private static bool IsNullable(AstNode root)
{
bool result = root.Accept(NullableGetter.Instance);
return result;
}
示例9: NeedsParens
public static bool NeedsParens(AstNode expression, bool outerHasNoArguments)
{
var visitor = new NewParensVisitor(outerHasNoArguments);
expression.Accept(visitor);
return visitor.m_needsParens;
}