POV-Ray : Newsgroups : povray.beta-test : strange concatenation rules Server Time
12 Nov 2024 20:02:31 EST (-0500)
  strange concatenation rules (Message 1 to 8 of 8)  
From:
Subject: strange concatenation rules
Date: 24 Sep 2001 05:21:17
Message: <h9utqt0r7aer5md5md2ge3kpu39131k51e@4ax.com>
POV3.5b4 on NT4 PII233 128MB

Please parse below and look at the output where it stops and what is
the output. I didn't found anything within 6.1.7.1 and 6.1.7.3 what
could explain this 

//-----
  #declare String=concat("1","2","3")
  #warning String

  #declare String=concat("1" "2" "3")
  #warning String

  #declare String=concat("1" "2","3")
  #warning String

  #declare String=concat("1""2""3")
  #warning String

  #declare String=concat("1" "2")
  #warning String
//-----

to compare result here is my output

  File: C:\tests\test.pov  Line: 4
  Warning: 123
  File: C:\tests\test.pov  Line: 7
  Warning: 13
  File: C:\tests\test.pov  Line: 10
  Warning: 13
  File: C:\tests\test.pov  Line: 13
  Warning: 13

  File: C:\tests\test.pov  Line: 15

  #declare String=concat("1" "2") <----ERROR

  Parse Error: Expected 'string expression', ) found instead

ABX


Post a reply to this message

From: Bob H 
Subject: Re: strange concatenation rules
Date: 24 Sep 2001 09:39:21
Message: <3baf3789@news.povray.org>

news:h9utqt0r7aer5md5md2ge3kpu39131k51e@4ax.com...
>
> Please parse below and look at the output where it stops and what is
> the output. I didn't found anything within 6.1.7.1 and 6.1.7.3 what
> could explain this

I don't see a problem, you just need to use comma separation.  concat() is
obviously ignoring the quotes when without commas which turns the "2" into
nothing seen.  So that error of the last example is seeing just a 1 with
nothing to concatenate onto it.

Looking at the Scene Help I don't see an example without commas.

Bob H.


Post a reply to this message

From:
Subject: Re: strange concatenation rules
Date: 24 Sep 2001 10:06:30
Message: <rvduqtkorh4jdp1a548pf7ruqaqg4t4mtm@4ax.com>
On Mon, 24 Sep 2001 08:39:18 -0500, "Bob H." <omn### [at] msncom>
wrote:
> "W?odzimierz ABX Skiba" <abx### [at] babilonorg> wrote in message
> news:h9utqt0r7aer5md5md2ge3kpu39131k51e@4ax.com...
> >
> > Please parse below and look at the output where it stops and what is
> > the output. I didn't found anything within 6.1.7.1 and 6.1.7.3 what
> > could explain this
>
> I don't see a problem, you just need to use comma separation.

but I see the problem

I found this playing with Parse_String macro

I just generated macro with it this way for example

Parse_String(concat(
  "#macro Name(Params)",
    :   // here are lines with content of macro
    :
  "#end"
))

and sometimes I forgot to add comma after lines of string
and it was parsed ok during concatenation but during Parse_String it
behave  unexpected
I found that it lost some lines

I don't think there must be possibility to not use comma
I just think there should be at least warning that comma required

> concat() is
> obviously ignoring the quotes when without commas which turns the "2" into
> nothing seen.  So that error of the last example is seeing just a 1 with
> nothing to concatenate onto it.

I don't say about last line but about all without first !!!
Question is: why it wasn't reported during parse ? Second string
(without comma) is always invisible. Third is visible.

> Looking at the Scene Help I don't see an example without commas.

Perhaps I missed something but have you seen example without commas
for sphere{x 1} or triangle{x y z} ?


ABX


Post a reply to this message

From: Bob H 
Subject: Re: strange concatenation rules
Date: 24 Sep 2001 13:11:01
Message: <3baf6925@news.povray.org>

news:rvduqtkorh4jdp1a548pf7ruqaqg4t4mtm@4ax.com...
> On Mon, 24 Sep 2001 08:39:18 -0500, "Bob H." <omn### [at] msncom>
> wrote:
> >
> > I don't see a problem, you just need to use comma separation.
>
> but I see the problem
>
> I found this playing with Parse_String macro
>
> I just generated macro with it this way for example
>
> Parse_String(concat(
>   "#macro Name(Params)",
>     :   // here are lines with content of macro
>     :
>   "#end"
> ))
>
> and sometimes I forgot to add comma after lines of string
> and it was parsed ok during concatenation but during Parse_String it
> behave  unexpected
> I found that it lost some lines
>
> I don't think there must be possibility to not use comma
> I just think there should be at least warning that comma required

Yes, I agree.

> > concat() is
> > obviously ignoring the quotes when without commas which turns the "2"
into
> > nothing seen.  So that error of the last example is seeing just a 1 with
> > nothing to concatenate onto it.
>
> I don't say about last line but about all without first !!!
> Question is: why it wasn't reported during parse ? Second string
> (without comma) is always invisible. Third is visible.

I knew that :-) I only pointed out the last example because it kind of
explained the others.

> > Looking at the Scene Help I don't see an example without commas.
>
> Perhaps I missed something but have you seen example without commas
> for sphere{x 1} or triangle{x y z} ?

