Jump to content

Photo

ZScript Code Editor


  • Please log in to reply
123 replies to this topic

#16 LinktheMaster

LinktheMaster

    Hey Listen, Kid

  • Members
  • Real Name:Matt
  • Location:United States

Posted 25 July 2012 - 06:10 PM

I'm looking forward to you putting the source up. icon_smile.gif This is really starting to look pretty nice, but it still needs a couple of other features to make it worth switching for me, but I think I could add them myself.

#17 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 27 July 2012 - 06:22 AM

Put up some files which include a new zscript.txt here: http://www.purezc.co...mp;#entry796786

Just rename it from zscript.h if you like, and feel free to change something around which may be awkward to use. (strange observation: the aesthetic value of the word awkward is somewhat ironically it's very definition. ...odd.) Some things may be better suited as static classes instead of namespaces (it that's possible), and lweapon, eweapon are typedef'd. -Should be easier for you to use in any case.

Cheers.

#18 bobby_light

bobby_light

    Experienced Forumer

  • Members

Posted 28 July 2012 - 12:54 AM

Thanks Gleeok, I've grabbed your documentation changes but haven't had a chance to look at them yet. Got a busy weekend unfortunately, but I'll see what I can do.

Updated demo coming hopefully this weekend. In the mean time, you can now grab the source from the following Subversion repository:

http://svn.fifesoft....SyntaxTextArea/

If you're a Java developer, it's super-easy to grab the source and start hacking. This library is built on several others; you'll need to check out the trunk of the following projects, all from the repository above:
  • RSyntaxTextArea - The actual editor component
  • AutoComplete - Code completion add-on for RSyntaxTextArea
  • RSTALanguageSupport - Framework for advanced code completion and parsing of programming languages
  • ZScriptLanguageSupport - ZScript-specific stuff

There are versions of everything but ZScriptLanguageSupport in Maven, but they're a revision or two old. You need to get the bleeding edge from SVN.

Once checked out, to build the demo artifacts you need to run the Ant build scripts for RSyntaxTextArea, AutoComplete, RSTALanguageSupport, and ZScriptLanguageSupport, in that order.

Assuming you checked out into an IDE such as Eclipse, NetBeans, or IntelliJ, you don't have to build the demo to run it; simply run org.fife.rsta.zscript.demo.DemoApp in the ZScriptLanguageSupport project.

All ZScript-specific code is in the ZScriptLanguageSupport project, so that's where the action will be for this component.

The license for all RSTA projects is modified BSD, so you can use it in your own projects. All I ask is that if you add a feature you think is useful for folks in general using the library, that you contribute it so that the library improves for everyone.


#19 LinktheMaster

LinktheMaster

    Hey Listen, Kid

  • Members
  • Real Name:Matt
  • Location:United States

Posted 28 July 2012 - 09:31 AM

Ah, thanks for putting up the SVN information.

I am having some trouble Ant Building, though. I think it's a problem with differing Java versions. What JDK are you using, and what language level are you making the project for?

#20 bobby_light

bobby_light

    Experienced Forumer

  • Members

Posted 29 July 2012 - 10:34 PM

To keep runtime requirements as low as possible, all RSTA projects are built with a 1.4 JDK. If you build with Java 5 or newer (which is exceedingly likely, 1.4 is past its EOSL), you'll need to make one change to org.fife.ui.rsyntaxtextarea.XmlParser.java. In the "Handler" inner class, the resolveEntity() method needs to be modified to throw IOExceptions when built with Java 5 or greater. The RSyntaxTextArea build step will fail if you do not make this change.

I assume this is the problem you're having? If not then let me know. There's also a comment in XmlParser.java, right at where the error occurs, describing the situation, why it occurs, and how to rectify it. I do admit that Java 1.4 is ancient, but there's really nothing in newer JDK's that a text component really needs, and I'm a firm believer in minimizing requirements for libraries. I'm considering bumping up the minimum Java version to 5 sometime in the near future, which would remove the only wrinkle above.

[EDIT]

New version available, same links:

Some minor parser improvements. I realize that although the code completion and syntax checking are what's really important, folks really need more standard features to make the demo more usable to get excited. So I've (finally) added basic Open/Save/Save As functionality. Also new and really cool new feature is "Go to Member" support, activated by Ctrl+Shift+O. This opens a small popup where you can type the name of a script, function, or variable in the current file to jump directly to.This would be useful for very large scripts.

