calyx 0.18.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +33 -0
  3. data/calyx.gemspec +2 -2
  4. data/examples/faker.json +1 -0
  5. data/examples/faker.rb +1 -1
  6. data/lib/calyx.rb +12 -8
  7. data/lib/calyx/format.rb +5 -0
  8. data/lib/calyx/grammar.rb +12 -0
  9. data/lib/calyx/mapping.rb +15 -0
  10. data/lib/calyx/modifiers.rb +8 -0
  11. data/lib/calyx/prefix_tree.rb +191 -0
  12. data/lib/calyx/production/affix_table.rb +53 -0
  13. data/lib/calyx/production/uniform_branch.rb +6 -0
  14. data/lib/calyx/production/weighted_branch.rb +6 -0
  15. data/lib/calyx/registry.rb +35 -17
  16. data/lib/calyx/rule.rb +25 -4
  17. data/lib/calyx/{production → syntax}/choices.rb +1 -1
  18. data/lib/calyx/{production → syntax}/concat.rb +18 -22
  19. data/lib/calyx/syntax/expression.rb +87 -0
  20. data/lib/calyx/{production → syntax}/memo.rb +1 -1
  21. data/lib/calyx/{production → syntax}/non_terminal.rb +1 -1
  22. data/lib/calyx/syntax/paired_mapping.rb +53 -0
  23. data/lib/calyx/{production → syntax}/terminal.rb +1 -1
  24. data/lib/calyx/syntax/token.rb +9 -0
  25. data/lib/calyx/{production → syntax}/unique.rb +1 -1
  26. data/lib/calyx/{production → syntax}/weighted_choices.rb +9 -2
  27. data/lib/calyx/version.rb +1 -1
  28. metadata +27 -86
  29. data/.travis.yml +0 -9
  30. data/docs/404.html +0 -7
  31. data/docs/CNAME +0 -1
  32. data/docs/_config.yml +0 -27
  33. data/docs/_data/breadcrumbs.yml +0 -9
  34. data/docs/_data/docs.yml +0 -35
  35. data/docs/_data/examples.yml +0 -9
  36. data/docs/_includes/breadcrumbs.html +0 -36
  37. data/docs/_includes/contents.html +0 -12
  38. data/docs/_includes/icon-github.html +0 -4
  39. data/docs/_includes/icon-rubygems.html +0 -9
  40. data/docs/_includes/navbar.html +0 -24
  41. data/docs/_includes/pagebar.html +0 -12
  42. data/docs/_layouts/default.html +0 -13
  43. data/docs/_layouts/docs.html +0 -14
  44. data/docs/_layouts/home.html +0 -13
  45. data/docs/_layouts/page.html +0 -20
  46. data/docs/_posts/2017-09-14-welcome-to-jekyll.markdown +0 -25
  47. data/docs/_posts/2017-09-21-0.17.0-released.md +0 -10
  48. data/docs/_styles/card.scss +0 -7
  49. data/docs/_styles/colors.scss +0 -18
  50. data/docs/_styles/content.scss +0 -57
  51. data/docs/_styles/cta.scss +0 -25
  52. data/docs/_styles/grid.scss +0 -22
  53. data/docs/_styles/media.scss +0 -50
  54. data/docs/_styles/menu.scss +0 -54
  55. data/docs/_styles/modifiers.scss +0 -3
  56. data/docs/_styles/navbar.scss +0 -161
  57. data/docs/_styles/pagebar.scss +0 -32
  58. data/docs/_styles/reset.scss +0 -92
  59. data/docs/_styles/scale.scss +0 -23
  60. data/docs/_styles/spread.scss +0 -55
  61. data/docs/_styles/styleguide.scss +0 -52
  62. data/docs/_styles/syntax.scss +0 -84
  63. data/docs/_styles/typography.scss +0 -49
  64. data/docs/_styles/yard.scss +0 -36
  65. data/docs/api.html +0 -9662
  66. data/docs/assets/calyx-docs.css +0 -792
  67. data/docs/assets/calyx-flower-outline.svg +0 -202
  68. data/docs/assets/calyx-flower-reverse.svg +0 -202
  69. data/docs/assets/calyx-flower.svg +0 -202
  70. data/docs/assets/logo-small.png +0 -0
  71. data/docs/assets/logos/calyx-flower-1.svg +0 -22
  72. data/docs/assets/logos/calyx-flower-2.svg +0 -21
  73. data/docs/content/documentation.html +0 -20
  74. data/docs/content/examples.html +0 -12
  75. data/docs/content/examples/any-gradient.md +0 -32
  76. data/docs/content/examples/faker.md +0 -16
  77. data/docs/content/examples/tiny-woodland-bot.md +0 -24
  78. data/docs/content/guides/context.md +0 -45
  79. data/docs/content/guides/expressions.md +0 -175
  80. data/docs/content/guides/features.md +0 -50
  81. data/docs/content/guides/formats.md +0 -37
  82. data/docs/content/guides/installation.md +0 -51
  83. data/docs/content/guides/random.md +0 -100
  84. data/docs/content/guides/results.md +0 -62
  85. data/docs/content/index.html +0 -44
  86. data/docs/content/introduction.md +0 -23
  87. data/docs/content/introduction/concepts.md +0 -82
  88. data/docs/content/introduction/contributing.md +0 -43
  89. data/docs/content/introduction/tutorial.md +0 -129
  90. data/docs/content/styleguide.html +0 -71
  91. data/docs/docs.scss +0 -94
  92. data/docs/index.html +0 -12
  93. data/docs/package-lock.json +0 -1536
  94. data/docs/package.json +0 -16
  95. data/examples/faker.yml +0 -42
  96. data/lib/calyx/production/expression.rb +0 -32
