bqan 1.0.3
bqan: ^1.0.3 copied to clipboard
Open Source Data Format for mapping Strings to Arrays of Strings
BQAN #
Basic Query-Answer Notation (pronounced 'Beacon') is an open source data format, for representing a Map (also known as Hashmap or Dictionary), mapping string keys, representing queries, to an list of string values, representing possible answers.
Getting started #
The syntax is really quite simple. You start with your query, surrounded with single quotes. Then, an arrow (->), followed by your answers, seperated with a comma, and ending with a semicolon. Neither line breaks nor spaces matter, so format your document however works best for you. Line and block comments are allowed, using slash style commenting, and embeddeding block comments is allowed (for example '/* /* */ wedgfhjngbfdste4r */' won't throw an error).
Usage #
First import BQAN into your project. Once done, you can now access the 'compile' function and 'CompilerResponse' class.
void main(List<String> args) {
const String raw =
"'What is 1/5 of £50?' -> '10', '£10'; 'What is 6 - 2?' -> '4';";
final CompilerResponse compiled = compile(raw);
// outputs { What is 1/5 of £50?: [10, £10], What is 6 - 2?: [4] }
print(compiled.queryAnswerMap);
}
Additional information #
Although currently there is only a Dart port, plans are in place to port BQAN to C, C#, Javascript and Python.