Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ tab_width = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = tr
max_line_length = 80

[*.yaml]
Expand Down
4 changes: 3 additions & 1 deletion source/darser/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ void main(string[] args) {
}

auto darser = new Darser(opts.inputFile);
Output output = new ClassBasedOutput(darser);
Output output = opts.dod
? new DoDBasedOutout(darser)
: new ClassBasedOutput(darser);

foreach(ff; options.expendedFirst) {
if(ff !in darser.expandedFirstSet) {
Expand Down
5 changes: 4 additions & 1 deletion source/darser/clioptions.d
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct Options {
string[] expendedFirst;
bool safe;
bool pure_;
bool dod;

string getParserModule() {
if(this.parserModule.empty) {
Expand Down Expand Up @@ -138,7 +139,9 @@ void getOptions(string[] args) {
"z|safe", "Mark all generated files as @safe",
&options.safe,
"k|pure", "Mark all generated files as pure",
&options.pure_
&options.pure_,
"d|dod", "Data driven design parser",
&options.dod
);

if(rslt.helpWanted) {
Expand Down
12 changes: 11 additions & 1 deletion source/darser/helper.d
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module darser.helper;

import std.array : empty;
import std.conv : to;
import std.exception : enforce;
import std.format : formattedWrite;
import std.uni : isLower;
import std.uni : isLower, toLower;
import std.stdio : File;

void formatIndent(O,Args...)(ref O o, long indent, string str,
Expand All @@ -22,6 +23,15 @@ bool isLowerStr(string str) {
return isLower(str[0]);
}

string toLowerFirst(string str) {
if(str.empty) {
return "";
}

dchar f = toLower(str[0]);
return to!string(f) ~ str[1 .. $];
}

void genIndent(File.LockingTextWriter ltw, int indent) {
while(indent > 0) {
formattedWrite(ltw, "\t");
Expand Down
Loading