Giter Club home page Giter Club logo

yaml's People

Contributors

adolfopa avatar esilkensen avatar samth avatar vu3rdd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

yaml's Issues

Question: Yaml Events or use of `yaml/events`

Quick question.

I'm interested in customizing the data-structures produced by the parser. For example, I want to create an ordered mapping object instead of using #hash() structures or perhaps use immutable hashes.

Would you suggest I use the yaml/events module? If so, I could try that out and maybe document it.

Thanks for your work.

yaml library pukes on []

The following yaml causes an error.

check: []

I get when loading this yaml:

make-constructor: broke its own contract
  promised: (or/c yaml? void?)
  produced: '#hash(("checks" . ()))
  in: the range of
      the range of
      (->*
       ()
       (input-port?)
       (values
        (-> boolean?)
        (-> (or/c yaml? void?))
        (-> (or/c yaml? #f))))
  contract from: 
      <pkgs>/yaml/yaml/constructor.rkt
  blaming: <pkgs>/yaml/yaml/constructor.rkt
   (assuming the contract is correct)
  at: <pkgs>/yaml/yaml/constructor.rkt:21.3

Writing a yaml file with unicode characters cannot be read back

Yaml document contains scalars with unicode characters are written using escaped characters. Such files cannot be read back.

Steps to reproduce:
Test file: test.yaml.txt

> (file->yaml "test.yaml")
'#hash(("key" . "Å üñíçòðę vǎlûe"))
> (yaml->string (file->yaml "test.yaml"))
"{key: \"\\xC5 \\xFC\\xF1\\xED\\xE7\\xF2\\xF0\\u119 v\\u1CEl\\xFBe\"}\n"
> (string->yaml (yaml->string (file->yaml "test.yaml")))
; string:0:38: while scanning a double-quoted scalar;
;  expected escape sequence, but found
; [,bt for context]

Problem can be solved with the attached patch:
allow-unicode.patch.txt

> (file->yaml "test.yaml")
'#hash(("key" . "Å üñíçòðę vǎlûe"))
> (yaml->string (file->yaml "test.yaml") #:allow-unicode? #t)
"{key: Å üñíçòðę vǎlûe}\n"
> (string->yaml (yaml->string (file->yaml "test.yaml") #:allow-unicode? #t))
'#hash(("key" . "Å üñíçòðę vǎlûe"))

Test yaml-struct and scoping

What happens when there are multiple yaml-struct definitions with the same name (and what if they are in different scopes, modules, etc.)?

write-yaml breaks make-representer contract on #:style

-> (write-yaml '(1 2 3) #:style 'flow)
; make-representer: contract violation
;   expected: (or/c (quote block) (quote flow) (quote best) #f)
;   given: #t
;   in: the #:style argument of
;       (->*
;        ((-> node? void?))
;        (#:scalar-style
;         (or/c #\" #\' #\| #\> 'plain #f)
;         #:style
;         (or/c 'block 'flow 'best #f))
;        (-> yaml? void?))

Incorrect timezone handling in construct-yaml-timestamp

The following YAML input is not constructed correctly:

canonical: 2001-12-15T02:59:43.1Z
iso8601: 2001-12-14t21:59:43.10-05:00
spaced: 2001-12-14 21:59:43.10 -5
date: 2002-12-14

The "iso8601" and "spaced" dates return the wrong hour value.

lose the dependency on coveralls?

I see that yaml requires cover-coveralls, and it looks to me like this is used only in the travis script. This is a bit of a bummer if I want to include yaml in another project... is the coverage testing a significant component of the CI testing?

Hmm... well, I suppose you could argue either way.

Use Racket classes or structs

Refactor scanner.rkt, parser.rkt, etc. to use Racket classes or structs instead of closures / constructors that return values.

bug in error message

Evaulate this program

#lang racket
(require yaml)
(string->yaml ": {fall: [], winter: [], spring: []}")

see this error:

format: format string requires 0 arguments, given 1; arguments were: "expected , but found" "':'"

It certainly looks like the part of the code that's supposed to signal this error message has a bad format string.

make-serializer broke its own contract

Entering the examples from the documentation breaks the make-serializer contract:

> (write-yaml
     '(#hash(("name" . "Mark McGwire")
             ("hr" . 65)
             ("avg" . 0.278))
       #hash(("name" . "Sammy Sosa")
             ("hr" . 63)
             ("avg" . 0.288))))

; make-serializer: broke its own contract;
;  expected 1 value, returned 3 values
;   in: the range of
;       (->*
;        ()
;        (output-port?
;         #:allow-unicode
;         boolean?
;         #:canonical
;         boolean?
;         #:explicit-end
;         boolean?
;         #:explicit-start
;         boolean?
;         #:indent
;         (or/c exact-positive-integer? #f)
;         #:line-break
;         (or/c "\n" "\r" "\r\n" #f)
;         #:tags
;         (or/c (hash/c string? string?) #f)
;         #:version
;         (or/c
;          (cons/c exact-integer? exact-integer?)
;          #f)
;         #:width
;         (or/c exact-positive-integer? #f))
;        (-> node? void?))
;   contract from:
;       /Users/Erik/Documents/Code/yaml/yaml/serializer.rkt
;   blaming: /Users/Erik/Documents/Code/yaml/yaml/serializer.rkt
;    (assuming the contract is correct)
;   at: /Users/Erik/Documents/Code/yaml/yaml/serializer.rkt:15.3

yaml containing \t yields unhelpful error message

Code containing tab characters generate error messages containing tabs, which can be difficult to decipher:

#lang racket

(require yaml)

(string->yaml "name: Oracle
\tid: oracle
description: Oracle.
" )

This results in the error:

string:1:0: while scanning for the next token;
 found character     that cannot start any token

... which is a bit of a challenge to read.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.