SuperPower is a parser combinator library based on Sprache. Superpower generates friendlier error messages through its support for token-based parsers.
Questions tagged [superpower]
23 questions
0
votes
1 answer
Superpower: Create parser to Match against "\r\n" or "\n" ( More general: match against a string literal)
I want to create a parser for EOL, I can't just do whitespace because I need it to ignore spaces.
So I want to create a parser that will match on "\r\n" or '\n'. Doing a single character is easy Character.EqualTo('\n') but trying to match a specific…

TheColonel26
- 2,618
- 7
- 25
- 50
0
votes
1 answer
SuperPower parser run time exception: Value cannot be null. Parameter name: parser
I've been asked to create a Superpower parser for a logical statements consisting of 3 types of operators (AND, AND_NOT, OR), parenthesis for grouping, and data values. The data values are integer format, but are identifiers. These are more like…

Steve Wash
- 986
- 4
- 23
- 50
0
votes
0 answers
Modeling chained expressions into AST
Preface
I am trying to write an interpreter/compiler for the first time. Tokenization and parsing are already a thing, that I seem to have figured out. I still find myself struggling because there are some language constructs that are hard to model.…

Sebastian Krogull
- 1,468
- 1
- 15
- 31
0
votes
0 answers
Superpower parser, parse bracket style accessor
I'm trying to make a parser in Superpower C# parser library to parse a recursive/chained
bracket style accessor. Here is the example of something I want to parse:
indentifier.identifier[exp][exp].identifier[exp]
for the dot accessor I'm using the…

xDGameStudios
- 321
- 1
- 13
0
votes
4 answers
Is there way to simplify a LINQ statement using if-else statement in c#
I have a LINQ expression that works but I wanted to make it simpler and cleaner.
var tryCatchTerminator = true;
return tryCatchTerminator
? from varKeyword in MatchToken(SyntaxKind.VarKeyword)
from declarations in…

xDGameStudios
- 321
- 1
- 13
0
votes
1 answer
Parsing list of lists with Superpower
I would like to parse the books of a library expressed in a format like this:
#Book title 1
Chapter 1
Chapter 2
#Book title 2
Chapter 1
Chapter 2
Chapter 3
As you can see, the titles of the boot are preceded by a # and the chapters of each book are…

SuperJMN
- 13,110
- 16
- 86
- 185
0
votes
1 answer
Trying to build TextParser with alike open/close/delimiter characters
I'm working on building a parser with the SuperPower library.
Here's a sample of the source input that I want to parse:
|ABC|xyz|1 3|~~~|
The First | is the OpeningPipe.
The last | is the ClosingPipe.
The 2nd, 3rd, and 4th | are…

Ronnie Overby
- 45,287
- 73
- 267
- 346
0
votes
3 answers
Superpower: match a string with parser only if it begins a line
When parsing in superpower, how to match a string only if it is the first thing in a line?
For example, I need to match the A colon in "A: Hello Goodbye\n" but not in "Goodbye A: Hello\n"

rednoyz
- 1,318
- 10
- 24