[ANN] YAML.rb 0.49.1 -- Perfecting the parser, new merge indicator, base60

YAML.rb 0.49.1 now out. [http://yaml4r.sf.net/]

This version includes a few fixes to work better with Windows and
various versions of Ruby. We’re parsing better than ever. And I’ve
even got a few new features for ya.

  • The merge indicator is now ‘<<’. If you’re not familiar with
    this indicator, that’s because it was quietly introduced in
    0.49. A merge will mix mapping elements into another mapping:

    mapping:
    name: Joe
    job: Accountant
    <<:
    age: 38

    The above document comes out as a Ruby Hash:

    { ‘mapping’ =>
    { ‘name’ => ‘Joe’,
    ‘job’ => ‘Accountant’,
    ‘age’ => 38
    }
    }

    As you can see the deeper hash is merged into the hash containing
    the merge key. This is very useful for inheritance:

    • &ACCOUNTANT
      job: Accountant
      hourly_rate: 150

    • name: Joe
      <<: *ACCOUNTANT

    • name: Mike
      <<: *ACCOUNTANT

    You can mixin multiple mappings as well. See
    http://yaml.org/type/merge for the full specification in the
    YAML type repository.

  • Base60 added for time and degrees representation.

    the following are equal:
    - 1:30
    - 90
    these two are equal as well:
    - 190:20:30
    - 685230 # = 190 h 20 m 30 s

    This will show up at http://yaml.org/type/int in a few days.

Nice little features long requested on yaml-core. Enjoy 0.49.1. Please
contact me with your bug reports and assistance. I’d like 0.50 to be a
solid package, which is only possible with your kind help.

_why

I tried to run the test suite against this on the Ruby (1.6.7) that
comes with OS X. It dies with a “stack level too deep” exception.
Without this working, FreeRIDE does not work :frowning: The output looks like:

–BEGIN

[singlemalt:~/Desktop/yamlrb-0.49.1/yts] rich% ./test.sh
— %YAML:1.0
file: YtsAnchorAlias.yml
test: Simple Alias Example
success: (yes)
round-trip: (yes)
time: 0.009627

···

file: YtsAnchorAlias.yml
test: Alias of a Mapping
success: (yes)
round-trip: (yes)
time: 0.008456

file: YtsErrorTests.yml
test: Missing value for hash item
success: (no)
round-trip: (no)
reason: |
No Ruby parse information available in the test document.

file: YtsErrorTests.yml
test: Not indenting enough
success: (no)
round-trip: (no)
reason: |
No Ruby parse information available in the test document.

file: YtsRubyTests.yml
test: Symbols
success: (yes)
round-trip: (yes)
time: 0.027503

file: YtsRubyTests.yml
test: Ranges
success: (yes)
round-trip: (yes)
time: 0.017929

file: YtsRubyTests.yml
test: Regexps
success: (yes)
round-trip: (yes)
time: 0.070336

file: YtsRubyTests.yml
test: Perl Regexps
success: (yes)
round-trip: (yes)
time: 0.005660

file: YtsRubyTests.yml
test: Struct class
success: (yes)
round-trip: (yes)
time: 0.011653
src/emitter.rb:974:in detect_implicit': stack level too deep (SystemStackError) from src/emitter.rb:974:in detect’
from src/emitter.rb:974:in each' from src/emitter.rb:974:in detect’
from src/emitter.rb:974:in detect_implicit' from src/emitter.rb:973:in each’
from src/emitter.rb:973:in detect_implicit' from src/emitter.rb:1617:in to_yaml’
from src/emitter.rb:1605:in call' ... 34 levels... from src/emitter.rb:797:in load_documents’
from yts.rb:47
from yts.rb:41:in `each’
from yts.rb:41

—END

On Monday, January 13, 2003, at 01:50 AM, why the lucky stiff wrote:

YAML.rb 0.49.1 now out. [http://yaml4r.sf.net/]

This version includes a few fixes to work better with Windows and
various versions of Ruby. We’re parsing better than ever. And I’ve
even got a few new features for ya.

  • The merge indicator is now ‘<<’. If you’re not familiar with
    this indicator, that’s because it was quietly introduced in
    0.49. A merge will mix mapping elements into another mapping:

    mapping:
    name: Joe
    job: Accountant
    <<:
    age: 38

    The above document comes out as a Ruby Hash:

    { ‘mapping’ =>
    { ‘name’ => ‘Joe’,
    ‘job’ => ‘Accountant’,
    ‘age’ => 38
    }
    }

    As you can see the deeper hash is merged into the hash containing
    the merge key. This is very useful for inheritance:

    • &ACCOUNTANT
      job: Accountant
      hourly_rate: 150

    • name: Joe
      <<: *ACCOUNTANT

    • name: Mike
      <<: *ACCOUNTANT

    You can mixin multiple mappings as well. See
    Merge Key Language-Independent Type for YAML™ Version 1.1 for the full specification in the
    YAML type repository.

  • Base60 added for time and degrees representation.

    the following are equal:
    - 1:30
    - 90
    these two are equal as well:
    - 190:20:30
    - 685230 # = 190 h 20 m 30 s

    This will show up at Integer Language-Independent Type for YAML Version 1.1 in a few days.

Nice little features long requested on yaml-core. Enjoy 0.49.1.
Please
contact me with your bug reports and assistance. I’d like 0.50 to be a
solid package, which is only possible with your kind help.

_why

Rich:

Have your retried after increasing your stack limit?

limit stacksize 65536

···

On Thursday, 16 January 2003 at 23:26:48 +0900, Richard Kilmer wrote:

I tried to run the test suite against this on the Ruby (1.6.7) that
comes with OS X. It dies with a “stack level too deep” exception.
Without this working, FreeRIDE does not work :frowning: The output looks like:


Jim Freeze

“The climate of Bombay is such that its inhabitants have to live
elsewhere.”

Richard Kilmer said:

I tried to run the test suite against this on the Ruby (1.6.7) that
comes with OS X. It dies with a “stack level too deep” exception.
Without this working, FreeRIDE does not work :frowning: The output looks like:

I’m glad I’m not the only one running in to this problem: have a look at
http://www.ruby-talk.org/59722 for the problem and a possible solution.

Nathaniel

That works wonders.

When you set that limit is it once and for all?

-rich

···

On Thursday, January 16, 2003, at 09:30 AM, Jim Freeze wrote:

On Thursday, 16 January 2003 at 23:26:48 +0900, Richard Kilmer wrote:

I tried to run the test suite against this on the Ruby (1.6.7) that
comes with OS X. It dies with a “stack level too deep” exception.
Without this working, FreeRIDE does not work :frowning: The output looks
like:

Rich:

Have your retried after increasing your stack limit?

limit stacksize 65536


Jim Freeze

“The climate of Bombay is such that its inhabitants have to live
elsewhere.”

Setting it from the terminal only works for that terminal IIRC.
I am looking for a solution that would change it once and for all.
(I suppose you could put it in your .cshrc file for now.)
I’ll let you know when I find out.

···

On Friday, 17 January 2003 at 1:21:02 +0900, Richard Kilmer wrote:

That works wonders.

When you set that limit is it once and for all?


Jim Freeze

If I traveled to the end of the rainbow
As Dame Fortune did intend,
Murphy would be there to tell me
The pot’s at the other end.
– Bert Whitney

This is all I know so far.

You could add to the shell start-up file or to your ruby program

ulimit -s 8192

“The limit man page is effectively in the tcsh man page since it is a
shell built-in command:”

" limit [-h] [resource [maximum-use]]
Limits the consumption by the current process and
each process it creates to not individually exceed
maximum-use on the specified resource. If no max?
imum-use is given, then the current limit is
printed; if no resource is given, then all limita?
tions are given. If the -h flag is given, the
hard limits are used instead of the current lim?
its. The hard limits impose a ceiling on the val?
ues of the current limits. Only the super-user
may raise the hard limits, but a user may lower or
raise the current limits within the legal range.

            Controllable  resources  currently include cputime
            (the maximum number of cpu-seconds to be  used  by
            each  process),  filesize (the largest single file
            which  can  be  created),  datasize  (the  maximum
            growth of the data+stack region via sbrk(2) beyond
            the end of the program text), stacksize (the maxi?
            mum   size  of  the  automatically-extended  stack
            region), coredumpsize (the  size  of  the  largest
            core  dump  that  will be created), and memoryuse,
            the maximum amount of physical  memory  a  process
            may have allocated to it at a given time.

            maximum-use  may  be given as a (floating point or
            integer) number followed by a scale  factor.   For
            all limits other than cputime the default scale is
            `k' or `kilobytes' (1024 bytes); a scale factor of
            `m'  or `megabytes' may also be used.  For cputime
            the default scaling is `seconds',  while  `m'  for
            minutes  or  `h'  for hours, or a time of the form
            `mm:ss' giving minutes and seconds may be used.

            For both resource names and scale  factors,  unam?
            biguous prefixes of the names suffice."
···

On Friday, 17 January 2003 at 5:06:56 +0900, Jim Freeze wrote:

On Friday, 17 January 2003 at 1:21:02 +0900, Richard Kilmer wrote:

That works wonders.

When you set that limit is it once and for all?


Jim Freeze

“I hate it when my foot falls asleep during the day cause that means
it’s going to be up all night.”
– Steven Wright