Permalink
Browse files

use java ast

  • Loading branch information...
1 parent 7c1964b commit 3da79d4d310d7a4f3cd2ccf2ce6404ec4cbecb9e @mmikulicic committed Jan 4, 2010
Showing with 15 additions and 5 deletions.
  1. +8 −4 src/eu/dnetlib/dlms/ast.clj
  2. +7 −1 src/eu/dnetlib/dlms/parser.clj
@@ -1,13 +1,17 @@
-(ns eu.dnetlib.dlms.ast)
+(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 XPathComponent XPathExpr XPath
+ )))
+
(defn make-number-lit [n]
- {:type 'Lit :value n})
+ (new NumberLit n))
(defn make-string-lit [n]
- {:type 'Lit :value n})
+ (new StringLit n))
(defn make-reference [n]
- {:type 'Ref :name n})
+ (new Ref n))
(defn make-struct-def [l v]
{:type 'StructDef :label l :value v})
@@ -1,5 +1,8 @@
(ns eu.dnetlib.dlms.parser
- (:gen-class)
+ (:gen-class
+ :name eu.dnetlib.dlms.ClojureDQLParser
+ :implements [eu.dnetlib.dlms.jdbc.parser.IDQLParser]
+ )
(:use [eu.dnetlib.clojure.clarsec]
[eu.dnetlib.dlms.ast]
[eu.dnetlib.clojure.monad])
@@ -116,3 +119,6 @@
(defn -main []
(println (parse source "1")))
+
+(defn -parse [strn]
+ (:value (parse source strn)))

0 comments on commit 3da79d4

Please sign in to comment.