Commit 9b01667d authored by Fred Eisele's avatar Fred Eisele
Browse files

moved antlr4 parser generator to its own directory

parent a221e4e7
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/aql/src/catdata/aql/grammar/4m7/-ru88jt/AqlLexerRules.g4 by ANTLR 4.7
package org.aql;
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql/gen_src/catdata/aql/grammar/572/-ru88jt/AqlLexerRules.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Token;
......
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/aql/src/catdata/aql/grammar/4m7/-ru88jt/AqlParser.g4 by ANTLR 4.7
package org.aql;
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql/gen_src/catdata/aql/grammar/572/-ru88jt/AqlParser.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
......
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/aql/src/catdata/aql/grammar/4m7/-ru88jt/AqlParser.g4 by ANTLR 4.7
package org.aql;
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql/gen_src/catdata/aql/grammar/572/-ru88jt/AqlParser.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.tree.ErrorNode;
......
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/aql/src/catdata/aql/grammar/4m7/-ru88jt/AqlParser.g4 by ANTLR 4.7
package org.aql;
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql/gen_src/catdata/aql/grammar/572/-ru88jt/AqlParser.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
/**
......
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/aql/src/catdata/aql/grammar/4m7/-ru88jt/AqlParser.g4 by ANTLR 4.7
package org.aql;
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql/gen_src/catdata/aql/grammar/572/-ru88jt/AqlParser.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.tree.ParseTreeListener;
/**
......
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/aql/src/catdata/aql/grammar/4m7/-ru88jt/AqlParser.g4 by ANTLR 4.7
package org.aql;
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql/gen_src/catdata/aql/grammar/572/-ru88jt/AqlParser.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
/**
......
......@@ -4,7 +4,7 @@
(def version "2017.11.01-SNAPSHOT")
(set-env!
:source-paths #{"src/antlr4" "resource/sample"}
:source-paths #{"src/antlr4"}
:dependencies '[[org.clojure/clojure "RELEASE"]
[org.clojure/spec.alpha "0.1.143"]
[boot/core "RELEASE" :scope "test"]
......@@ -45,19 +45,18 @@
FileVisitOption LinkOption))
(deftask store
[s show bool "show the arguments"]
(comp
(target :dir #{"target"})))
[]
(target :dir #{"target"}))
(deftask build
[s show bool "show the arguments"]
(comp
(antlr/generate
:grammar "AqlLexerRules.g4"
:package "org.aql")
:package "catdata.aql.grammar")
(antlr/generate
:grammar "AqlParser.g4"
:package "org.aql"
:package "catdata.aql.grammar"
:visitor true
:listener true)
(javac)))
......@@ -65,28 +64,32 @@
(def no-path-extensions (into-array String []))
(def no-file-visit-options (into-array FileVisitOption []))
(def no-link-options (into-array LinkOption []))
(defn get-file-name [f] (.getFileName f))
(defn matches [gm f] (.matches gm (get-file-name f)))
(defn get-path-matcher [pattern]
(.getPathMatcher (java.nio.file.FileSystems/getDefault) pattern))
;; (into [] (map #(.getFileName %)) (file/walk path 1))
(deftask parse-examples
[]
(let [input-dir-str "../../../../resources/examples/aql"
(defn get-file-paths
[sample-dir file-glob-pattern]
(let [input-dir-str sample-dir
input-dir (Paths/get input-dir-str no-path-extensions)
input-raw-s
(let [children (Files/walk input-dir 1 no-file-visit-options)]
;(map #(.toRealPath % no-link-options)
(iterator-seq (.iterator children)))
gm (get-path-matcher "glob:*.{aql}")
gm (get-path-matcher file-glob-pattern)
input-file-s (filter #(matches gm %1) input-raw-s)]
input-file-s))
(util/info "input files : %s\n" input-file-s)
;; (into [] (map #(.getFileName %)) (file/walk path 1))
(deftask parse-examples
[p example-dir VAL str "provide a path to the examples"]
(let [input-files (mapv str (get-file-paths example-dir "glob:*.{aql}"))]
(util/info "input files : %s\n" input-files)
(comp
(antlr/exercise
:parser "org.aql.AqlParser"
:lexer "org.aql.AqlLexerRules"
:parser "catdata.aql.grammar.AqlParser"
:lexer "catdata.aql.grammar.AqlLexerRules"
:start-rule "file"
:tree true
:edn true
......@@ -94,42 +97,33 @@
:postscript true
:tokens true
:show true
:input (mapv str input-file-s)))))
:input input-files))))
(deftask parse-grammar
[s show bool "show the arguments"]
(s/check-asserts true)
(let [input-dir-str "./src/antlr4"
input-dir (Paths/get input-dir-str no-path-extensions)
input-raw-s
(let [children (Files/walk input-dir 1 no-file-visit-options)]
(iterator-seq (.iterator children)))
gm (get-path-matcher "glob:*.{g4}")
input-file-s (filter #(matches gm %1) input-raw-s)]
(comp
(coach/exercise
:start-rule "grammarSpec"
:tree false
:edn true
:rdf :jena
:postscript false
:tokens false
:input ["src/antlr4/LexBasic.g4"
"src/antlr4/AqlLexerRules.g4"
"src/antlr4/AqlParser.g4"
"src/antlr4/AqlComment.g4"
"src/antlr4/AqlTypeside.g4"
"src/antlr4/AqlGraph.g4"
"src/antlr4/AqlOptions.g4"
"src/antlr4/AqlInstance.g4"
"src/antlr4/AqlMapping.g4"
"src/antlr4/AqlCommand.g4"
"src/antlr4/AqlQuery.g4"
"src/antlr4/AqlSchema.g4"
"src/antlr4/AqlSchemaColimit.g4"
"src/antlr4/AqlTransform.g4"]))))
[]
(coach/exercise
:start-rule "grammarSpec"
:tree false
:edn true
:rdf :jena
:postscript false
:tokens false
:input ["src/antlr4/LexBasic.g4"
"src/antlr4/AqlLexerRules.g4"
"src/antlr4/AqlParser.g4"
"src/antlr4/AqlComment.g4"
"src/antlr4/AqlTypeside.g4"
"src/antlr4/AqlGraph.g4"
"src/antlr4/AqlOptions.g4"
"src/antlr4/AqlInstance.g4"
"src/antlr4/AqlMapping.g4"
"src/antlr4/AqlCommand.g4"
"src/antlr4/AqlQuery.g4"
"src/antlr4/AqlSchema.g4"
"src/antlr4/AqlSchemaColimit.g4"
"src/antlr4/AqlTransform.g4"]))
(deftask my-repl
......@@ -154,8 +148,18 @@
(comp
(build)
(parse-grammar)
(parse-examples)
(parse-examples :example-dir "../../../../resources/examples/aql")
(parse-examples :example-dir "../../../../resources/examples/aql_extra")
;; (show :fileset true)
(store)))
(deftask live [] (comp (watch) (dev)))
(deftask promote
[]
(comp
(build)
(parse-grammar)
(sift :include #{ #".*\.java"})
(target :dir #{"../../../../gen/catdata/aql/grammar"})))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment