ASM Book Item
frodare opened this issue · 10 comments
Add a new book item that will work like a book and quill with the following options:
- the cursor can be moved to edit text
- code errors will be shown in red
- possible recipe: book and quill surrounded by iron and redstone dust
from: Suggestion on the wiki #3
Absolutely, go right ahead! If you feel like it, add a comment in the source file, but you really don't have to.
I'll try to do another PR that makes error highlighting work in the next day or two.
TIS-3D's code bible already offers those features, and its code is available under the MIT license, so we could easily take it and tweak it to work with Minecoprocessors. If you don't have any objections to doing that, I can start working on a PR for it.
I noticed that, looks like he did a pretty good job at it too. It is opensource, but if it is used for more than just a reference, I would want to ask the author before merging the code in. A PR would be greatly appreciated! I forgot to include a style guide in this project, here is a link: https://github.com/ToroCraft/PowerProbe/blob/master/intellij-java-style.xml
If you are not using intellij, just try your best to copy the style in the rest of the project, not really that big of a deal.
@josephcsible The syntax highlighting is not critical for the next release, although it would be pretty darn cool. The single page loading needs to be fixed though. If that is something your not working on let me know so I can dive in. I don't want to cause conflicts if you were already working in there.
Re syntax highlighting, I'll try to do it this weekend. Re single pages, I kind of consider that a feature, to make it more convenient for if you want to quickly switch programs, especially since you can use "#BWTM" if you want a program to continue onto the next page.
So it looks like it's going to take some serious re-architecting of the way we do parsing to make error highlighting work. Here's what looks like needs to be done:
- Take care of #48
- Store line numbers while parsing code
- Get rid of compileLine and associated methods, and instead just return the original line from the book (given the line number)
- Make the parser keep track of the line number that it's on, and the position within the line, during the compiling process
- Replace our ParseException with the one from TIS-3D
Once all that's done, we should be able to uncomment the highlighting code and have it work.