Skip to content
Browse files

updates

  • Loading branch information...
1 parent dbf35c4 commit 361310477640a8da59041a4c4b6cdd7f82d1d19a @mmikulicic committed Mar 29, 2010
Showing with 21 additions and 10 deletions.
  1. +3 −0 src/eu/dnetlib/clojure/clarsec.clj
  2. +4 −1 src/eu/dnetlib/dlms/ast.clj
  3. +14 −9 src/eu/dnetlib/dlms/parser.clj
View
3 src/eu/dnetlib/clojure/clarsec.clj
@@ -194,6 +194,9 @@
(defn brackets [p]
(between (symb "[") (symb "]") p))
+
+(defn braces [p]
+ (between (symb "{") (symb "}") p))
(def stringLiteral
View
5 src/eu/dnetlib/dlms/ast.clj
@@ -1,7 +1,7 @@
(ns eu.dnetlib.dlms.ast
(:import (eu.dnetlib.dlms.jdbc.ast
Assign BinaryPredicate Call DeclInit Expression Inst Lit NumberLit Predicate Ref RunExpr Select SimplePredicate StringLit Struct
- StructKeyValue XPathComponent XPathExpr XPath Parameter
+ StructKeyValue XPathComponent XPathExpr XPath Parameter CollectionNode
)))
(defn make-run-expr [e]
@@ -19,6 +19,9 @@
(defn make-parameter [n]
(new Parameter n))
+(defn make-collection [values]
+ (new CollectionNode values))
+
(defn make-struct [defs]
(new Struct defs))
View
23 src/eu/dnetlib/dlms/parser.clj
@@ -32,8 +32,14 @@
(def parameter
(>>== (>> (symb ":") baseIdentifier) make-parameter))
+(def baseLabel
+ (either (stringify (m-sequence [baseIdentifier (string ":") baseIdentifier]))
+ baseIdentifier))
+
+(def label (lexeme baseLabel))
+
(def structureDef
- (let-bind [label identifier
+ (let-bind [label label
_ (symb "=")
val expression]
(result (make-struct-def label val))))
@@ -42,8 +48,13 @@
(>>== (brackets (sepBy structureDef comma))
make-struct))
+(def collection
+ (delay
+ (>>== (braces (sepBy expression comma))
+ make-struct)))
+
(def literal
- (either structure number stringLit))
+ (either collection structure number stringLit))
(def argList
(delay (sepBy expression comma)))
@@ -77,14 +88,8 @@
(let-bind [name identifier]
(either (decl name) (assign name))))
-
-
(def tagname (lexeme (either (symb ".")
- (let-bind [attr (option "" (string "@"))
- ns (option "" (stringify (m-sequence [baseIdentifier (string ":")])))
- name (either baseIdentifier (symb "*"))]
- (result (str attr ns name))))))
-
+ (stringify (m-sequence [(optional (string "@")) baseLabel])))))
(def binaryPredicate
(delay

0 comments on commit 3613104

Please sign in to comment.
Something went wrong with that request. Please try again.