Skip to content
This repository was archived by the owner on Feb 26, 2022. It is now read-only.

Commit ca68f65

Browse files
committed
Merge pull request #72 from TheBerkin/dev
Rant 2.0
2 parents 81ce6c1 + cf9e977 commit ca68f65

262 files changed

Lines changed: 15979 additions & 6582 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CmdLine.cs

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
5+
namespace Rant.Common
6+
{
7+
internal static class CmdLine
8+
{
9+
private static readonly Dictionary<string, string> Arguments = new Dictionary<string, string>();
10+
private static readonly HashSet<string> Flags = new HashSet<string>();
11+
private static readonly List<string> Paths = new List<String>();
12+
13+
/// <summary>
14+
/// Determines whether the user specified a question mark as the argument.
15+
/// </summary>
16+
public static readonly bool Help;
17+
18+
static CmdLine()
19+
{
20+
var args = Environment.GetCommandLineArgs().Skip(1).ToArray();
21+
int argc = args.Length;
22+
if (argc == 0) return;
23+
24+
if (argc == 1 && args[0] == "?")
25+
{
26+
Help = true;
27+
return;
28+
}
29+
30+
bool isProperty = false;
31+
32+
for (int i = 0; i < args.Length; i++)
33+
{
34+
if (isProperty)
35+
{
36+
Arguments[args[i - 1].TrimStart('-')] = args[i];
37+
isProperty = false;
38+
}
39+
else if (args[i].StartsWith("--"))
40+
{
41+
Flags.Add(args[i].TrimStart('-'));
42+
}
43+
else if (args[i].StartsWith("-"))
44+
{
45+
isProperty = true;
46+
}
47+
else
48+
{
49+
Paths.Add(args[i]);
50+
}
51+
}
52+
}
53+
54+
public static string[] GetPaths() => Paths.ToArray();
55+
56+
public static string Property(string name)
57+
{
58+
string arg;
59+
if (!Arguments.TryGetValue(name.ToLower(), out arg))
60+
{
61+
arg = "";
62+
}
63+
return arg;
64+
}
65+
66+
public static string Property(string name, string defaultValue)
67+
{
68+
string arg;
69+
return !Arguments.TryGetValue(name.ToLower(), out arg) ? defaultValue : arg;
70+
}
71+
72+
public static bool Flag(string name) => Flags.Contains(name);
73+
}
74+
}

README.md

