Page 1 of 1

User modify syntax option

Posted: Thu Jun 23, 2011 2:09 pm
by sNoOOPy
Basic is easier and more pleasant to read than c or java etc as it doesn't have so many semicolons and braces etc. It also uses words in place of characters like !,$,->,@.

Could there be added a way to for the user to customize the syntax?

For example: Global $var as STRING
instead of: Global var.s

if i > 1 then
instead of: if i > 1

Re: User modify syntax option

Posted: Thu Jun 23, 2011 2:14 pm
by Shield
This is PureBasic, not Visual Basic. :wink:
You'll have to live with it.

You could however write macros to do small changes in syntax but that
isn't necessary at all in my opinion.

Re: User modify syntax option

Posted: Thu Jun 23, 2011 2:18 pm
by STARGĂ…TE
use macros:

Code: Select all

Macro As :.: EndMacro
Macro STRING :s: EndMacro
Macro Then :::EndMacro


Global var As STRING
var = "Test"

If var = "Test" Then
  Debug 1
EndIf

Re: User modify syntax option

Posted: Thu Jun 23, 2011 2:39 pm
by Shield
Note that "As" already is a PB keyword with another meaning.

Re: User modify syntax option

Posted: Thu Jun 23, 2011 6:04 pm
by Tenaja
Sounds like you are trying to convert code from VB or PowerBasic (or some other basic)... Search & Replace are handy for this! The IDE has a great feature to avoid searching in strings, so it's super fast to delete all of the "Then" keywords. For the Var As String, use Notepad++ with Regular Expressions...once you get the expression figured out, it's an instant change. For short code, it may be faster to do it manually if you aren't a RegEx expert.