From 04259ac74894f5e0b3319efe17c833b179d483e3 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 8 Dec 2014 23:38:12 -0400 Subject: Can now define inside modules: simple classes with public fields. --- src/lang/parser.clj | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/lang/parser.clj') diff --git a/src/lang/parser.clj b/src/lang/parser.clj index 5adf36030..beb14302d 100644 --- a/src/lang/parser.clj +++ b/src/lang/parser.clj @@ -107,6 +107,14 @@ [::&lexer/list ([[::&lexer/ident "module"]] :seq)] (return [::module])) +(defparser ^:private parse-defclass + [::&lexer/list ([[::&lexer/ident "defclass"] [::&lexer/ident ?name] [::&lexer/tuple ?fields]] :seq)] + (let [fields (for [field ?fields] + (match field + [::&lexer/tuple ([[::&lexer/ident ?class] [::&lexer/ident ?field]] :seq)] + [?class ?field]))] + (return [::defclass ?name fields]))) + (defparser ^:private parse-tagged [::&lexer/list ([[::&lexer/tag ?tag] ?data] :seq)] (exec [=data (apply-m parse-form (list ?data))] @@ -190,6 +198,7 @@ parse-dynamic-access parse-ann-class parse-module + parse-defclass parse-fn-call])) ;; [Interface] -- cgit v1.2.3