Comments (3)
@pickatag just to avoid any confusion, can you also post the code that failed? I assume the code above is the one working. Thank you!
from nimble_parsec.
Yes, of course, sorry. This code fails in compilation. (I removed dependency to ex_Cldr as well)
defmodule MyParser do
@moduledoc false
@debug false
import NimbleParsec
white_space =
ignore(ascii_string([9, 32], min: 1))
language_code =
ascii_string([?a..?z], 2) |>
traverse(:check_language_code) |>
tag(:language)
territory_code =
ascii_string([?A..?Z], 2) |>
tag(:territory)
locale =
choice([language_code, territory_code]) |>
ignore(string(":"))
locale_text =
optional(locale) |>
optional(white_space) |>
utf8_string([], min: 1)
defparsec :locale_text, locale_text, debug: @debug
defp check_language_code(_rest, [language_code], context, _line, _offset) do
{language_code |> String.to_atom |> List.wrap, context}
end
end
from nimble_parsec.
Thanks for the example! It has been fixed and 0.3.2 has been released!
from nimble_parsec.
Related Issues (20)
- Can't use remote combinators defined with defparsec HOT 7
- Library Abuse or Slow Compilation Times HOT 1
- `repeat_while` passing the wrong `context` in nested context
- Warning emitted by integer combinator HOT 3
- Add a default value to `optional` combinator HOT 2
- "Combinators are built during runtime" HOT 1
- When choice after repeat, not work HOT 2
- Fail to create combinator of consecutive repeats HOT 2
- No combinator for the beginning of a string
- MatchError from choice with integer and string. HOT 1
- Accept atoms as labels HOT 2
- Documentation: Error in second example under `repeat_while/4`
- NimbleParsec does not respect clauses order with OTP 26.0 (Elixir 1.14.4) HOT 3
- Potential "The pattern can never match the type." issue found by dialyxir HOT 3
- [proposal] Improve integer parsing HOT 2
- Add missing git tag for 1.3.1 HOT 1
- Nested parsec() call seems to consume error HOT 3
- takeP equivalent HOT 3
- Parse any character until HOT 3
- Add cheatsheet to documentation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nimble_parsec.