IPB Image

Edited by bobby_light, 29 July 2012 - 10:58 PM.


#21 LinktheMaster

LinktheMaster

    Hey Listen, Kid

  • Members
  • Real Name:Matt
  • Location:United States

Posted 29 July 2012 - 11:01 PM

I think that was the issue, but I'll check it out when I get the chance. icon_smile.gif

#22 bobby_light

bobby_light

    Experienced Forumer

  • Members

Posted 12 August 2012 - 07:29 PM

I've added full Find and Replace functionality - match case, whole word, mark all, and regular expression options included. Grab it from the links in my previous post!

Next Steps:
  • Mini-project support (a la Notepad++)?
  • Use Gleeok's newer documentation
  • Add a Go to Line dialog
  • Parser: Assignment statement validation
  • Parser: if/while conditional validation

I'll also eventually make this into a plugin for RText so that you can use all the whiz-bangy features it includes - syntax highlighting for other languages, external tools, scripted macros, FTP saving/loading, etc.

I'm haggling over a used Macbook Pro at the moment, so hopefully an OS X demo will arrive next week.

Are there any other features folks would like to see?

#23 LinktheMaster

LinktheMaster

    Hey Listen, Kid

  • Members
  • Real Name:Matt
  • Location:United States

Posted 12 August 2012 - 08:19 PM

Unfortunately, I was never able to get [editing the code to] fully to work. I'm probably not using SVN properly since I'm relatively new to it. I could get the first ant build to work (RSyntaxTextArea), but whenever I moved on to the next one, it couldn't find the stuff from RSyntaxTextArea. icon_unsettled.gif I checked out all of the trunks into the src folder via TortoiseSVN, but I also tried combining the src files withing the trunks. So I'm not sure what I'm doing wrong there.

Anyway, since you're asking for suggestions, there are only two things left that I would need to convince me to switch to your program: tabs to open multiple files at once and project support (preferably on the level with Programmer's Notepad, which has "magic folders" that automatically can pull in all files of a particular file extension).

This is looking really good, though. icon_thumbsup.gif

Edit: Whoops. I meant I've been having trouble editing the code for the editor.

#24 LinktheMaster

LinktheMaster

    Hey Listen, Kid

  • Members
  • Real Name:Matt
  • Location:United States

Posted 14 August 2012 - 10:50 AM

D'oh. I'm dumb. I figured out what my issue with getting this to work was. I was stupidly trying to check out everything at once, which was preserving the trunk folders, which got all of your build scripts confused.

I'll play around with this more at home, but it looks like I should be able to work on this and maybe see if I can add some stuff to it. icon_thumbsup.gif I'll have to play around with using a different IDE, though. IntelliJ is... complaining a lot, even though your build scripts are working.

#25 bobby_light

bobby_light

    Experienced Forumer

  • Members

Posted 14 August 2012 - 09:47 PM

Glad you're making progress! I don't use IntelliJ, though everyone I know who uses it is a die-hard fan. Just make sure the projects are all linked appropriately to one another (and I added another one since the post where I described the build procedure icon_smile.gif):
  • RSyntaxTextArea depends on no other projects
  • AutoComplete depends on RSyntaxTextArea
  • RSTAUI depends on RSyntaxTextArea and AutoComplete (this guy is new)
  • RSTALanguageSupport depends on RSyntaxTextArea and AutoComplete
  • ZScriptLanguageSupport depends on RSyntaxTextArea, AutoComplete, RSTAUI, and RSTALanguageSupport
Maybe IDEA can load Eclipse projects and sort out their dependencies, and this isn't your issue, but it's a guess.

ZScriptLanguageSupport now also depends on the two jars in its lib/ subfolder - fife.common.jar and RText.jar. These are only here as compile-time dependencies to build the RText plugin. They aren't used in the demo-specific classes since the demo won't depend on RText (just to keep things smallish, it is a demo after all).

I hope to put up an RText bundle that includes a ZScript plugin soon, so you can have the benefits of a full-blown editor. I thought about adding tabs next to the demo, but then I realized I'd be duplicating what's already done in RText. If longer term, there's a demand for a mini-IDE specific to ZScript and not all the languages RText supports, it can be built from the RText library pieces fairly easily.

Edited by bobby_light, 14 August 2012 - 09:48 PM.


#26 LinktheMaster

