Nov 23 2007

as3yaml – A YAML 1.1 parser and emitter for ActionScript 3

Tag: AS3, ActionScript, as3yaml, yamlDerek Wischusen @ 7:13 pm

I am pleased to announce the first release of as3yaml, an ActionScript 3 library for parsing and emitting YAML. It is a direct port of Ola Bini’s jvyaml, which was itself a port of Kirill Simonov’s PyYAML.

For those of you who are unfamiliar with YAML, here is a concise description from the yaml.org welcome page:

YAML(tm) (rhymes with “camel”) is a straightforward machine parsable data serialization format designed for human readability and interaction with scripting languages such as Perl and Python. YAML is optimized for data serialization, configuration settings, log files, Internet messaging and filtering. YAML(tm) is a balance of the following design goals:

  • YAML documents are very readable by humans.
  • YAML interacts well with scripting languages.
  • YAML uses host languages’ native data structures.
  • YAML has a consistent information model.
  • YAML enables stream-based processing.
  • YAML is expressive and extensible.
  • YAML is easy to implement.

Here are some example of YAML taken from the current version of the YAML spec:

american:
  - Boston Red Sox
  - Detroit Tigers
  - New York Yankees     

national:
  - New York Mets
  - Chicago Cubs
  - Atlanta Braves     

-
  name: Mark McGwire
  hr:   65
  avg:  0.278     

-
  name: Sammy Sosa
  hr:   63
  avg:  0.288

Here is an example of decoding a YAML string and converting it to ActionScript objects:

With the following YAML stored in a file called myYaml.yaml

  ---
  Date: 2001-11-23 15:03:17 -5
  User: ed
  Fatal:
    Unknown variable "bar"
  Stack:
    - file: TopClass.py
      line: 23
      code: |
        x = MoreObject("345\n")
    - file: MoreClass.py
      line: 58
      code: |-
        foo = bar

You can load then load the YAML and decode it as follows.

   public function loadYaml() : void 
   { 
       var loader : URLLoader =  new URLLoader(); 
       loader.load(new URLRequest('myYaml.yaml')); 
       loader.addEventListener(Event.COMPLETE, onYamlLoad); 
   } 
  public function onYamlLoad(event : Event) : void 
  { 
       var yamlMap : HashMap = YAML.decode(event.target.data) as HashMap; // returns a HashMap 
       trace(yamlMap.get("Date"));  // returns a Date object and prints: Fri Nov 23 15:03:17 GMT-0500 2001 
       trace(yamlMap.get("User"));  // returns a String and prints: ed 
       trace(yamlMap.get("Fatal")); // returns a String and prints: Unknown variable "bar" 
       trace(yamlMap.get("Stack")); // returns an Array and prints: [object HashMap],[object HashMap] 
       trace(yamlMap.get("Stack")[0].get("line"));  // returns an Int and prints: 23 
       trace(yamlMap.get("Stack")[0].get("code"));  // returns a String and prints: x = MoreObject("345\n")     
 
  }

There are some more examples available in the as3yaml docs.

I have been working on this for a little while now, and running it through various tests, so I think it is at a point where it is ready to be released into the wild. Please submit any bugs that you find to the issues list on the google project site. If you have any interest in contributing to the project, please let me know.

 THANKS:

  • Of course, special thanks to Ola Bini and Kirill Simonov for their excellent work on jvyaml and PyYaml, respectively.
  • I would also like to thank the as3commons project.  This library made the port from Java quite a bit easier than it might have been. 

