JabacoTokenMaker support

General Discussion on RSyntaxTextArea.

Moderator: robert

JabacoTokenMaker support

Postby theuserbl » Sun Mar 28, 2010 2:52 pm

Hi!

Because there is currently no support for VisualBasic 6 or VisualBasic 2008, I have created at currently an JabacoTokenMaker. Jabaco is Windows-native-compiler and -IDE, which creates code for the JavaVM. The syntax is more like VB6 then VB2008 is.
So, I have tried to implement a rudimentary Jabaco-syntax implementation.

You can try it out at
http://www.file-upload.net/download-2386321/JabacoTokenMakerDemo.jar.html
(Its an executable jar file. The sourcecode of all is included in the jar, too)


The changes are

1. added org/fife/ui/rsyntaxtextarea/modes/JabacoTokenMaker.java
It is still buggy and looks more like WindowsBatchTokenMaker, but it is my initial version of it.
I am not a developer. So please be indulgent with me.

I have written it in Java instead of JFlex, because JFlex is not only a lexer, it is additional an obfuscator. The generated Java-files are no longer easy to read.
So, as much as I like RSyntaxTextArea, as much I dislike JFlex.
I have little experience with JavaCC. *.java files creates by JavaCC are looking similar to the Source-files from which they are created. And the JavaCC sources (*.jj) looking not much different to JFlex Sources (.flex).

Happily with UnixShellTokenMaker.java and WindowsBatchTokenMaker.java you have created two example files, how to write TokenMaker direct in Java.

Additional modified
org/fife/ui/rsyntaxtextarea/DefaultToken.java
org/fife/ui/rsyntaxtextarea/SyntaxConstants.java
to register JabacoTokenMaker for RSyntaxTextArea. And
org/fife/ui/rsyntaxtextarea/RSyntaxTextArea.java
the description, that Jabaco is supported.


2. added TextModifier.java
It included

a) support for to change keywords.
Jabaco is not case-sensitive. So "else", "ELSE", "Else" and "elSE" are all the same for the compiler.
But it is easier to write, to write all in lower-case:
Code: Select all
  dim withevents a as new b()

and it is easier to read, if some letters are upper-case:
Code: Select all
  Dim WithEvents a As New b()

so with TextModifier the TextEditor doing it.
That is like VB6 and Jabaco doing it.

b) support for after comma space.
If after a comma comes no space or tabulator, the Editor creates a space.
For example, it is easier to write
Code: Select all
  Call myfunction (17.47,147.789,147.147,778.987,"a String")

but it is easier to read, if there stand
Code: Select all
  Call myfunction (17.47, 147.789, 147.147, 778.987, "a String")

with TextModifier again the Editor doing it.
That is something, what QBasic have done before.

QBasic have changed a lot the text.
For example a
Code: Select all
  a=(14+3)*2/25*(((-3+4)*(9+14))*94)-145.14*14

was changed to
Code: Select all
  a = (14 + 3) * 2 / 25 * (((-3 + 4) * (9 + 14)) * 94) - 145.14 * 14

But that needs a lot more code to implement, so I haven't done it.
For example a "-" can be a minus or a sign.

Warning: TextModifier is not optimized. For very lange text, it needs so much time, that it is unusable.

Info at the end: I have all compiled with J2SDK 1.4.2_19, because all can be compiled with so old versions.
And so people with older Java-versions can run it, too.
theuserbl
 
Posts: 15
Joined: Sun Mar 28, 2010 2:37 pm

Re: JabacoTokenMaker support

Postby robert » Sun Mar 28, 2010 11:50 pm

Awesome, thank you!

I'll certainly take a look at what you've made, and I'll be in contact with any questions, etc.
User avatar
robert
 
Posts: 801
Joined: Sat May 10, 2008 5:16 pm


Return to Open Discussion

Who is online

Users browsing this forum: No registered users and 3 guests

cron