Page 1 of 2

Auto Syntax Check

Posted: Wed May 29, 2019 4:03 pm
by RSBasic
Hello :)

I have developed a tool for PureBasic and SpiderBasic.
In Visual Studio and other development environments you know the automatic syntax check well, which is very useful, so you don't have to press the F5 key to see if syntax errors exist.
This program checks saved and unsaved source code for syntax errors in real time.
For technical reasons, only one error can be detected at a time.

Another important piece of information about how the current source code is determined depending on the type.
There are 5 types of PB file:
  • PB file not created: Current unsaved source code is checked for syntax errors.
  • Created PB file without project: Current saved or unsaved source code is checked for syntax errors.
  • Created include file of a created main PB file without project if the compiler setting "Main source code" is set: Saved source code of the main PB file is checked for syntax errors. This is the same with the manual syntax check via the "Compiler" menu.
  • Project information page: Saved input source code of the default target is checked for syntax errors. This is the same with the manual syntax check via the "Compiler" menu.
  • PB file of a project: Saved input source code of the standard target is checked for syntax errors. This is the same with the manual syntax check via the "Compiler" menu.
Screenshot:
Image

Installation:
Image

Requirements:
The setting "Show full source path in title bar" must be enabled because I have no other way to find the path to the PB file.

Download: https://www.rsbasic.de/downloads/downlo ... _Check.zip
Image

I would be very pleased about feedbacks, improvement suggestions, error messages or wishes. Thanks :)

Re: Auto Syntax Check

Posted: Wed May 29, 2019 4:16 pm
by forumuser
Interesting :mrgreen:

- It doesn't quit when you close PB (v5.71 beta 1 LTS x64)
- We can't copy what it finds via right click - Copy Log but I guess that can't be changed

Code: Select all

[<time>] Auto Syntax Check has detected an error.
[<time>] Line 23 - File not found (C:\Users\<username>\AppData\Local\Temp\PDF-Ersteller - D:\Users\<username>\Development\PureBasic\PDF-Ersteller\#includes\constants.pbi).
This folder does NOT even exist:

Code: Select all

C:\Users\<username>\AppData\Local\Temp\PDF-Ersteller
The line it doesn't like is:

Code: Select all

XIncludeFile "#includes\constants.pbi"    : UseModule Consts
I'm using a portable PB version (if that makes any differences)...

Re: Auto Syntax Check

Posted: Wed May 29, 2019 7:01 pm
by RSBasic
forumuser wrote:It doesn't quit when you close PB (v5.71 beta 1 LTS x64)
The WinAPI function OpenProcess_() is unreliable. I am now using CreateToolhelp32Snapshot_() to determine if PB is still running.
This works much better. Version comes later.
forumuser wrote:We can't copy what it finds via right click - Copy Log but I guess that can't be changed
The copy function of PB always copies the last status text and not what is currently in the ListViewGadget. :cry:
forumuser wrote:The line it doesn't like is:

Code: Select all

XIncludeFile "#includes\constants.pbi"    : UseModule Consts
Do you have an example code for me to reproduce the error?

Re: Auto Syntax Check

Posted: Wed May 29, 2019 9:57 pm
by BarryG
How does this differ from "Compiler -> Syntax check" in the IDE?

Re: Auto Syntax Check

Posted: Wed May 29, 2019 9:59 pm
by RSBasic
@BarryG
The difference and the advantage is that you don't always have to manually press a key or key combination or mouse click to check the syntax.
You know it very well in Visual Studio, for example. It also displays sytax errors in real time without you having to compile the project to test it. For example, if you have forgotten to define a variable, you will see it immediately in the status window and you can react immediately and define the variable before starting your own program.
So it's just an automation of this check function.

@forumuser
I found the error. Version comes later.

Re: Auto Syntax Check

Posted: Wed May 29, 2019 10:06 pm
by BarryG
Doesn't seem to work here at all, and the IDE complains about PureSplitter not detected? I'll test properly later and report back.

Re: Auto Syntax Check

Posted: Wed May 29, 2019 10:07 pm
by RSBasic
Can you post the PB version later? Thank you

Re: Auto Syntax Check

Posted: Wed May 29, 2019 10:09 pm
by BarryG
5.70 LTS (x86). I'm using the x86 version of the tool and installed it per your screenshot. I really have to head off to work now, sorry. I will post screenshots later tonight.

Re: Auto Syntax Check

Posted: Thu May 30, 2019 9:33 am
by RSBasic
Auto Syntax Check 1.0.1 has been released.

Changelog:
  • Added: Support of project files
  • Bugfix: Tool was not closed automatically when PB/SB is no longer running.
Another important piece of information about how the current source code is determined depending on the type.
There are 5 types of PB file:
Noch eine wichtige Information, wie der jeweilige aktuelle Quellcode je nach Art ermittelt wird.
Es gibt 5 Arten einer PB-Datei:
  • PB file not created: Current unsaved source code is checked for syntax errors.
  • Created PB file without project: Current saved or unsaved source code is checked for syntax errors.
  • Created include file of a created main PB file without project if the compiler setting "Main source code" is set: Saved source code of the main PB file is checked for syntax errors. This is the same with the manual syntax check via the "Compiler" menu.
  • Project information page: Saved input source code of the default target is checked for syntax errors. This is the same with the manual syntax check via the "Compiler" menu.
  • PB file of a project: Saved input source code of the standard target is checked for syntax errors. This is the same with the manual syntax check via the "Compiler" menu.
@forumuser
Fixed

Re: Auto Syntax Check

Posted: Thu May 30, 2019 10:01 am
by forumuser
@RSBasic

Sorry, hadn't had the time to post some reduced source code (yet), so: thanks for fixing it without!

Next problem:
Constant not found: #PB_Editor_OriginalFilename

I'm working with version info in the compiler options for the current project to automatically
increase file version on a new build, etc. and you're probably missing these internal
constants...

Offending line:

Code: Select all

Own\File = #PB_Editor_OriginalFilename
This is the list of all these constant from the help file:
#PB_Editor_FileVersionNumeric
#PB_Editor_ProductVersionNumeric
#PB_Editor_CompanyName
#PB_Editor_ProductName
#PB_Editor_ProductVersion
#PB_Editor_FileVersion
#PB_Editor_FileDescription
#PB_Editor_InternalName
#PB_Editor_OriginalFilename
#PB_Editor_LegalCopyright
#PB_Editor_LegalTrademarks
#PB_Editor_PrivateBuild
#PB_Editor_SpecialBuild
#PB_Editor_Email
#PB_Editor_Website

Re: Auto Syntax Check

Posted: Thu May 30, 2019 10:02 am
by BarryG
Hi RSBasic, I tried 1.0.1 on a clean PureBasic and it works, but when I put my prefs file back it complains about PureSplitter again. I don't know what that is, but obviously ASC (Auto Syntax Check) is finding something from my prefs about it.

I also noticed that ASC doesn't report syntax errors for "Debug" lines, like this:

Code: Select all

Debug (22/7
Debug (22/7))))))
The IDE syntax checks finds errors for these, so I assume ASC should too?

