took a peek in the file - but there are some bizarre goings on in there:
module_eval <<‘.,.,’, ‘src/yaml.y.rb’, 81
def _reduce_27( val, _values, result )
result = new_node( ‘seq’, val[1] )
result
end
…,.,
looks like some heredocs and… what? can anyone explain this syntax - looks
like C preprocessor stuff?
-a
···
–
Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ara.t.howard@noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
~ > ruby -e ‘p(%.\x2d\x29…intern)’
====================================
took a peek in the file - but there are some bizarre goings on in there:
module_eval <<‘.,.,’, ‘src/yaml.y.rb’, 81
You are looking at code generated by Racc. I would upgrade to a newer version
of YAML.rb. YAML.rb previous to 0.60 is being deprecated.
looks like some heredocs and… what? can anyone explain this syntax -
looks like C preprocessor stuff?
Very similiar. These statements alter FILE and LINE. If you look in
the YAML.rb distribution, you’ll find src/yaml.y.rb and src/emitter.rb.
These two files are cobbled into yaml.rb when you install.
took a peek in the file - but there are some bizarre goings on in there:
module_eval <<‘.,.,’, ‘src/yaml.y.rb’, 81
def _reduce_27( val, _values, result )
result = new_node( ‘seq’, val[1] )
result
end
…,.,
looks like some heredocs and… what? can anyone explain this syntax - looks
like C preprocessor stuff?
As it happens, I was just looking at something like that in a
racc-generated parser class. The
‘src/yaml.y.rb’, 81
are extra information about the file and line from which racc generated
this bit of code. It’s used in error reporting.
The ‘.,.,’ is just a creative version of ‘END’, AFAICT. But it looks
like your file has an extra ‘.’ at the beginning of the last line. Did
racc put that there?
As it happens, I was just looking at something like that in a
racc-generated parser class. The
‘src/yaml.y.rb’, 81
are extra information about the file and line from which racc generated
this bit of code. It’s used in error reporting.
i guessed as much.
i didn’t realize you could:
method <<hdoc, arg1, arg2
string
stuff
hdoc
that’s cool.
The ‘.,.,’ is just a creative version of ‘END’, AFAICT. But it looks
like your file has an extra ‘.’ at the beginning of the last line. Did
racc put that there?
no. vim did somehow.
-a
···
On Fri, 13 Jun 2003, Joel VanderWerf wrote:
====================================
Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ara.t.howard@noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
~ > ruby -e ‘p(%.\x2d\x29…intern)’
====================================
You are looking at code generated by Racc. I would upgrade to a newer version
of YAML.rb. YAML.rb previous to 0.60 is being deprecated.
will do. how strongly deprecated - will the file formats be compatible?
Very similiar. These statements alter FILE and LINE. If you look
in the YAML.rb distribution, you’ll find src/yaml.y.rb and src/emitter.rb.
These two files are cobbled into yaml.rb when you install.
neat - didn’t know you could do that. what’s odd though, is that the line
number (210) does not appear in the source?
-a
···
On Fri, 13 Jun 2003, why the lucky stiff wrote:
====================================
Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ara.t.howard@noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
~ > ruby -e ‘p(%.\x2d\x29…intern)’
====================================
It is cool. And you can even do an arbitrary number
of them:
mymeth a, <<doc1, b, <<doc2, c, <<doc3, d
stuff
doc1
more
stuff
doc2
still
more
stuff
doc3
Though eventually it’s a bit much, I guess.
The ‘.,.,’ is just a creative version of ‘END’, AFAICT. But it looks
like your file has an extra ‘.’ at the beginning of the last line. Did
racc put that there?
no. vim did somehow.
As for the .,., – I thought a here-doc marker
had to be an identifier??
Hal
···
----- Original Message -----
From: “ahoward” ahoward@fsl.noaa.gov
Newsgroups: comp.lang.ruby
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Thursday, June 12, 2003 3:24 PM
Subject: Re: src/yaml.y.rb:210: warning: ambiguous first argument; make sure
now, i personally like to know these sorts of things - they do make a language
more interesting and even more fun to write/read. obfusication is not all
bad - maybe the guy who prefers perl is onto something…
-a
···
On Fri, 13 Jun 2003, Hal E. Fulton wrote:
It is cool. And you can even do an arbitrary number
of them:
mymeth a, <<doc1, b, <<doc2, c, <<doc3, d
stuff
doc1
more
stuff
doc2
still
more
stuff
doc3
Though eventually it’s a bit much, I guess.
–
Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ara.t.howard@noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
~ > ruby -e ‘p(%.\x2d\x29…intern)’
====================================
now, i personally like to know these sorts of things - they do make a
language
more interesting and even more fun to write/read. obfusication is not all
bad - maybe the guy who prefers perl is onto something…
Funny you mention obfuscation – I once tried
to do some sneaky stuff where depending on a flag
or something, a here-doc was treated either as a
here-doc or as code. Now that’s obfuscation of a
sort!
But I never got it to work. I think the Ruby parser
was too smart for that, and this was an occasion
where there was some distinction between “compile
time” and “runtime.”
Hal
···
----- Original Message -----
From: “ahoward” ahoward@fsl.noaa.gov
Newsgroups: comp.lang.ruby
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Thursday, June 12, 2003 6:26 PM
Subject: Re: src/yaml.y.rb:210: warning: ambiguous first argument; make sure