Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow fullqualified function definition #1922

Merged
merged 1 commit into from
Oct 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Units/parser-clojure.r/simple-clojure.d/expected.tags
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
another.name input.clj /^(ns another.name)$/;" n
app.controller input.clj /^(ns app.controller)$/;" n
core-function-with-body input.clj /^(clojure.core\/defn core-function-with-body []$/;" f namespace:app.controller
empty-fn input.clj /^ (defn empty-fn [])$/;" f namespace:app.controller
function-with-body input.clj /^(defn function-with-body []$/;" f namespace:app.controller
x input.clj /^(defn x [])$/;" f namespace:another.name
3 changes: 3 additions & 0 deletions Units/parser-clojure.r/simple-clojure.d/input.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
(defn function-with-body []
(println "body"))

(clojure.core/defn core-function-with-body []
(println "core"))

'(defn quoted-function [])
(quote quoted-function2 [])

Expand Down
9 changes: 7 additions & 2 deletions parsers/clojure.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ static int isNamespace (const char *strp)

static int isFunction (const char *strp)
{
return strncmp (++strp, "defn", 4) == 0 && isspace (strp[4]);
return (strncmp (++strp, "defn", 4) == 0 && isspace (strp[4])); // || (strncmp (++strp, "clojure.core/defn", 17) == 0 && isspace (strp[17]));
}

static int isCoreFunction (const char *strp)
{
return (strncmp (++strp, "clojure.core/defn", 17) == 0 && isspace (strp[17]));
}

static int isQuote (const char *strp)
Expand Down Expand Up @@ -154,7 +159,7 @@ static void findClojureTags (void)
skipToSymbol (&p);
scope_index = makeNamespaceTag (name, p);
}
else if (isFunction (p))
else if (isFunction (p) || isCoreFunction (p))
{
skipToSymbol (&p);
makeFunctionTag (name, p, scope_index);
Expand Down