"error(parsing): the keyword [:] is needed" message despite code appearing to be fine

45 views
Skip to first unread message

d4v3y_5c0n3s

unread,
Mar 21, 2020, 9:07:58 PM3/21/20
to ats-lang-users
So, I've been encountering this "keyword [:] is needed" error, and I can't figure out what the issue is.  I've been compiling my code in with a Makefile, and I know that there are many issues the compiler would pick up on because much of the code is incomplete.  Here are the first errors which are showing up for me:
"/home/d4v3y/ATS2-Postiats-0.4.0"/bin/patscc -cleanaft --depgen --taggen --debug2 -I"/home/d4v3y/ATS2-Postiats-0.4.0" -I"/home/d4v3y/ATS2-Postiats-0.4.0"/ccomp/runtime -L"/home/d4v3y/ATS2-Postiats-0.4.0"/ccomp/atslib/lib -latslib -lSDL2 -lSDL2_mixer -lSDL2_net -shared -g -lGL  -D_GNU_SOURCE -o obj/g_ui_sats.o -c source/g_ui.sats
/home/d4v3y/Goldelish-Engine/source/g_engine.sats: 6667(line=171, offs=43) -- 6711(line=172, offs=42): error(parsing): the keyword [:] is needed.
/home/d4v3y/Goldelish-Engine/source/g_engine.sats: 6662(line=171, offs=38) -- 6665(line=171, offs=41): error(parsing): the token is discarded.
/home/d4v3y/Goldelish-Engine/source/g_engine.sats: 6716(line=172, offs=47) -- 6761(line=174, offs=43): error(parsing): the keyword [:] is needed.
/home/d4v3y/Goldelish-Engine/source/g_engine.sats: 6711(line=172, offs=42) -- 6714(line=172, offs=45): error(parsing): the token is discarded.
/home/d4v3y/Goldelish-Engine/source/g_engine.sats: 6766(line=174, offs=48) -- 6832(line=175, offs=65): error(parsing): the keyword [:] is needed.
/home/d4v3y/Goldelish-Engine/source/g_engine.sats: 6761(line=174, offs=43) -- 6764(line=174, offs=46): error(parsing): the token is discarded.
/home/d4v3y/Goldelish-Engine/source/g_engine.sats: 6837(line=175, offs=70) -- 6909(line=176, offs=71): error(parsing): the keyword [:] is needed.
/home/d4v3y/Goldelish-Engine/source/g_engine.sats: 6832(line=175, offs=65) -- 6835(line=175, offs=68): error(parsing): the token is discarded.
/home/d4v3y/Goldelish-Engine/source/g_engine.sats: 6914(line=176, offs=76) -- 6985(line=177, offs=70): error(parsing): the keyword [:] is needed.
/home/d4v3y/Goldelish-Engine/source/g_engine.sats: 6909(line=176, offs=71) -- 6912(line=176, offs=74): error(parsing): the token is discarded.
/home/d4v3y/Goldelish-Engine/source/g_engine.sats: 6990(line=177, offs=75) -- 7110(line=182, offs=57): error(parsing): the keyword [:] is needed.
/home/d4v3y/Goldelish-Engine/source/g_engine.sats: 6985(line=177, offs=70) -- 6988(line=177, offs=73): error(parsing): the token is discarded.
And here is my code:
fn vec2_hash {} ( v: vec2 ) : int = "sta#%"
fn vec2_mix_hash {} ( v: vec2 ) : int = "sta#%"

fn vec2_saturate {} ( v: vec2 ) : vec2 = "sta#%"
fn vec2_lerp {} ( v1: vec2, v2: vec2, amount: float ) : vec2 = "sta#%"
fn vec2_smoothstep {} ( v1: vec2, v2: vec2, amount: float ) : vec2 = "sta#%"
fn vec2_smootherstep {} ( v1: vec2, v2: vec2, amount: vec2 ) : vec2 "sta#%"
I know that this kind of error message means that somewhere I need to insert some colons, but I don't know why the compiler seems to be telling me to place colons in the incorrect spots.  Am I missing something obvious?  Could it be that because my code is incomplete, there are too many errors and thus the compiler makes them appear in the wrong part of the codebase?  Any help is appreciated.  Full source code for my project is on github (https://github.com/d4v3y5c0n3s/Goldelish-Engine) if you'd like to see further details.

Richard

unread,
Mar 21, 2020, 9:14:23 PM3/21/20
to ats-lang-users
Hi,

Missing equals sign here?

d4v3y_5c0n3s

unread,
Mar 21, 2020, 9:24:23 PM3/21/20
to ats-lang-users
Nice catch.  I guess I've just been looking at the same code for too long.  Unfortunately, fixing it doesn't resolve the problem.  I'll update my code on Github with that fix, and get back to it tomorrow.  By the way, thanks for the swift response! :D

Richard

unread,
Mar 21, 2020, 10:33:12 PM3/21/20
to ats-lang-users

Looks like the issue is from a few lines before 171, unterminated string, here:

fn vec2_to_array {} ( v: vec2, out: ptr ) : void = "sta#%

d4v3y_5c0n3s

unread,
Mar 22, 2020, 1:04:21 PM3/22/20
to ats-lang-users
I think that was the issue.  Thanks for the help! :)
Reply all
Reply to author
Forward
0 new messages