Get runtime ColdFusion syntax trees? - coldfusion

Is it possible to get access to / modify ColdFusion syntax trees at run time?
I'd wager not, and a 10 minute google search didn't find anything. Fiddling with closures and writing metadata dumps, we can see stringified versions of objects like [runtime expression], for example in the following:
function x(a=b+1) {}
WriteDump(getMetaData(x).parameters[1]["default"]);
Does it allow us to go no deeper than this, or perhaps someone knows how to keep digging and start walking trees?

Default UDF parameter expressions aren't available in function metadata as you've found. Other libraries that have implemented some form of CFML parser are
CFLint (written in Java and using ANTLR)
https://github.com/cflint/CFLint
CFFormat (also uses a binary compiled from Rust)
https://www.forgebox.io/view/commandbox-cfformat
Function LineNums (pure CFML)
https://www.forgebox.io/view/funclinenums

There is also a function callStackGet() docs: https://cfdocs.org/callstackget which might be useful to whatever you are trying to do.
And another CFML parser (written in CFML) here: https://github.com/foundeo/cfmlparser

Related

How to use the `cc_common.create_link_variables` API?

I'm trying to write some complex Starlark rules that link and build multiple dynamic libraries on Linux using the (relatively) new cc_common APIs.
There seems to be 2 different ways you can create compile/link actions using this API:
Using the compile()/link() methods, which are relatively "high-level", and
Using the create_compile_variables()/create_link_variables() along with get_memory_inefficient_command_line() and then calling actions.run() directly with the generated command line.
In particualr, I'm trying to get #2 to work. My question is, how can I create the param_file to pass into create_link_variables? There doesn't seem to be any Starlark API for this.
https://docs.bazel.build/versions/1.1.0/skylark/lib/cc_common.html#create_link_variables
agoessling I have shared a couple of source files for you here
It should give you a pretty good idea of how this lower level cc_common API can be used end to end.
There are still known holes in this API, i.e. not everything possible with the built-in cc rules also possible through cc_common, but I would say 90% is available.
I am not associated with the Bazel team and the code is the result of my own digging and sniffing. No warranties, but it works for me. Let me know if you get stuck on something - I will try to help.
If you get an idea of how to do some of it better (prettier, more compatible with the built-in rules, more platform-independent, etc.) I am all ears. Good luck!

How can you obtain an AST for Microsoft C++ (MSVC)?

I want to be able to query what dependencies there are for C++ functions and variables in my source code. You could do that with Clang on the Linux side, but for Windows(.NET, etc) I can't seem to find a way to get access to the AST.
Background:
Say I fixed a part of my code. I'm trying to find a tool to easily identify all the areas in my source code affected by this fix. For example, if I changed Foo(), I'll check all areas that Foo() is used and all functions that Foo() calls, gather them, and print them out in a list. Preferably, it will also be able to gather multiple levels of dependencies. If it were to be represented visually, it'll look something like Sourcetrail. Unfortunately, I want to be able to do this programmatically instead of via a UI, so that link isn't what I'm looking for. I looked at DMS Search Engine but I can't seem to make its trial version to download. So I was wondering if I can just do it myself. But I can't seem to figure out how Sourcetrail, for example, was able to get the AST from a Visual Studio C++ project.

How to implement an #if function into a infobox?

So I've been trying to implement an #if parser into an infobox, but I seem to be out of luck. The previous code I used seems to be outdated, and I can't find the a way to code it in again, differentely. :/
Basically, in this infobox, if a field is not typed in(or if typed in is left empty) it should become 'invisible' or not even render.
This code worked fine in a previous version of MediaWiki(not sure which one though), but no longer: http://pastebin.com/uQ49mPbQ. I've been trying to use it as a tutorial, and even outright copy and pasted it, but it simply doesn't work. All of the fields would become invisible, regardless of what I would have done to them...
This is the new code that I am using, and would like to be #if'ed: http://pastebin.com/3j0AbN5v
Any help would be welcome.
You need to enable the ParserFunctions extension to be able to use the {{#if}} parser function. Do this in your LocalSettings.php:
require_once( "$IP/extensions/ParserFunctions/ParserFunctions.php" );
If you want to use the string functions (like {{#replace}}, {{#explode}}, etc), also add:
$wgPFEnableStringFunctions = true;
In recent versions of MediaWiki, ParserFunctions is included (but not enabled) so you don't need to download anything.
Basic troubleshooting: Whenever you see code like {{#zyx:...}} in a wiki page, it (probably) means, that someone tried to use a parser function that is not installed. Unless there is a parser function called “zyx” installed, the code {{#zyx:...}} has no special meaning to the wiki, and the text will be printed just like it is. The most common parser functions are collected in an extension called ParserFunctions, that is used on WikiMedia wikis. You will need the parser functions from ParserFunctions whenever copying templates from e.g. English Wikipedia.
To see what parser functions you have enabled, navigate to Special:Version on your wiki. Below the list of installed extensions is a list of tags (such as <gallery />) and parser functions available. As you can see, “if” is among the parser functions on your old wiki, but not on your new.

How to avoid csc.exe being called from runtime in sharepoint 2010

I have seen some posts that mention the xmlserializer being called at runtime in .Net.
I have a sharepoint web-part that calls a webservice to retrieve data, and then is supposed to display that data on the web-part. But I get this error:
System.Runtime.InteropServices.ExternalException: Cannot execute a program. The command being executed was "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\csc.exe" /noconfig /fullpaths #"C:\Users\my_deploy_spFarm_user\AppData\Local\Temp\OICE_356C17F3-2ED2-423C-8BBE-CA5C05740FD7.0\eelwfhnn.cmdline
Now the posts I have read here, state that the problem is that the compiler is trying to to create an XML serialization assembly on the fly, but does not have privilege to do so.
I have seen some suggestions to use the post-build events to create this XML Serialization Assembly at Compile-time. However I am not sure of how to do that, and also I am not sure if this assemply would get included in the .wsp package?
I'd take a good look at whether you really want the full, automatically generated serializer, or whether you just want to emit/parse some relatively straightforward XML - if the latter, you'll solve this problem by not using stuff that needs generated code, i.e. use the XmlReader/XmlWriter directly.
This link has the basic command to create the pre-compiled serializers.

C++ Transformer scripting

Im looking to see if there are any pre-existing projects that do this.
Generally, I need something that will load in a c++ file and parse it and then based on a set of rules in script, transform it, say to add headers, reformat, or remove coding quirks for example, turning const int parameters in functions to int parameters, etc Or perhaps something that would generate a dom of some sorts based on the c++ file fed in that could be manipulated and written out again.
Are there any such projects/products out there free or commercial?
Taras Glek of Mozilla has been working on the dehydra tool, based on Elkhound and scripted using JavaScript to transform the Mozilla codebase to fit with XPCOM and garbage collector changes.
The Parser from Eclipse CDT seems to be pretty complete by now, as some refactoring methods have been alredy contributed to CDT.