But those are not strings.  You're dealing with quotes, and a pair of double
quotes must be confusing the parser since it can't decide where the end will
be unless it's the last one seen around a group of characters.

If you wanted a string like """"" you'd do "\"\"\"\"\""

I certainly see your point about the warning being needed for paired quotes.
Seems to me this was a topic I remember from long ago.  If you had a empty
string, for whatever reason, then how would POV know to warn or not?  Except
to warn about any and all such instances...
Hmm, well, maybe like have POV see the first quote and check for closing
quote for only paired off ones.  That way it would move on to the next pair.

Bob H.


Post a reply to this message

From: Ron Parker
Subject: Re: strange concatenation rules
Date: 24 Sep 2001 14:36:34
Message: <slrn9quv9k.p48.ron.parker@fwi.com>

>Please parse below and look at the output where it stops and what is
>the output. I didn't found anything within 6.1.7.1 and 6.1.7.3 what
>could explain this 

This was a bug in the parser.  It'll be fixed in a future beta.

-- 
#macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)merge{R(z+a z)R(-z a-z)R(a
-z-z-z a+z)torus{1F clipped_by{plane{a 0}}}translate V}#end#macro Z(a F T)merge{
P(z+a)P(z-a)R(-z-z-x a)pigment{rgbf 1}hollow interior{media{emission 3-T}}}#end 
Z(-x-x.2x)camera{location z*-10rotate x*90normal{bumps.02scale.05}}


Post a reply to this message

From: Ron Parker
Subject: Re: strange concatenation rules
Date: 24 Sep 2001 14:42:08
Message: <slrn9quvk2.p48.ron.parker@fwi.com>
On Mon, 24 Sep 2001 08:39:18 -0500, Bob H. wrote:

>news:h9utqt0r7aer5md5md2ge3kpu39131k51e@4ax.com...
>>
>> Please parse below and look at the output where it stops and what is
>> the output. I didn't found anything within 6.1.7.1 and 6.1.7.3 what
>> could explain this
>
>I don't see a problem, you just need to use comma separation.  concat() is
>obviously ignoring the quotes when without commas which turns the "2" into
>nothing seen.  So that error of the last example is seeing just a 1 with
>nothing to concatenate onto it.
>
>Looking at the Scene Help I don't see an example without commas.

Commas are supposed to be optional just about everywhere, including here.
Also, it works if you type 'concat("1")' which doesn't make sense if you 
go by the reasoning you've proposed.

What was happening was much more complicated, but essentially POV was throwing
away every second token inside the parentheses, but with some additional 
caveats that made it unable to parse the example with two parameters.  This
will be fixed in an upcoming beta. (and, more importantly, it is NOT a 
documentation bug, so no need to say anything about commas being required.)

-- 
plane{-z,-3normal{crackle scale.2#local a=5;#while(a)warp{repeat x flip x}rotate
z*60#local a=a-1;#end translate-9*x}pigment{rgb 1}}light_source{-9red 1rotate 60
*z}light_source{-9rgb y rotate-z*60}light_source{9-z*18rgb z}text{ttf"arial.ttf"
"RP".01,0translate-<.6,.4,.02>pigment{bozo}}light_source{-z*3rgb-.2}//Ron Parker


Post a reply to this message

From: Bob H 
Subject: Re: strange concatenation rules
Date: 24 Sep 2001 15:15:52
Message: <3baf8668@news.povray.org>
"Ron Parker" <ron### [at] povrayorg> wrote in message
news:slr### [at] fwicom...
> On Mon, 24 Sep 2001 08:39:18 -0500, Bob H. wrote:
> >
> >I don't see a problem, you just need to use comma separation.  concat()
is
> >obviously ignoring the quotes when without commas which turns the "2"
into
> >nothing seen.  So that error of the last example is seeing just a 1 with
> >nothing to concatenate onto it.
> >
> >Looking at the Scene Help I don't see an example without commas.
>
> Commas are supposed to be optional just about everywhere, including here.
> Also, it works if you type 'concat("1")' which doesn't make sense if you
> go by the reasoning you've proposed.

Thanks for the dose of wisdom.  I figured concat had to glue at least two
strings together, had never questioned whether it did or not.  Likewise
about commas, I'm a comma user.

Bob H.

> What was happening was much more complicated, but essentially POV was
throwing
> away every second token inside the parentheses, but with some additional
> caveats that made it unable to parse the example with two parameters.
This
> will be fixed in an upcoming beta. (and, more importantly, it is NOT a
> documentation bug, so no need to say anything about commas being
required.)


Post a reply to this message

From:
Subject: Re: strange concatenation rules
Date: 25 Sep 2001 03:27:58
Message: <iac0rtg5p18cg45vcnjbt7viv25orth5rp@4ax.com>
On 24 Sep 2001 14:42:08 -0400, ron### [at] povrayorg (Ron Parker)
wrote:

> Commas are supposed to be optional just about everywhere, including here.
> Also, it works if you type 'concat("1")' which doesn't make sense if you 
> go by the reasoning you've proposed.

[..]

>(and, more importantly, it is NOT a 
>documentation bug, so no need to say anything about commas being required.)

but first sentence causes documentation or parser bug
becouse there is sentence "Must have at least 2 parameters but may
have more" about concat within 6.1.7.3

ABX


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.