LattVines / RPGParser

A parser for randomizing formatted text.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RPGParser

A parser for randomizing formatted text. Made during Procedural Generation Jam #ProcJam in one week.

This is a recursive parser that reads through strings written in a specific format such that it can randomize the string content appearing in bracketed lists. It is a visual studio c# project consisting of a single class for the parser.

example

"[a|b] [c|d|e|f|[1|2] thing|last]" could produce any of the following.

  • "a 1 thing"
  • "b c"
  • "a 2"

Any section appearing inside '[' and ']' will be parsed. Options inside are dilineated by '|'. The parser is recursive; nested bracket sections are parsed.

What is this for?

This was made to assist with procedurally generating funny sentences and sayings for characters in my app The Tartle RPG Tool. Instead of writing methods to pick from lists of choices, I wanted a faster way to write out sentences with nested choices.

About

A parser for randomizing formatted text.

License:MIT License


Languages

Language:C# 100.0%