Dot interpreted as literal string even when unquoted. Topic is solved

Report problems with documented functionality
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Dot interpreted as literal string even when unquoted.

03 Jul 2017, 05:45

Example,

Code: Select all

Msgbox, % .
See
lexikos wrote:v2.0-a081-cad307c detects these errors.
Indeed, thanks :thumbup:
Last edited by Helgef on 16 Jul 2017, 11:43, edited 1 time in total.
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Dot interpreted as literal string even when unquoted.

03 Jul 2017, 07:35

Code: Select all

MsgBox % .          ; -> .
MsgBox % .123e+1    ; -> .123e+1
MsgBox % .test      ; -> .test
Msgbox % .@#µ$3Z    ; -> .@#µ$3Z
Not sure.. maybe it is somewhere here -> https://github.com/Lexikos/AutoHotkey_L ... .cpp#L5597
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Dot interpreted as literal string even when unquoted.

03 Jul 2017, 22:08

I'm not at all concerned that syntax errors are being interpreted as floating point literals.

Floating point literals in v1 are not converted to binary numbers until you use them (at runtime).
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Dot interpreted as literal string even when unquoted.

04 Jul 2017, 03:14

Thank you both for your responses.
@jNizM, interesting observations.
@lexikos, imo, it would be a nice feature if syntax errors caused an error or showed a warning instead of being interpreted as floating point literals. I wish it showed something like

Code: Select all

Error:  Ambiguous or invalid use of "."
Cheers.
Spoiler
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Dot interpreted as literal string even when unquoted.

04 Jul 2017, 03:51

I have no plan to improve syntax validation in v1.

It will be detected in v2.

Note .test is, of course, valid when following a value (any kind of value), as in someObject .test (space is allowed before the dot). .@#µ$3Z raises an error in that context because of @, # and $.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Dot interpreted as literal string even when unquoted.

04 Jul 2017, 03:55

It will be detected in v2.
From my point of view, this topic is solved.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Dot interpreted as literal string even when unquoted.

04 Jul 2017, 08:50

Is . viewed as a floating point literal (i.e. 0.0) by the syntax checker, but seen as the string . (i.e. ".") when the script runs?

Code: Select all

q::
vNum := .
if vNum is float
	MsgBox, % "y"
else
	MsgBox, % "n" ;n

vNum := .0
if vNum is float
	MsgBox, % "y" ;y
else
	MsgBox, % "n"

vNum := 0.
if vNum is float
	MsgBox, % "y" ;y
else
	MsgBox, % "n"

MsgBox, % (0 + .) ;blank
MsgBox, % (0 + .0) ;0.000000
MsgBox, % (0 + 0.) ;0.000000
MsgBox, % (0 + .1) ;0.100000
MsgBox, % (0 + 1.) ;1.000000
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Dot interpreted as literal string even when unquoted.

04 Jul 2017, 22:19

Floating point literals in v1 are not converted to binary numbers until you use them (at runtime) **as numbers**, hence .123e+1 showing as is in jNizM's example. They are all just generic string values.

Return to “Bug Reports”

Who is online

Users browsing this forum: ZhuangQu and 16 guests