New scheme json design for better support on parsing

This commit is contained in:
Ernesto Castellotti 2019-05-04 21:20:17 +02:00
parent 30eff2526d
commit 9b6fadaf9e
3 changed files with 20743 additions and 20735 deletions

File diff suppressed because it is too large Load Diff

View File

@ -30,6 +30,10 @@ class TLClass {
bool isSynchronous;
}
class TLJson {
TLClass[] tl_classes;
}
class TLScheme2Json {
private string scheme;
private TLClass[] classes;
@ -93,15 +97,17 @@ class TLScheme2Json {
string toJson() {
import asdf : serializeToJsonPretty;
return this.classList.serializeToJsonPretty();
auto tljson = new TLJson();
tljson.tl_classes = this.classList;
return tljson.serializeToJsonPretty();
}
void parseType(ref string* lineptr, bool isFunction) {
private void parseType(ref string* lineptr, bool isFunction) {
auto tlClass = implParse(lineptr, isFunction);
this.classList ~= tlClass;
}
void parseClass(string line, bool isFunction) {
private void parseClass(string line, bool isFunction) {
import std.array : split;
import std.array : replace;
import std.string : strip;
@ -115,7 +121,7 @@ class TLScheme2Json {
this.classList ~= tlClass;
}
TLClass implParse(ref string* lineptr, bool isFunction) {
private TLClass implParse(ref string* lineptr, bool isFunction) {
import std.array : empty;
import std.array : split;
import std.array : join;

View File

@ -11,7 +11,7 @@
*/
void main(string[] args) {
import tlscheme2json;
import tlscheme2json : TLScheme2Json;
import std.getopt : getopt;
import std.getopt : config;
import std.array : empty;