ReplaceCurrentNode was indeed the answer. Thanks for your help.
I realise that my query had nothing to do with the Rhino source. Is there a boo user group that you know of? Cheers Paul 2009/1/3 Paul Cowan <[email protected]> > Excellent, I think I am nearly there. > > Thanks > > > 2009/1/3 Ayende Rahien <[email protected]> > >> You need a transformer, and then you can do something like: >> ReplaceCurrentNode( new MethodInvocationExpression( new >> ReferenceExpression("CopyTo"), binaryExpression.Left, >> binarExpression.Right)); >> >> >> On Sat, Jan 3, 2009 at 3:30 PM, Paul Cowan <[email protected]> wrote: >> >>> Hi, >>> >>> I have created an AbstractVisitorCompilerStep and have the following >>> OnBlockExpression: >>> >>> public override void OnBlockExpression(BlockExpression node) >>> { >>> foreach (Statement statement in node.Body.Statements) >>> { >>> MethodInvocationExpression method = >>> (MethodInvocationExpression)((ExpressionStatement) statement).Expression; >>> >>> foreach(Expression arg in method.Arguments) >>> { >>> if ((!(arg is BinaryExpression)) && >>> ((BinaryExpression)arg).Operator != BinaryOperatorType.ShiftRight) >>> continue; >>> >>> var binaryExpression = (BinaryExpression) arg; >>> } >>> } >>> >>> base.OnBlockExpression(node); >>> } >>> >>> Do I just create a new BlockExpression and pass it to the base >>> OnBlockExpression? >>> >>> >>> Cheers >>> >>> Paul >>> >>> 2009/1/3 Ayende Rahien <[email protected]> >>> >>>> You need to process the >> early in the compiler life cycle.Ideally, >>>> you would have a visitor at step 2 or 3 that would look for the right shift >>>> operator and translate that to copy_to("log4net", "bin") method call >>>> >>>> >>>> On Sat, Jan 3, 2009 at 1:37 PM, Paul Cowan <[email protected]> wrote: >>>> >>>>> Hi, >>>>> >>>>> I have come up with the following syntax which I quite like: >>>>> >>>>> dependencies: >>>>> depend "log4net" >> "bin" >>>>> >>>>> But I get the following runtime exception: >>>>> >>>>> >>>>> Operator '>>' cannot be used with a left hand side of type 'string' and a >>>>> right hand side of type 'string'. >>>>> >>>>> I have tried adding the following compiler state which I thought might >>>>> fix it but alas it does not: >>>>> >>>>> pipeline.Insert(1, new >>>>> ImplicitBaseClassCompilerStep(typeof(BaseConfigReader), "Prepare", >>>>> "Horn.Core.dsl")); >>>>> pipeline.InsertBefore(typeof(ProcessMethodBodiesWithDuckTyping), new >>>>> UnderscorNamingConventionsToPascalCaseCompilerStep()); >>>>> pipeline.Insert(2, new UseSymbolsStep()); >>>>> >>>>> Can anyone see what else, I need to do? >>>>> >>>>> Cheers >>>>> >>>>> Paul >>>>> >>>>> >>>>> 2009/1/3 Ayende Rahien <[email protected]> >>>>> >>>>>> No, you can just use >> with the source that you have, because this is >>>>>> a builtin operator >>>>>> For words, you would need the patch. >>>>>> You can see an example of using >> in Rhino ETL >>>>>> >>>>>> >>>>>> On Sat, Jan 3, 2009 at 11:44 AM, Paul Cowan <[email protected]>wrote: >>>>>> >>>>>>> Great! >>>>>>> >>>>>>> Do I need to download the patch? >>>>>>> >>>>>>> Is there an example of using ">>" anywhere? >>>>>>> >>>>>>> Perhaps in the Rhino source? >>>>>>> >>>>>>> 2009/1/3 Ayende Rahien <[email protected]> >>>>>>> >>>>>>> That would require macro operators, which are currently not part of >>>>>>>> boo. >>>>>>>> There is a patch for this that I made a while ago, though. >>>>>>>> >>>>>>>> What you can do is: >>>>>>>> >>>>>>>> depend: >>>>>>>> log4net >> "lib" >>>>>>>> >>>>>>>> >>>>>>>> On Sat, Jan 3, 2009 at 11:28 AM, dagda1 <[email protected]> wrote: >>>>>>>> >>>>>>>>> >>>>>>>>> Hi, >>>>>>>>> >>>>>>>>> I am extending an existing DSL for the open source project I am >>>>>>>>> working on code named horn ( >>>>>>>>> http://the-software-simpleton.blogspot.com/ >>>>>>>>> 2008/12/horn-package-management-project.html<http://the-software-simpleton.blogspot.com/2008/12/horn-package-management-project.html> >>>>>>>>> ). >>>>>>>>> >>>>>>>>> Anyway I am trying to define dependencies as part of the existing >>>>>>>>> boo >>>>>>>>> DSL and I want the following syntax to tell me which dependency to >>>>>>>>> include and where it should be copied too when it has been >>>>>>>>> compiled. >>>>>>>>> >>>>>>>>> I am trying to get the following syntax but I do not believe this >>>>>>>>> is >>>>>>>>> possible: >>>>>>>>> >>>>>>>>> depend: >>>>>>>>> Log4net copy_to "lib" >>>>>>>>> >>>>>>>>> I know the following is possible: >>>>>>>>> >>>>>>>>> depend: >>>>>>>>> Include log4net, "lib" >>>>>>>>> >>>>>>>>> I really do not like the second syntax and can anyone help me >>>>>>>>> getter a >>>>>>>>> more descriptive syntax? >>>>>>>>> >>>>>>>>> Cheers >>>>>>>>> >>>>>>>>> Paul >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>> >>> >>> >> >> >> >> > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Rhino Tools Dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rhino-tools-dev?hl=en -~----------~----~----~----~------~----~------~--~---