Generic viagra in the us
Viagra online without prescription overnight
Buy viagra without prescription
Viagra prices
Propecia dosages
Cialis price canada
Buy cheap tramadol online without prescription
Brand cialis 100mg
Where to buy propecia in australia
Where to buy xanax without prescription
About phentermine 37.5
Prescription cialis online
Buy viagra online australia
Generic phentermine 37.5 without prescription
Phentermine in the uk
Order cialis from canada
50 mg viagra online
Where to buy xanax bars
Phentermine 37.5 pills
Best price phentermine
Online xanax pharmacy
Viagra dosage information
Canadian pharmacy for cialis
Brand valium
Viagra online sales
Cheap online tramadol
Where to buy phentermine 37.5 without prescription
Overnight viagra
Order generic viagra
Viagra usa online
Buy brand name cialis
Generic cialis professional
Viagra for sale
Discount levitra
Viagra discount coupons
Cialis uk online
Cheap propecia canada
Get viagra without a prescription
Get viagra in canada
Valium for sale uk
Cialis overnight shipping
Viagra sale uk
Order xanax online without prescription
Viagra discounts
2mg xanax
Cialis to buy
Prednisone dosages
Tramadol no prescription next day
Cialis soft tablets
Buy propecia without a prescription
100mg tramadol buy
Propecia cheapest price
Buy levitra online without prescription
Online prescriptions xanax
Generic viagra in india
Generic cialis from canada
37.5mg phentermine
Generic cialis no prescription
Order levitra online
Buy real viagra online without prescription
Buy viagra in las vegas
Cod tramadol overnight
Buy generic phentermine
Buying valium uk
Generic viagra canadian pharmacy
Tramadol online cheap
Propecia prices uk
Buy valium roche online
Cheap levitra pills
Viagra in canada without prescription
Buy cheap viagra pills
Viagra online without prescription free shipping
Viagra in the philippines
Tramadol rx online
5mg valium
Order xanax without prescription
Buy phentermine direct pharmacy cheap
Viagra without prescription
Generic cialis online canada
Valium pill
Discount xanax
Viagra prescriptions
Cheap cialis prices
Propecia buy canada
Cialis without prescription overnight
Best prices for viagra
Levitra prices canada
Cialis 10mg tablets
Generic viagra online pharmacy
10 mg valium effects
Online prescription for xanax
Generic viagra sales
Free viagra samples online
Dosage of prednisone
Buy viagra online cheap
Cialis cost
Cialis 20mg effects
Cheap propecia uk
Best way to take tramadol
Buy tramadol without a prescription
Buy viagra uk without prescription
Tramadol generic
Prescription xanax
Tramadol dosage
Prednisone side effects
Viagra online cheap
Phentermine rx
Phentermine 37.5 lowest price
Cheap 100mg viagra
Cheapest online tramadol
Cheap xanax no prescription
Buy xanax with prescription
Valium for sale in uk
Free samples of viagra
Phentermine 37.5 diet pills
Viagra prescription cost
40 mg prednisone side effects
Buying phentermine online
Where can i buy viagra without prescription
Phentermine without a prescription
20 mg valium
Buy prednisone dose pack
Where can i buy phentermine online without a prescription
Buy viagra without a prescription
Buy tramadol hcl
Best viagra online
Cialis buy uk
Order phentermine without a prescription
Where to buy phentermine 37.5 without a prescription
Where can i buy generic viagra
Viagra buy cheap
Propecia online without prescription
Cialis 10mg price
Buying generic viagra
Phentermine online canada
Discount phentermine 37.5 without prescription
Cheap levitra uk
Buy phentermine adipex
Buy xanax online without a prescription
Canada pharmacy viagra
Phentermine hcl 37.5 no prescription
Buying cialis without a prescription
Where to buy prednisone without a prescription
Phentermine no prescription
Buy phentermine diet pills online
Phentermine 37.5 tablets
Cialis online canada
Buying generic cialis online
Discount generic viagra
Valium for sale in the uk
Cialis professional generic
Price of phentermine
50mg cialis
Cheap tramadol overnight delivery
Brand levitra
Buy cheap viagra
Buy cheapest viagra online
Levitra lowest price
Canada pharmacy phentermine
Brand name viagra online without prescription
Get tramadol online
Buying cheap viagra
Price of viagra tablets in india
Cialis 20mg tablets
Viagra express shipping
Canada generic viagra
Buy cialis online cheap
Ordering phentermine online
Cialis online pharmacy canada
Tramadol price
Order viagra overnight
Buy cialis brand
Buy cheap generic viagra online
Where can i buy viagra cheap
Levitra canadian pharmacy
Canadian viagra prices
Buy roche valium uk
Drug valium
Cheap online xanax
Brand cialis without prescription
Cialis online overnight
Xanax with no prescription
Cialis uk supplier
Order viagra online no prescription
Buy viagra london
Viagra 100mg effects
Generic tramadol no prescription
Buying phentermine without a prescription
Buy tramadol hydrochloride
Viagra in usa
Tramadol 200mg
Buy valium no prescription
Generic cialis information
Viagra pfizer price
Generic viagra professional
Get viagra prescription online
Female viagra uk
Phentermine 37.5 results
Buy female viagra without prescription
Tramadol no prescription overnight
Valium online fast delivery
Buy cialis canada
Cialis information
Viagra soft tablets
Overnight viagra delivery
Cheap phentermine 37.5 without prescription
Viagra cost in canada
50 mg viagra
Valium 20mg
Viagra without rx
10mg valium
Buy viagra uk
Cheap generic viagra
Online prescription phentermine
Phentermine 37.5 online prescription
Generic levitra 20mg
Tramadol online no prescription
Buy viagra without prescription online
Valium online order
Where to buy propecia in canada
Canada viagra prescription
Generic viagra for sale
Cheapest phentermine
Prescription phentermine 37.5 mg
Phentermine 37.5 capsules
Generic viagra uk
Cialis for sale online
Viagra discount prices
Cialis prescription canada
Cialis medicine
Prednisone 10 mg
Best viagra dose
Phentermine 37.5mg diet pills
Where to buy levitra
Buy viagra in canada online
Cheap generic xanax
Cheap cialis generic
Generic viagra cheap
Buy viagra online safely
Propecia online prescription
Phentermine online pharmacy
Valium online no prescription
Buy cialis generic
Genuine pfizer viagra
Buy prednisone
Valium uk delivery
Buy cheap tramadol without prescription
Xanax drug dosage
Discount propecia
Cheap cialis viagra