Author Topic: "THEN" being identified as a keyword in text string array and other oddities  (Read 2869 times)

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4159
  • On the shoulders of giants.
    • View Profile
    • My Apps
While working on my new game (you know the one Gernot ;)), I discovered that certain pieces of text cause syntax errors when being used in an array string. This happens in V7.XX and v8.XX

EG

Code: (glbasic) [Select]
DIM help$[200]

help$[1]=“Well then, let’s explain the game, shall we?"
help$[2]="From here, let’s remember through practice”
help$[3]="through"

"then" gets changed into THEN and won't run = syntax error

Comment out the first line of text [1] and the second line [2] won't run = syntax error. However remove the word "practice" and it runs fine. However still, if you use "practice" in another indivudual array string on its own, it works fine.
But, even though "through" was accepted in the "through practice" line [2], if you put "through" in it's own array line [3], it brings up a syntax error.

Weird!!

Good luck sorting this out Gernot!
I came. I saw. I played.

MrTAToad

  • Guest
The odd thing about "practise" is if you delete it, and then put it back in, all is fine  :blink:

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4159
  • On the shoulders of giants.
    • View Profile
    • My Apps
Yeah, the whole thing is really odd. They're not reserved words as far as I can tell. It's totally bonkers.
I came. I saw. I played.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10814
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
the quotes used are not all " characters!!!!

« Last Edit: 2010-Jul-26 by Kitty Hello »

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4159
  • On the shoulders of giants.
    • View Profile
    • My Apps
I can perhaps understand "THEN", but "practice" and "through" causing errors? And the odd behaviour that they are accepted at certain times. Who knows what other word combinations aren't accepted?

Admittedly in the above case I can (perhaps) use alternatives, but at some point someone will want these words within a text array.

Another point to note is that I can use IF, FROM, TO and AND in the same text (as I do) and they are fine. It's only THEN that turns back into a keyword.
I came. I saw. I played.

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1791
    • View Profile
    • Homepage
Works fine for me if I type it in myself. If I copy your text I get funny characters in two of the lines. Retype the lines and they will work fine.

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4159
  • On the shoulders of giants.
    • View Profile
    • My Apps
Ah yes - in daylight I can see that the quote char (") wasn't the usual one and the whole text isn't coloured as a text string. I didn't notice this last night. Any idea how this occured originally then Gernot?
« Last Edit: 2010-Jul-26 by Ian Price »
I came. I saw. I played.

MrTAToad

  • Guest
Did you use the correct quotes when posting ?

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4159
  • On the shoulders of giants.
    • View Profile
    • My Apps
I just copied the code from GLB. I didn't even know the quotemarks were different until this morning. I've no idea why they are/were different.  With the standard IDE colour scheme the string text on my laptop doesn't look very different from non-string text. And the quotemark char wasn't too obviously different either. Tired eyes didn't help. But it wasn't really obvious.
« Last Edit: 2010-Jul-26 by Ian Price »
I came. I saw. I played.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10814
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
I have no idea. Did you copy/paste from another editor?
I've fixed the Paste command to repleace these 2 quotes into regular ones now.
Must I fix the typing functions, too?  mean - I don't even know how to type these 2.

MrTAToad

  • Guest
Code: (glbasic) [Select]
DIM help$[200]

help$[1]="Well THEN, let’s explain the game, shall we?"
help$[2]="From here, let’s remember through practice"
help$[3]="through"

That posted okay :)

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4159
  • On the shoulders of giants.
    • View Profile
    • My Apps
I wouldn't worry about it now tbh - we're all aware of the problem, so if it rears it's head again we'll know how to sort it.

:)
I came. I saw. I played.