diff options
author | Eduardo Julian | 2017-05-01 18:15:14 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-05-01 18:15:14 -0400 |
commit | 3175ae85d62ff6f692b8cc127f56c6569041d788 (patch) | |
tree | 83340fd6cb5c287f13080d7ead386b1d161b8e77 /new-luxc/source/luxc/module/descriptor/common.lux | |
parent | 94cca1d49c0d3f6d328a81eaf6ce9660a6f149c1 (diff) |
- WIP: Some initial implementations for some re-written infrastructure.
Diffstat (limited to 'new-luxc/source/luxc/module/descriptor/common.lux')
-rw-r--r-- | new-luxc/source/luxc/module/descriptor/common.lux | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/new-luxc/source/luxc/module/descriptor/common.lux b/new-luxc/source/luxc/module/descriptor/common.lux new file mode 100644 index 000000000..60a313115 --- /dev/null +++ b/new-luxc/source/luxc/module/descriptor/common.lux @@ -0,0 +1,38 @@ +(;module: + lux + (lux (data [text] + (text format + ["l" lexer "l/" Monad<Lexer>]) + [char] + (coll [list "L/" Functor<List>])))) + +(type: #export Signal Text) + +(do-template [<name> <code>] + [(def: #export <name> Signal (|> <code> char;char char;as-text))] + + [cons-signal +5] + [nil-signal +6] + [stop-signal +7] + ) + +(do-template [<name> <code>] + [(def: #export <name> Signal <code>)] + + [ident-separator ";"] + ) + +(def: #export (encode-list encode-elem types) + (All [a] (-> (-> a Text) (List a) Text)) + (format (|> (L/map encode-elem types) + (text;join-with cons-signal)) + nil-signal)) + +(def: #export (decode-list decode-elem) + (All [a] (-> (l;Lexer a) (l;Lexer (List a)))) + (l;alt (<| (l;after (l;text nil-signal)) + (l/wrap [])) + (<| (l;seq decode-elem) + (l;after (l;text cons-signal)) + (decode-list decode-elem)))) + |