Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
* lfedn – edn ↔ lfe #+BEGIN_SRC conf :tangle .gitignore :exports none # -*- conf -*- .rebar3 _* .eunit ,*.o ,*.beam ,*.plt ,*.swp ,*.swo .erlang.cookie ebin log erl_crash.dump .rebar _rel _deps _plugins _tdeps logs _build rebar.lock .DS_Store src/erldn_lexer.erl src/erldn_parser.erl #+END_SRC #+BEGIN_SRC conf :tangle .gitmodules :exports none # -*- conf -*- [submodule "doc"] path = doc url = git@github.com:quasiquoting/lfedn.git branch = gh-pages #+END_SRC #+BEGIN_SRC yaml :tangle .travis.yml :exports none language: erlang # http://stackoverflow.com/a/24600210/1793234 # Handle git submodules yourself git: submodules: false # Use sed to replace the SSH URL with the public URL, then initialize submodules # Apply the replacement to rebar.config as well. before_install: - sed -i 's/git@github.com[:\/]/https:\/\/github.com\//' .gitmodules rebar.config - git submodule update --init --recursive install: true before_script: - wget https://s3.amazonaws.com/rebar3/rebar3 - chmod 755 rebar3 script: - ./rebar3 eunit notifications: recipients: - quasiquoting@gmail.com otp_release: - 18.1 - 18.0 #+END_SRC [[https://travis-ci.org/quasiquoting/lfedn][file:https://travis-ci.org/quasiquoting/lfedn.svg?branch=develop]] =lfedn= is a parser for the [[https://github.com/edn-format/edn][edn specification]], implemented using [[http://www.erlang.org/doc/man/leex.html][leex]] and [[http://www.erlang.org/doc/man/yecc.html][yecc]] and tested with [[http://www.erlang.org/doc/man/eunit.html][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 :PROPERTIES: :tangle: rebar.config :END: #+BEGIN_SRC erlang :exports none {eunit_compile_opts, [{src_dirs, ["src", "test"]}]}. {provider_hooks, [{pre, [{compile, {lfe, compile}}]}]}. #+END_SRC This project assumes you have [[http://www.rebar3.org][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~. - [[https://github.com/rvirding/lfe][LFE]] (Lisp Flavored Erlang; needed only to compile) #+BEGIN_SRC erlang {deps, [{lfe, {git, "git@github.com/rvirding/lfe.git", {tag, "0.10.1"}}}, #+END_SRC - [[https://github.com/lfex/ltest][ltest]] (needed only to run the tests) #+BEGIN_SRC erlang :padline no {ltest, {git, "git@github.com/lfex/ltest.git", {tag, "0.7.0"}}}]}. #+END_SRC ** Installation Just add it to your =rebar.config= [[https://www.rebar3.org/docs/dependencies][deps]]: #+BEGIN_SRC erlang {deps, [% ... {lfedn, {git, "git@github.com:quasiquoting/lfedn.git", {tag, "1.2.0"}}}]}. #+END_SRC ** Build #+BEGIN_SRC sh $ rebar3 compile #+END_SRC ** Test #+BEGIN_SRC sh $ rebar3 eunit -v #+END_SRC ** Examples ☛ [[file:EXAMPLES.org][EXAMPLES.org]] ** API ☛ [[http://quasiquoting.org/lfedn][Documentation]] ** Type Mappings | edn | LFE | |----------------+----------------------------------------------| | boolean | boolean | | char | string | | float | float | | integer | integer | | keyword¹ | atom | | list | list | | map | tagged list ⇒ ~`#(map [#(,key1 ,val1) ...])~ | | ~nil~ (symbol) | ~nil~ (atom) | | set² | tagged list ⇒ ~#(set [...])~ | | string | binary string (utf-8) | | symbol | atom | | tagged literal | tagged tuple ⇒ ~`#(tag ,symbol ,value)~ | | vector | tagged 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: | edn | LFE | |----------------+------------------------------------------------------| | boolean | boolean | | char | string | | float | float | | integer | integer | | keyword | atom | | list | list | | map | [[http://www.erlang.org/doc/man/dict.html][dict]] | | ~nil~ (symbol) | ~nil~ (atom) | | set | [[http://www.erlang.org/doc/man/sets.html][set]] | | string | binary string | | symbol | atom | | tagged literal | call registered handler for tag or fail if not found | | vector | list | ** Authors | Mariano Guerra ([[https://github.com/marianoguerra][@marianoguerra]]) | [[https://github.com/marianoguerra/erldn][erldn]] (Erlang) | | Eric Bailey ([[https://github.com/yurrriq][@yurrriq]]) | [[https://github.com/quasiquoting/lfedn][lfedn]] (LFE) | ** [[file:LICENSE][License]] #+BEGIN_SRC txt :tangle LICENSE 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. #+END_SRC