Author Topic: [SOLVED] Squirrel Build Script Syntax Error: expected 'IDENTIFIER'  (Read 4495 times)

Offline The_GTA

  • Multiple posting newcomer
  • *
  • Posts: 21
  • Developer & Entrepreneur
    • EirDev
Dear CB community, I have compiled the most recent Code::Blocks nightly revision 12655 on Ubuntu 20.04 using wxWidgets 3.1.5, GTK 3. When I try to run any of my Code::Blocks Squirrel build scripts I receive the following error:



Quote
Invalid build script: script
First seen in: project
Error:
  expected 'IDENTIFIER'

Content of the script:
Code
function SetBuildOptions(base)
{

}

What do I have to do to fix it? Please help me!
« Last Edit: January 18, 2022, 11:53:46 am by The_GTA »

Offline jordi

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: Squirrel Build Script Syntax Error: expected 'IDENTIFIER'
« Reply #1 on: January 17, 2022, 10:16:11 pm »
Hi,
It seems an issue related to Character Encoding.
Could you open the file and save it as UTF-8?
I think that Squirell is compiled without Unicode support.
Regards

Offline The_GTA

  • Multiple posting newcomer
  • *
  • Posts: 21
  • Developer & Entrepreneur
    • EirDev
Re: Squirrel Build Script Syntax Error: expected 'IDENTIFIER'
« Reply #2 on: January 17, 2022, 10:42:57 pm »
Hi,
It seems an issue related to Character Encoding.
Could you open the file and save it as UTF-8?
I think that Squirell is compiled without Unicode support.
Regards
Glad to hear from you, jordi!

I have tried switching to UTF-8 encoding but the same error has appeared. If you have managed to create a working version of the Squirrel build script yourself, could you please share it with me? I am really confused by this.

A different error did show if I switched to UTF-8 with BOM, though. Then it did complain about "expression expected" instead. I have never tried this encoding before and previously all my scripts were stored as Code Page Property (SciTE).

Last time I tried to compile using Squirrel build scripts was in revision 12312 and it worked back then. Since then a lot of changes have been made, including to the Squirrel source and build files... Could this issue be related to the changes?
« Last Edit: January 17, 2022, 10:48:42 pm by The_GTA »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Squirrel Build Script Syntax Error: expected 'IDENTIFIER'
« Reply #3 on: January 18, 2022, 01:08:30 am »
base is a keyword in squirrel, so you have to use an other parameter variable name

Offline The_GTA

  • Multiple posting newcomer
  • *
  • Posts: 21
  • Developer & Entrepreneur
    • EirDev
Re: Squirrel Build Script Syntax Error: expected 'IDENTIFIER'
« Reply #4 on: January 18, 2022, 02:51:26 am »
base is a keyword in squirrel, so you have to use an other parameter variable name
I have followed the example on this Code::Blocks documentation page:

https://wiki.codeblocks.org/index.php/Build_scripts

If the example is faulty then could you please get somebody to fix it?

EDIT: I have confirmed that renaming the variable to "cbase" has fixed the syntax error. Thank you very much for the hint, BlueHazzard! 👍👍👍
« Last Edit: January 18, 2022, 03:07:42 am by The_GTA »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Squirrel Build Script Syntax Error: expected 'IDENTIFIER'
« Reply #5 on: January 18, 2022, 08:34:28 am »
Done, thank you for reporting this!

Offline jordi

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: [SOLVED] Squirrel Build Script Syntax Error: expected 'IDENTIFIER'
« Reply #6 on: January 18, 2022, 09:51:24 pm »
I am sorry. I don't have any squirrel build script .  Maybe can help you to see the RegisterBinding funcion in scriptingbindings.cpp file.  There are defined all the bindings to: codeblocks code, wxWidgets types, constants, etc
I can try to help you whether you have any doubt. I want to review how squirrel virtual machine works and how bindings are done.

To reproduce the issue I have had to change "base" by "function" as parameter in my system: Debian GNU/Linux 11  (info below):
Then, "base" was not a keyword.  I'll review it

Name             : Code::Blocks
Version          : 20.03-r11997
SDK Version      : 2.0.0
Scintilla Version: 3.7.5
Author           : The Code::Blocks Team
E-mail           : info@codeblocks.org
Website          : http://www.codeblocks.org

wxWidgets Library (wxGTK port)
Version 3.0.5 (Unicode: wchar_t, debug level: 1),
Runtime version of toolkit used is 3.24.
Compile-time GTK+ version is 3.24.20.

Offline The_GTA

  • Multiple posting newcomer
  • *
  • Posts: 21
  • Developer & Entrepreneur
    • EirDev
Re: [SOLVED] Squirrel Build Script Syntax Error: expected 'IDENTIFIER'
« Reply #7 on: January 18, 2022, 11:15:21 pm »
I am sorry. (...)

Name             : Code::Blocks
Version          : 20.03-r11997
(...)
Don't worry about it. The issue has been solved. You seem to be using an old version of Code::Blocks which does not have the "base" keyword in Squirrel yet.

I find it interesting that you want to investigate the Squirrel VM. To me the CB Squirrel build script system is a great means to fully configure my program building pipeline. It is a novel feature which no other IDE build system has, in that form. Other build systems rely on the terribly antiquated makefile concept which I dislike for it's unhealthy gimmicks (no spaces in paths possible, stuff has to be written in rules, etc). In stark contrast for the Squirrel case, you have got the full freedom of a scripting language which feels really nice. I give the Visual Studio .vcxproj makefile system some slack because it is XML based thus has a really stable format.