Skip to content

Commit

Permalink
Prepare the 1.3.0 release (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
jparise authored Sep 15, 2016
1 parent 1c3e64a commit 441777e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
26 changes: 22 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ In particular, it includes a copy of the Erlang Thrift runtime library.
Start by adding this package to your project as a dependency:

```elixir
{:thrift, "~> 1.2"}
{:thrift, "~> 1.3.0"}
```

Or to track the GitHub master branch:
Expand Down Expand Up @@ -79,15 +79,33 @@ thrift_options: ~w[--gen erl:maps]
## Thrift IDL Parsing

This package also contains experimental support for parsing [Thrift IDL][idl]
files. For the moment, only an Erlang lexer is available, but the goal is to
provide more advanced parser support over time.
files. It is built on a low-level Erlang lexer and parser:

```erlang
:thrift_lexer.string('enum Colors { RED, GREEN, BLUE}')
{:ok, tokens, _} = :thrift_lexer.string('enum Colors { RED, GREEN, BLUE}')
{:ok,
[{:enum, 1}, {:ident, 1, 'Colors'}, {:symbol, 1, '{'}, {:ident, 1, 'RED'},
{:symbol, 1, ','}, {:ident, 1, 'GREEN'}, {:symbol, 1, ','},
{:ident, 1, 'BLUE'}, {:symbol, 1, '}'}], 1}

{:ok, schema} = :thrift_parser.parse(tokens)
{:ok,
%Thrift.Parser.Models.Schema{constants: %{},
enums: %{Colors: %Thrift.Parser.Models.TEnum{name: :Colors,
values: [RED: 1, GREEN: 2, BLUE: 3]}}, exceptions: %{}, includes: [],
namespaces: %{}, services: %{}, structs: %{}, thrift_namespace: nil,
typedefs: %{}, unions: %{}}}
```

But also provides a high-level Elixir parsing interface:

```elixir
Thrift.Parser.parse("enum Colors { RED, GREEN, BLUE}")
%Thrift.Parser.Models.Schema{constants: %{},
enums: %{Colors: %Thrift.Parser.Models.TEnum{name: :Colors,
values: [RED: 1, GREEN: 2, BLUE: 3]}}, exceptions: %{}, includes: [],
namespaces: %{}, services: %{}, structs: %{}, thrift_namespace: nil,
typedefs: %{}, unions: %{}}
```

[semver]: http://semver.org/
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Thrift.Mixfile do
use Mix.Project

@version "1.2.1"
@version "1.3.0"
@project_url "https://github.com/pinterest/elixir-thrift"

def project do
Expand Down

0 comments on commit 441777e

Please sign in to comment.