User modify syntax option

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
sNoOOPy
New User
New User
Posts: 4
Joined: Thu Jun 23, 2011 1:13 pm

User modify syntax option

Post 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
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: User modify syntax option

Post 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.
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
User avatar
STARGÅTE
Addict
Addict
Posts: 2227
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: User modify syntax option

Post 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
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: User modify syntax option

Post by Shield »

Note that "As" already is a PB keyword with another meaning.
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: User modify syntax option

Post 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.
Post Reply