data/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.3
4
- - 2.4
5
- - ruby-head
6
- - jruby-9.1.13.0
7
- - rbx-3
8
- before_install: gem install bundler
9
- script: bundle exec rspec
data/docs/404.html DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- layout: default
3
- ---
4
- <div class="content">
5
- <h1>Not found</h1>
6
- <p>Whatever you were looking for is not here.</p>
7
- </div>
data/docs/CNAME DELETED
@@ -1 +0,0 @@
1
- calyx-rb.org
data/docs/_config.yml DELETED
@@ -1,27 +0,0 @@
1
- title: Calyx
2
- email: me@maetl.net
3
- description: >
4
- A Ruby library for generating text with template expansion grammars.
5
- baseurl: "" # the subpath of your site, e.g. /blog
6
- url: "" # the base hostname & protocol for your site, e.g. http://example.com
7
- twitter_username: maetl
8
- github_username: maetl
9
-
10
- # Build settings
11
- markdown: kramdown
12
- plugins:
13
- - jekyll-feed
14
-
15
- highlighter: rouge
16
-
17
- # Exclude from processing.
18
- # The following items will not be processed, by default. Create a custom list
19
- # to override the default setting.
20
- # exclude:
21
- # - Gemfile
22
- # - Gemfile.lock
23
- # - node_modules
24
- # - vendor/bundle/
25
- # - vendor/cache/
26
- # - vendor/gems/
27
- # - vendor/ruby/
@@ -1,9 +0,0 @@
1
- documentation:
2
- title: Documentation
3
- permalink: /documentation/
4
- introduction:
5
- title: Introduction
6
- permalink: /introduction/
7
- guides:
8
- title: Guides
9
- permalink: /guides/
data/docs/_data/docs.yml DELETED
@@ -1,35 +0,0 @@
1
- - title: Introduction
2
- permalink: /introduction/
3
- pages:
4
- - title: Tutorial
5
- permalink: /introduction/tutorial
6
- - title: Key Concepts
7
- permalink: /introduction/concepts
8
- - title: For Beginners
9
- permalink: /introduction/beginners
10
- - title: Contributing
11
- permalink: /introduction/contributing
12
- - title: Guides
13
- permalink: /guides/
14
- pages:
15
- - title: Installation
16
- permalink: /guides/installation
17
- - title: Generating Results
18
- permalink: /guides/results
19
- - title: Dynamic Rules
20
- permalink: /guides/dynamic-rules
21
- - title: Template Expressions
22
- permalink: /guides/template-expressions
23
- - title: Weighted Choices
24
- permalink: /guides/weighted-choices
25
- - title: Extending Grammars
26
- permalink: /guides/extending
27
- - title: Random Seeds
28
- permalink: /guides/random-seeds
29
- - title: Reference
30
- permalink: /reference/
31
- pages:
32
- - title: Configuration Options
33
- permalink: /reference/config
34
- - title: API Listing
35
- permalink: /reference/api
@@ -1,9 +0,0 @@
1
- - title: Tiny Woodland Bot
2
- description: Minimalist Twitter emoji scenes.
3
- permalink: /examples/tiny-woodland-bot
4
- - title: Any Gradient
5
- description: A web service making linear gradients.
6
- permalink: /examples/any-gradient
7
- - title: Faker
8
- description: Generates fake names and email addresses.
9
- permalink: /examples/faker
@@ -1,36 +0,0 @@
1
- <ol itemscope itemtype="http://schema.org/BreadcrumbList">
2
-
3
- {% assign counter=0 %}
4
-
5
- {% for category in site.categories %}
6
-
7
- {% capture category_url %}{{ site.category_dir }}/{{ category | first | slugize | downcase | replace:' ','-' }}{% endcapture %}
8
- {% capture category_name %}{{ category | first}}{% endcapture %}
9
-
10
- {% for catpagename in page.categories %}
11
- {% if category_name == catpagename %}
12
-
13
- {% assign counter=counter | plus:1 %}
14
-
15
- <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
16
- <a itemprop="item" href="{{ site.url }}{{ append:'/' | append:category_url | append:'/' }}">
17
- <span itemprop="name">{{ catpagename }}</span>
18
- </a>
19
- <meta itemprop="position" content="{{counter}}" />
20
- </li>
21
-
22
- {% endif %}
23
- {% endfor %}
24
-
25
- {% endfor %}
26
-
27
- {% assign counter=counter | plus:1 %}
28
-
29
- <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
30
- <a itemprop="item" href="{{ site.url }}{{ page.url }}">
31
- <span itemprop="name">{{ page.title }}</span>
32
- </a>
33
- <meta itemprop="position" content="{{counter}}" />
34
- </li>
35
-
36
- </ol>
@@ -1,12 +0,0 @@
1
- <div class="menu">
2
- {% for section in site.data.docs %}
3
- <p class="menu-label">
4
- <a href="{{ section.permalink }}" class="{% if section.permalink == page.url %}is-active{% endif %}">{{ section.title }}</a>
5
- </p>
6
- <ul class="menu-list">
7
- {% for doc_page in section.pages %}
8
- <li><a href="{{ doc_page.permalink }}" class="{% if doc_page.permalink == page.url %}is-active{% endif %}">{{ doc_page.title }}</a></li>
9
- {% endfor %}
10
- </ul>
11
- {% endfor %}
12
- </div>
@@ -1,4 +0,0 @@
1
- <svg aria-labelledby="simpleicons-github-icon" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
2
- <title id="simpleicons-github-icon">GitHub icon</title>
3
- <path fill="#fff" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/>
4
- </svg>
@@ -1,9 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
2
- viewBox="0 0 200 200" enable-background="new 0 0 200 200" width="28" height="28">
3
- <g id="Logo">
4
- <polygon fill="#fff" points="68.8,69.9 68.7,69.8 46.5,92 100.4,145.8 122.6,123.7 154.3,92 132.1,69.8 132.1,69.7 68.7,69.7
5
- "/>
6
- <path fill="#fff" d="M100.2,10.6l-78.5,45v90l78.5,45l78.5-45v-90L100.2,10.6z M163.7,137l-63.5,36.6L36.7,137V64l63.5-36.6
7
- L163.7,64V137z"/>
8
- </g>
9
- </svg>
@@ -1,24 +0,0 @@
1
- <div class="navbar">
2
- <div class="nav-brand">
3
- <div class="logo">
4
- <button class="nav-toggle">☰</button>
5
- <figure class="logo-mark">
6
- <a href="/"><img src="/assets/calyx-flower.svg"></a>
7
- </figure>
8
- <h1 class="logo-type"><a href="/">Calyx</a></h1>
9
- </div>
10
- <div class="nav-menu">
11
- <ul>
12
- <li><a href="/documentation/">Documentation</a></li>
13
- <li><a href="/examples/">Examples</a></li>
14
- <li><a href="/changelog/">Changelog</a></li>
15
- </ul>
16
- </div>
17
- </div>
18
- <div class="nav-menu is-meta">
19
- <ul>
20
- <li><a href="https://github.com/maetl/calyx">{% include icon-github.html %}<span>GitHub Project</span></a></li>
21
- <li><a href="https://rubygems.org/gems/calyx">{% include icon-rubygems.html %}<span>RubyGems Package</span></a></li>
22
- </ul>
23
- </div>
24
- </div>
@@ -1,12 +0,0 @@
1
- {% assign crumbs = page.url | split: '/' %}
2
- <div class="pagebar">
3
- <ul class="breadcrumbs">
4
- <li><a href="/">Home</a></li>
5
- {% for crumb in crumbs offset: 1 %}
6
- {% unless forloop.last %}
7
- <li><a href="{% assign crumb_limit = forloop.index | plus: 1 %}{% for crumb in crumbs limit: crumb_limit %}{{ site.data.breadcrumbs[crumb].permalink }}{% endfor %}">{{ site.data.breadcrumbs[crumb].title }}</a></li>
8
- {% endunless %}
9
- {% endfor %}
10
- </ul>
11
- <h1>{{ page.title }}</h1>
12
- </div>
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1">
6
- <title>Calyx</title>
7
- <link href="https://fonts.googleapis.com/css?family=Cutive+Mono|Libre+Franklin:300,400,500,600,700|Work+Sans:700,800" rel="stylesheet">
8
- <link rel="stylesheet" href="/assets/calyx-docs.css">
9
- </head>
10
- <body>
11
- {{ content }}
12
- </body>
13
- </html>
@@ -1,14 +0,0 @@
1
- ---
2
- layout: page
3
- ---
4
-
5
- <div class="row">
6
- <div class="col docs-content">
7
- <div class="content card">
8
- {{ content }}
9
- </div>
10
- </div>
11
- <div class="col docs-sidebar">
12
- {% include contents.html %}
13
- </div>
14
- </div>
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1">
6
- <title>Calyx</title>
7
- <link href="https://fonts.googleapis.com/css?family=Cutive+Mono|Libre+Franklin:300,400,500,600,700|Work+Sans:700,800" rel="stylesheet">
8
- <link rel="stylesheet" href="/assets/calyx-docs.css">
9
- </head>
10
- <body>
11
- {{ content }}
12
- </body>
13
- </html>
@@ -1,20 +0,0 @@
1
- ---
2
- layout: default
3
- ---
4
-
5
- {% include navbar.html %}
6
- <div class="page">
7
- {% include pagebar.html %}
8
- {{ content }}
9
- </div>
10
- <script>
11
- window.addEventListener('load', function() {
12
- var navbar = document.querySelector('.navbar');
13
- var page = document.querySelector('.page');
14
- var toggle = document.querySelector('.nav-toggle');
15
- toggle.onclick = function(ev) {
16
- navbar.classList.toggle('is-open');
17
- page.classList.toggle('is-hidden');
18
- }
19
- });
20
- </script>
@@ -1,25 +0,0 @@
1
- ---
2
- layout: default
3
- title: "Welcome to Jekyll!"
4
- date: 2017-09-14 23:51:38 +1000
5
- categories: jekyll update
6
- ---
7
- You’ll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated.
8
-
9
- To add new posts, simply add a file in the `_posts` directory that follows the convention `YYYY-MM-DD-name-of-post.ext` and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.
10
-
11
- Jekyll also offers powerful support for code snippets:
12
-
13
- {% highlight ruby %}
14
- def print_hi(name)
15
- puts "Hi, #{name}"
16
- end
17
- print_hi('Tom')
18
- #=> prints 'Hi, Tom' to STDOUT.
19
- {% endhighlight %}
20
-
21
- Check out the [Jekyll docs][jekyll-docs] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll’s GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll Talk][jekyll-talk].
22
-
23
- [jekyll-docs]: https://jekyllrb.com/docs/home
24
- [jekyll-gh]: https://github.com/jekyll/jekyll
25
- [jekyll-talk]: https://talk.jekyllrb.com/
@@ -1,10 +0,0 @@
1
- ---
2
- layout: default
3
- title: 0.17.0 Released
4
- date: 2017-09-21 23:51:38 +1000
5
- categories: jekyll update
6
- ---
7
-
8
- New version released.
9
-
10
- Deprecation of string returned from `#generate`.
@@ -1,7 +0,0 @@
1
- .card {
2
- margin: $scale-p0;
3
- background-color: $color-content-background;
4
- padding: $scale-p1;
5
- border: 1px solid #e9e9e9;
6
- box-shadow: 1px 1px 6px 0px rgba(#e9e9e9, 0.2);
7
- }
@@ -1,18 +0,0 @@
1
- $color-white: #fff;
2
- $color-light: #fafafa;
3
- $color-dark: #333;
4
- $color-edge: #e9e9e9;
5
-
6
- $color-aquamarine: #76FABB;
7
- $color-meadow: #1BDE81;
8
- $color-eucalyptus: #218764;
9
- $color-stromboli: #2F5E52;
10
-
11
- $color-link: #555;
12
-
13
- $color-sidebar-background: $color-light;
14
- $color-sidebar-link: $color-eucalyptus;
15
- $color-sidebar-link-background-hover: $color-edge;
16
-
17
- $color-content-background: $color-white;
18
- $color-page-background: $color-light;
@@ -1,57 +0,0 @@
1
- .content {
2
- //margin: $scale-p0;
3
- //background-color: $color-content-background;
4
- //padding: $scale-p1;
5
- max-width: 800px;
6
- //border: 1px solid #e9e9e9;
7
- //box-shadow: 1px 1px 6px 0px rgba(#e9e9e9, 0.2);
8
-
9
- a {
10
- color: $color-stromboli;
11
- border-bottom: 1px solid $color-eucalyptus;
12
- }
13
-
14
- h1, h2, h3 {
15
- color: $color-eucalyptus;
16
- margin-top: $scale-p1;
17
-
18
- &:first-of-type {
19
- margin-top: 0;
20
- }
21
- }
22
-
23
- h2 {
24
- font-size: $scale-p1;
25
- }
26
-
27
- h3 {
28
- font-size: $scale-p0;
29
- }
30
-
31
- .highlighter-rouge {
32
- margin-bottom: 1rem;
33
- }
34
-
35
- pre {
36
- font-family: $font-code-family;
37
- overflow-x: scroll;
38
- padding: $scale-m2 $scale-m1;
39
- border-radius: 2px;
40
- line-height: 1.4;
41
-
42
- code {
43
- font-family: $font-code-family;
44
- font-size: $scale-p0;
45
- }
46
- }
47
-
48
- p, li {
49
- color: $color-dark;
50
- }
51
-
52
- li {
53
- display: list-item;
54
- margin-left: $scale-p0;
55
- list-style: disc;
56
- }
57
- }
@@ -1,25 +0,0 @@
1
- .cta-list {
2
- display: flex;
3
- align-items: center;
4
-
5
- li {
6
- margin-right: $scale-p1;
7
- }
8
- }
9
-
10
- .cta-button {
11
- display: inline-block;
12
- padding: $scale-m1 $scale-p0;
13
- border: 2px solid $color-white;
14
- border-radius: $scale-m1;
15
- font-weight: 700;
16
-
17
- &:hover {
18
- border: 2px solid $color-aquamarine;
19
- color: $color-aquamarine;
20
- }
21
-
22
- &:active {
23
- box-shadow: 0 0 4px $color-aquamarine;
24
- }
25
- }
@@ -1,22 +0,0 @@
1
- .container {
2
- width: 100%;
3
- }
4
-
5
- .row {
6
- display: block;
7
-
8
- @include tablet {
9
- display: flex;
10
- }
11
-
12
- @include desktop {
13
- display: flex;
14
- }
15
-
16
- }
17
-
18
- .col {
19
- flex-basis: 0;
20
- flex-grow: 1;
21
- flex-shrink: 1;
22
- }