Lines changed: 69 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,110 @@
1-
[![Build status](https://ci.appveyor.com/api/projects/status/2vn0imlns20n739a?svg=true)](https://ci.appveyor.com/project/TheBerkin/rant)
1+
<p align="center">
2+
<img src="http://i.imgur.com/QB3TNYq.png" alt="Rant logo"></img>
3+
</p>
24

35
<p align="center">
4-
<img src="http://i.imgur.com/EZinvT5.png" alt="Rant logo"></img>
6+
<a href="https://ci.appveyor.com/project/TheBerkin/rant/branch/master/artifacts">
7+
<img src="https://ci.appveyor.com/api/projects/status/2vn0imlns20n739a/branch/master?svg=true&passingText=Master%20Build%20Passing&pendingText=Master%20Build%20Pending&failingText=Master%20Build%20Failing" alt="Build status">
8+
</img>
9+
</a>
10+
<a href="https://ci.appveyor.com/project/TheBerkin/rant/branch/dev/artifacts">
11+
<img src="https://ci.appveyor.com/api/projects/status/2vn0imlns20n739a/branch/dev?svg=true&passingText=Dev%20Build%20Passing&pendingText=Dev%20Build%20Pending&failingText=Dev%20Build%20Is%20Kill" alt="Build status">
12+
</img>
13+
</a>
514
</p>
615

716
##What is Rant?
817

9-
Rant is a language for adding rich variations to text. It combines a markup language with functional and imperative programming concepts to deliver a concise but powerful tool for procedurally generating text. The goal of Rant is to augment human creativity with the boundless potential of randomness, enabling content producers to consider their next idea as not just a concept, but a seed for countless possibilities.
18+
Rant is a language for procedurally generating text. It combines a markup language with functional and imperative programming concepts to deliver a concise but powerful tool for adding rich variations to your text. The ultimate goal of Rant is to augment human creativity with the boundless potential of randomness, helping content producers consider their next ideas as not just static concepts, but seeds of countless possibilities.
1019

11-
###Features
12-
Some of the highlights of what Rant offers:
20+
##Features of Rant
1321

14-
* Recursive, branching choices with various selection strategies (random, ordered, locked...)
15-
* Access to external dictionaries using queries
16-
* Word rhyming using pronunciation metadata
17-
* Synchronize sections of random output
18-
* Automatic capitalization
19-
* Indefinite article (a/an) automation
20-
* Multiple outputs (channels)
22+
* Recursive, weighted branching with customizable selection strategies
23+
* Dictionary queries
24+
* Automation for capitalization, rhyming, and indefinite articles
25+
* Multiple output support
26+
* Richard, an experimental embedded scripting language
2127
* Probability modifiers
22-
* Overwriting (targets)
23-
* Looping (repeaters)
24-
* Conditionals
25-
* List objects
26-
* Subroutines
27-
* Arithmetic
28-
* *And much, much more...*
28+
* Loops, conditionals, and subroutines
29+
* Package loader for easy resource management
30+
* Unmanaged function exports for use in C/C++ applications *(Windows only, sorry!)*
31+
* Compatible with Unity
32+
* **And a whole lot more!**
2933

3034
##Examples
3135

32-
**Generate random sentence**
36+
**Fill in the blanks**
3337
```
3438
<name-male> likes to <verb-transitive> <noun.plural> with <pron.poss-male> pet <noun-animal> on <timenoun.plural-dayofweek>.
3539
```
3640
```
3741
Alick likes to mount shuttlecocks with his pet bat on Mondays.
3842
```
3943

40-
**Generate ten random numbers between 1 and 50 and spell them out using US spelling conventions**
44+
---
45+
46+
**Generate ten random numbers between 1 and 50 and spell them out**
4147
```
42-
[numfmt:verbal-en][rep:10][sep:,\s]{[num:1;50]}
48+
[case:sentence][numfmt:verbal-en][rep:10][sep:\s]{[num:1;50].}
4349
```
4450
```
45-
thirteen, twenty two, thirteen, nineteen, thirty one, thirty four, forty two, twenty six, twelve, forty four
51+
Four. Ten. Thirteen. Fifteen. Eighteen. Twenty four. Seven. Forty eight. Nineteen. Twenty five.
4652
```
4753

4854
---
4955

50-
**Generate 32 random hexadecimal digits grouped into sets of eight**
56+
**Write a poem**
5157
```
52-
[rep:4][sep:\s]{\8,x}
53-
54-
Alternatively...
55-
56-
[rep:32]{\x[notlast:[nth:8;0;\s]]}
58+
[rhyme:perfect]
59+
The <noun(1)::&a> <verb.ed(1)-transitive::&a> the <adj::&a> <noun(1)::&a>.
5760
```
5861
```
59-
6fb34d31 42e27a48 5884bce5 bf743ec8
62+
The bread fed the red head.
63+
```
64+
```
65+
The drug dug the smug plug.
6066
```
6167

6268
---
6369

64-
**Insert text into existing output**
70+
**?????**
6571
```
66-
The following word is [get:N] characters long: \"[mark:a]<noun-animal|fruit>[mark:b]\"
67-
[send:N;[dist:a;b]]
72+
[rs:16;\N]
73+
{
74+
[r:50]{([rr])\u2593|([re])\s}
75+
}
6876
```
6977
```
70-
The following word is 7 characters long: "kumquat"
78+
▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓ ▓▓▓▓ ▓ ▓ ▓ ▓
79+
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓ ▓ ▓▓▓ ▓ ▓
80+
▓▓▓▓▓▓ ▓▓▓▓▓ ▓ ▓▓▓ ▓ ▓ ▓ ▓▓▓▓ ▓▓ ▓ ▓
81+
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓ ▓ ▓ ▓ ▓▓ ▓▓ ▓▓
82+
▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓ ▓ ▓▓ ▓ ▓ ▓ ▓ ▓ ▓▓▓▓ ▓
83+
▓▓▓▓▓▓▓▓▓▓ ▓▓▓ ▓▓▓▓▓▓ ▓ ▓ ▓▓
84+
▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓ ▓▓ ▓▓▓ ▓ ▓ ▓ ▓ ▓
85+
▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓ ▓▓ ▓▓ ▓▓▓▓ ▓▓▓ ▓
86+
▓▓▓▓▓▓▓▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓ ▓▓ ▓
87+
▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓▓
88+
▓▓▓▓▓▓▓▓▓▓ ▓ ▓ ▓▓ ▓ ▓▓▓▓▓▓▓ ▓ ▓ ▓
89+
▓▓▓▓▓▓▓▓▓▓ ▓ ▓▓ ▓▓▓ ▓▓▓▓▓ ▓ ▓▓
90+
▓▓▓▓ ▓▓▓▓▓▓▓ ▓▓▓ ▓ ▓▓▓ ▓ ▓ ▓ ▓
91+
▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓ ▓ ▓▓ ▓▓▓ ▓▓ ▓
92+
▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓ ▓ ▓ ▓
93+
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓ ▓ ▓▓▓ ▓
7194
```
7295

96+
7397
##NuGet
7498
Rant is also available as a [NuGet package](https://www.nuget.org/packages/Rant/). Punch the following into your package manager console and smash the Enter key enthusiastically to get it:
7599
```
76100
PM> Install-Package Rant
77101
```
102+
Or if development builds are your thing:
103+
```
104+
PM> Install-Package Rant -Pre
105+
```
106+
107+
But remember, the latest version will always be available on the repository first.
78108

79109
##License
80110
Rant is provided under [The MIT License](https://github.com/TheBerkin/Rant/blob/master/LICENSE).
@@ -95,8 +125,9 @@ We have a [Trello board](https://trello.com/b/NnvgqGha/rant) where we also track
95125
##Learn Rant
96126
See [rantlang.github.io](http://rantlang.github.io) for full documentation of the API and Rant language, as well as additional example code.
97127

98-
##Try Rant
99-
Want to try Rant before you download anything? Check out [RantBox](http://rant.berkin.me/), an online pattern interpreter I made.
128+
##Other projects
129+
If you like Rant, you may also like these other, Rant-related projects:
130+
* [**RIDE**](http://github.com/RantLang/RIDE): The official (and highly WIP) Rant IDE
131+
* [**Rantionary**](http://github.com/TheBerkin/Rantionary): The official Rant dictionary
100132

101-
##Support Rant
102-
Rant is free to use; however, developing it takes a lot of time and dedication, and things like hosting and software cost money. If you feel so inclined, you may support the project by donating through **[Gratipay](https://gratipay.com/TheBerkin/)**. Any amount is appreciated :)
133+
:squirrel:

Rant.Console/CmdLine.cs

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)