LinktheMaster

    Hey Listen, Kid

  • Members
  • Real Name:Matt
  • Location:United States

Posted 15 August 2012 - 07:52 AM

Ah, that got it. icon_smile.gif Importing the Eclipse projects worked. I'm not used to having projects that span other projects. icon_blah.gif Most Java and C++ projects I've had have been one-off stuff that doesn't depend on other things outside of standard libraries.

Anyway, sounds like I'll hold off on doing much. I don't want to spend work converting this into working with tabs if you're just going to make my work obsolete. icon_blah.gif So I'll wait until you're finished, then I'll go from there. icon_smile.gif

#27 bobby_light

bobby_light

    Experienced Forumer

  • Members

Posted 19 August 2012 - 11:06 PM

Yet another update has been made!

It took a lot longer than expected, but I finally got the ZScript language support working as an RText plugin. So now, besides the win32 and web demos, you now have the option of downloading a full-featured programmer's editor, with support for not only ZScript, but ~ 30 other languages as well!

To try out the full editor, simply unzip and run the included "RText.exe". Linux users should be able to launch it via:

CODE

java -jar RText/RText.jar


Feedback is welcome as always!


#28 LinktheMaster

LinktheMaster

    Hey Listen, Kid

  • Members
  • Real Name:Matt
  • Location:United States

Posted 19 August 2012 - 11:48 PM

Awesome! icon_smile.gif This is really looking great.

I have noticed some bugs, though. Mostly I think there are a few things about ZScript that you just didn't quite realize, which is understandable.

1. You don't always have to specify the length of arrays.
While you can specify the length of arrays, you don't have to. This can work in two different ways. One is with a list of numbers, such as int x[] = {1, 6, 7, 9}. The next is with strings. int y[] = "hello world". Your code shows these as errors.

2. Object functions seem to cause errors when in for loops.
You can grab the number of items, guys, weapons, etc. on the screen with the Screen->NumWhatever() methods. Your code seems to see these as errors, stating "missing update expression of for-loop". An example would be "for(int i = 1; i <= Screen->NumLWeapons(); i++)".

3. There are times when the script shows "Variable declaration shadows prior variable" incorrectly.
I'm assuming this error is supposed to signal when a variable has already been declared. However, in my situation, that's not really the case. The variables were used before, but in a different scope. In my situation, I had quite a bit of if statements and loops, so I'm guessing your detection to determine the scope is just slightly off.

Also, there are a couple things I noticed.
  • There's no good way to find out if a closing brace has a partner or not. You do mark its partner with a box, but I'd suggest looking at Notepad++. In it, the braces change colors. Both of them change color. If it doesn't, then you know it doesn't have a partner brace.
  • Sometimes the popup when you hover over an error doesn't seem to want to come up.
If you'd like one of the scripts that are showing these errors, I'd be happy to send it to you for you to get these kinks worked out. Other than that, it really looks nice. icon_smile.gif You've done a great job. icon_thumbsup.gif

#29 King Harkinian

King Harkinian

    This site is still a thing?

  • Members
  • Real Name:THE KING
  • Location:Hyrule

Posted 20 August 2012 - 07:46 AM

Well, I opened up a working, compiling .z file in the editor, and it gave me errors. icon_confused.gif

IPB Image

#30 bobby_light

bobby_light

    Experienced Forumer

  • Members

Posted 20 August 2012 - 08:32 AM

The parser had some pretty major changes recently (not to mention I don't have a lot of good test cases, I usually grab the first few entries in the Scripting Database forum to "test"), so there are most certainly still errors in the parser.

If anyone can send me or link to scripts with erroneous errors (!) identified in them, that will expedite them getting corrected. So LinkTheMaster, I'm taking you up on your offer. icon_smile.gif

King, I'm assuming from one of your errors, that you don't need to add a closing semicolon for while-loops if they're the last statement in a code block? I can verify this by running some test code through ZQuest, but again, sending me examples will be the quickest way of fixing such things.

If the ZQuest parser were made into a separate module, I could call into it from the editor, guaranteeing that these types of things wouldn't happen. But I doubt that will become a reality, so it might take a few iterations to work out all the kinks. I'll probably end up creating a test bed of scripts and drive them through JUnit for regression testing, so the more issues you can send me, the better!

I should be able to hammer out both of your issues in a day or two, and I'll post again when it's ready for more testing. Thanks for looking at this!


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users