本文整理汇总了C#中Boo.Lang.Compiler.Ast.MacroStatement.ReplaceBy方法的典型用法代码示例。如果您正苦于以下问题:C# MacroStatement.ReplaceBy方法的具体用法?C# MacroStatement.ReplaceBy怎么用?C# MacroStatement.ReplaceBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Boo.Lang.Compiler.Ast.MacroStatement
的用法示例。
在下文中一共展示了MacroStatement.ReplaceBy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMacroStatement
public override void OnMacroStatement(MacroStatement node)
{
if (node.Name == "BODY")
{
node.ReplaceBy(this.block);
}
else{
base.OnMacroStatement(node);
}
}
示例2: OnMacroStatement
public override void OnMacroStatement(MacroStatement node)
{
if (node.Name == "includeast")
{
var expander = new IncludeastMacro();
var statements = expander.ExpandGenerator(node);
var block = new Block();
foreach (var statement in statements){
block.Statements.Add((Statement)statement);
}
node.ReplaceBy(block);
}
else{
base.OnMacroStatement(node);
}
}
示例3: OnMacroStatement
public override void OnMacroStatement(MacroStatement node){
exceptions = exceptions ?? new List<string>();
MacroStatement x = node;
var name = node.Name;
var simplename = name.Replace("_","");
var _bml = node.findMacroContainer("bml");
var bml = _bml!= null;
//set templates as exceptions
if (bml && node.Name == "template"){
var templatename = node.Arguments[0].ToCodeString();
exceptions.Add(templatename);
var templates = GetTemplates(_bml);
templates[templatename] = node;
//node.ReplaceBy(null);
}
else if (bml &&
(allowall && (!exceptions.Contains(simplename)))
||
(!allowall && exceptions.Contains(simplename)))
{
//if (node.findMacroContainer("template") == null){
x = new MacroStatement("bmlelement");
x.Arguments.Add(new ReferenceExpression(simplename));
if(name==simplename||name.EndsWith("_")){
x.Arguments.Add(new ReferenceExpression("___start"));
}
if(name==simplename||name.StartsWith("_")){
x.Arguments.Add(new ReferenceExpression("___end"));
}
foreach (Expression argument in node.Arguments){
x.Arguments.Add(argument.CloneNode());
}
x.Body = node.Body.CloneNode();
Visit(x.Body);
gradeReferencesAndStringsToBeWriteout(x.Body);
node.ReplaceBy(x);
//}
}
else if (node.Name == "bml"){
bmlelements.Add(node);
allowall = false;
exceptions = new List<string>(BmlMacro.SupportedElements);
if (null != node.Arguments.OfType<ReferenceExpression>().FirstOrDefault(n => n.ToCodeString() == "all")){
allowall = true;
exceptions = null;
}
BinaryExpression _exc_def = null;
if (null !=
(_exc_def =
node.Arguments.OfType<BinaryExpression>().FirstOrDefault(n => n.Left.ToCodeString() == "ex"))){
var _ex = _exc_def.Right as ArrayLiteralExpression;
IList<string> _newexceptions = new List<string>();
foreach (Expression item in _ex.Items){
_newexceptions.Add(item.ToCodeString());
}
exceptions = _newexceptions.ToList();
}
}
Visit(x.Body.Statements);
}