Looping the list back in here since it looks like we started replying to each other at some point…
I put a CFC together that we may be able to use in the REPL for parsing CFML script.
See attached files. It’s worked for everything I’ve thrown at it so far, but I’m sure it can be broken.
When you guys have time can you try testing it?
CFMLScriptParser.cfc (1.55 KB)
test.cfm (210 Bytes)
There is now a REPLParser.cfc which parses the CFML and determines if a command has been fully entered or not. Using this approach, we can now provide multi-line support as well as display exceptions / syntax errors to the user.
See attached screenshot.
I need some help with the following items though:
- I’m having issues getting tab completion disabled once in REPL mode. I’ve tried using the removeCompleters() function but I’m missing something.
- Testing the REPL. Please download and test if you can. Also, I’d like to start creating automated tests to test the parser functionality but I’m not sure how to do this with the commandbox code base. How do you run the commandbox test also?
You can view updated source at https://github.com/gcopley/commandbox/tree/REPL_enhancements.
Grant, I think this is a pretty cool start. I tried it out and even demoed some of it in my CommandBox preso Monday for CBDW. I have manually merged what you had in that branch. You can still create pull requests for stuff even if you just want us to review it. That way we can add line-by-line comments, etc in GitHub. GitHub will also let you add additional commits before we finally merge it.
Thanks again for helping out with this stuff!
Brad, I didn’t realize you could modify pull request on GitHub after they are sent. Very cool! I’ll just start doing that going forward.
Yep, you can add as many commits as you want. The PR basically just points to the current state of the branch. That’s why I always create a separate branch per pull because if it takes a while to get merged, you can’t do anything else in your repo or it will be automatically included.