Skip to content

quasiquoting/lfedn

 
 

Repository files navigation

lfedn – edn ↔ lfe

https://travis-ci.org/quasiquoting/lfedn.svg?branch=develop

lfedn is a parser for the edn specification, implemented using leex and yecc and tested with eunit.

This is a low-level parser from edn to LFE data structures. You have to decide on how, specifically, to represent them, since each user may have a different need. There is no imposition here.

Dependencies

This project assumes you have rebar3 installed somwhere in your $PATH.

This project depends upon the follow, which are installed to the _build/default/lib directory of this project when you run rebar3 compile.

  • LFE (Lisp Flavored Erlang; needed only to compile)
    {deps,
     [{lfe,
       {git, "git@github.com/rvirding/lfe.git",
        {tag, "0.10.1"}}},
        
  • ltest (needed only to run the tests)
    {ltest,
     {git, "git@github.com/lfex/ltest.git",
      {tag, "0.7.0"}}}]}.
        

Installation

Just add it to your rebar.config deps:

{deps,
 [% ...
  {lfedn,
   {git, "git@github.com:quasiquoting/lfedn.git",
    {tag, "1.2.0"}}}]}.

Build

$ rebar3 compile

Test

$ rebar3 eunit -v

Examples

EXAMPLES.org

API

Documentation

Type Mappings

ednLFE
booleanboolean
charstring
floatfloat
integerinteger
keyword¹atom
listlist
maptagged list ⇒ `#(map [#(,key1 ,val1) ...])
nil (symbol)nil (atom)
set²tagged list ⇒ #(set [...])
stringbinary string (utf-8)
symbolatom
tagged literaltagged tuple ⇒ `#(tag ,symbol ,value)
vectortagged list ⇒ #(vector [...])

¹: Although keyword ↦ atom, :nil#(keyword nil).

²: Uniqueness is not checked at parse time.

To LFE Mappings

The to-lfe function transforms incoming data structures to be more LFE-friendly, but the results can’t be converted back to string without transforming again. The default mappings are:

ednLFE
booleanboolean
charstring
floatfloat
integerinteger
keywordatom
listlist
mapdict
nil (symbol)nil (atom)
setset
stringbinary string
symbolatom
tagged literalcall registered handler for tag or fail if not found
vectorlist

Authors

Mariano Guerra (@marianoguerra)erldn (Erlang)
Eric Bailey (@yurrriq)lfedn (LFE)
The MIT License (MIT)

Copyright (c) 2013 Mariano Guerra
Copyright (c) 2015 Eric Bailey

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Releases

No releases published

Packages

No packages published

Languages

  • Erlang 100.0%