Skip to content

Commit

Permalink
README & License
Browse files Browse the repository at this point in the history
  • Loading branch information
WebFreak001 committed Sep 11, 2018
1 parent 899fd6e commit 22ebb85
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# DietComplete

An error correcting diet parser based on the diet-ng spec. See [SPEC.md](SPEC.md) for the added grammar by this repository.

## Example

```d
import std.algorithm;
import std.conv;
import std.stdio;
import dietc.complete;
void main()
{
// Create completion engine from filename
// You can also pass a parsed document with a callback for other files in the future (from extend tags)
auto complete = new DietComplete("views/filename.dt");
size_t offset = 12;
// Use completeAt to get completion results for a specific byte offset in the code
auto completion = complete.completeAt(offset);
if (completion is Completion.completeD)
{
size_t dOffset;
string dCode;
complete.extractD(offset, /*out*/ dCode, /*out*/ dOffset);
// special instruction that D code should be completed here
writeln("Complete D code ", dCode, " at ", dOffset);
}
else
completion.map!(a => text(a.type, ": ", a.text)).each!writeln;
}
```
5 changes: 4 additions & 1 deletion dub.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"name": "diet-complete"
"name": "diet-complete",
"description": "Error correcting diet parser with integrated auto-completion and neat AST tools",
"license": "MIT",
"copyright": "Copyright © 2018 webfreak"
}

0 comments on commit 22ebb85

Please sign in to comment.