~/eg/ruby/btpgsql/btpgsql-0.2.0 > ruby test/btpgsql.rb
test/btpgsql.rb:1191: ERROR: parser: parse error at or near “#!/” (PGError)
from test/btpgsql.rb:1186:in `each'
from test/btpgsql.rb:1186
from
1 #!/usr/bin/env ruby
…
1184 sql.gsub!(%r{–.*$}, ‘’) # kill comments
1185 sql.gsub!(%r{\n}, ’ ')
1186 sql.split(%r{;}).each do |statement|
1187 begin
1188 res = pgconn.exec(statement)
1189 res.clear
1190 rescue PGError => pgerror
1191 raise(pgerror) unless (pgerror.inspect() =~ %r{does not exist}i)
1192 end
1193 end
…
if i comment out line 1191 the error goes away?
i’m running
ruby 1.8.0 (2003-03-03) [i686-linux]
on
Linux 2.2.14-5.0 i686
Red Hat Linux release 6.2 (Zoot)
-a
···
–
Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ahoward@fsl.noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
====================================
has the precedence of ‘<<’ changed or something? i don’t understand why this
should confuse the parser?
why the insistence the parens immeadiately follow method names? i like the C
style of
method (args);
much more than
method(args);
especially when doing something like
method0 (method1 (method2 (arg)))
which is less straining than
method0(method1(method2(arg)))
IMHO.
-a
···
On Wed, 9 Apr 2003, Yukihiro Matsumoto wrote:
Hi,
In message “1.8 parse error?” > on 03/04/09, ahoward ahoward@fsl.noaa.gov writes:
i’m getting :
~/eg/ruby/btpgsql/btpgsql-0.2.0 > ruby test/btpgsql.rb
test/btpgsql.rb:1191: ERROR: parser: parse error at or near “#!/” (PGError)
from test/btpgsql.rb:1186:in `each'
from test/btpgsql.rb:1186
Since it’s PGError, not SyntaxError, the error must be in your SQL
statement.
–
Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ahoward@fsl.noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
====================================
has the precedence of ‘<<’ changed or something? i don’t
understand why this should confuse the parser?
why the insistence the parens immeadiately follow method names? i
like the C
style of
method (args);
much more than
method(args);
I know we’re delving into holy ground here, but what makes you think
whitespace after a function call and before the left paren is a
c’ism?
The style guides I can come up with generally favor NO whitespace
after the function name when making a call. The earliest
(chronologically) style guide I remember (and can find) is the Henry
Spencer Indian Hill one
(http://www.chris-lott.org/resources/cstyle/indhill-annot.html), and
while it doesn’t explicitly say one way or the other, has in its
examples the mathematical (i.e. f(x)) style shown.
Later versions of the Indian Hill guide do show a mixture of
mathematical style and not in various examples but never say one way
or the other that I can find. Ellemtel (granted, C++ here) says
explicitly to “Always write the left parenthesis directly after a
function name” (though this is I think implied for the declaration,
not the call.)
I only ask because I’ve only come to see this stylistic convention
(in languages that require parens for function/method/message calls)
recently; like in the last 8-9 years. Prior to that it was almost
exclusively the mathematical style.
···
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
Ruby 1.8 is much “smarter” in treating argument parentheses.
Or dumber this case.
···
----- Original Message -----
From: “Yukihiro Matsumoto” matz@ruby-lang.org
I also preferred it the way it was. Seemed like it used to work without
thinking about it. Now I’m always adding parethases if there are multiple
calls on one line (with no preceding spaces), but it looks too “squashed” to
me. I’ve been bitten by it many times. Not a big deal… just a little
annoying.
Seems like it’s always dumber these days… but maybe I just need to see an
example of it being smarter… anyone?
I know we’re delving into holy ground here, but what makes you think
whitespace after a function call and before the left paren is a c’ism?
gnu coding standards.
~ > cat foo.c
strlen(“foobar”);
~ > cat foo.c | indent
strlen (“foobar”);
~ > man indent
…
DESCRIPTION
…
In version 1.2 and more recent versions, the GNU style of
indenting is the default.
…
i love indent, defaults, gnu, and standards.
-a
···
On Wed, 9 Apr 2003, Michael Campbell wrote:
The style guides I can come up with generally favor NO whitespace
after the function name when making a call. The earliest
(chronologically) style guide I remember (and can find) is the Henry
Spencer Indian Hill one
(http://www.chris-lott.org/resources/cstyle/indhill-annot.html), and
while it doesn’t explicitly say one way or the other, has in its
examples the mathematical (i.e. f(x)) style shown.
Later versions of the Indian Hill guide do show a mixture of
mathematical style and not in various examples but never say one way
or the other that I can find. Ellemtel (granted, C++ here) says
explicitly to “Always write the left parenthesis directly after a
function name” (though this is I think implied for the declaration,
not the call.)
I only ask because I’ve only come to see this stylistic convention
(in languages that require parens for function/method/message calls)
recently; like in the last 8-9 years. Prior to that it was almost
exclusively the mathematical style.
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com
–
Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ahoward@fsl.noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
====================================