Re: Auto Syntax Check

Posted: Fri May 31, 2019 12:27 am
by Zebuddi123
Hi RSBasic I`m trying ASC. Undocumented feature. Your auto clear alog is automatically wiping any info my programs write to the ide log. by the way another of your tools I have adopted Thanks for sharing.


Zebuddi. :)

Re: Auto Syntax Check

Posted: Fri May 31, 2019 8:24 am
by RSBasic
forumuser wrote:Next problem:
Constant not found: #PB_Editor_OriginalFilename
Is in next version fixed.
BarryG wrote:Hi RSBasic, I tried 1.0.1 on a clean PureBasic and it works, but when I put my prefs file back it complains about PureSplitter again.
Can you send me your prefs file or post here?
BarryG wrote:

Code: Select all

Debug (22/7
Debug (22/7))))))
The IDE syntax checks finds errors for these, so I assume ASC should too?
If I click in the menu on Compiler > Syntax check, then I don't get an error message from PB either:
PureBasic Syntax Check wrote:[09:11:35] [COMPILER] Syntax check finished (2 lines)
With "Compiler > Syntax check" also no error. It is "Debug" which is filtered out by "/CHECK".
With this code works:

Code: Select all

Define aaa = (22/7
Define bbb = (22/7))))))
An error is displayed here.
Zebuddi123 wrote:Hi RSBasic I`m trying ASC. Undocumented feature. Your auto clear alog is automatically wiping any info my programs write to the ide log. by the way another of your tools I have adopted Thanks for sharing.
I'll check it.

Re: Auto Syntax Check

Posted: Fri May 31, 2019 9:10 am
by BarryG

Code: Select all

Debug (22/7
Debug (22/7))))))
RSBasic wrote:If I click in the menu on Compiler > Syntax check, then I don't get an error message from PB either:
PureBasic Syntax Check wrote:[09:11:35] [COMPILER] Syntax check finished (2 lines)
I get this error with a clean install of PureBasic and I select "Compiler -> Syntax check":

Image
RSBasic wrote:Can you send me your prefs file or post here?
I worked it out: if the following setting is enabled, then the "PureSplitter" error occurs when the IDE starts:

Code: Select all

Preferences -> ToolsPanel -> Options -> Automatically hide the panel
I have this enabled, and ASC doesn't like it.

Re: Auto Syntax Check

Posted: Fri May 31, 2019 8:14 pm
by RSBasic
Auto Syntax Check 1.0.2 has been released.

Changelog:
  • Added: All #PB_Editor_ constants are now supported.
  • Added: The tool is now compatible with the "Automatically hide the panel" setting.
  • Changed: If the code has been compiled and started and is then terminated or an error occurs, then it is no longer checked for errors immediately afterwards, but only at the next change. Note: This only works if there is more than one second between compilation and program termination.
Important information: Since project files must be saved so that these project files can be checked for syntax errors, this tool is only suitable for non-projects.
Non-project files can also be checked for syntax errors in realtime without saving.