Hello,

2011/1/18 Olek <aleksander.nas...@gmail.com>

> Hi,
>
> Here is a link: http://code.google.com/p/textmash/
>
> Some time ago I have written it in order to help accomplish a task of
> creating some paraller processing  system written entirely in Clojure
> (it was the map reduce framework from Google).
>
> It was also used with success in other tasks, like editing PHP pages,
> Clojure learning, writing small programs in Clojure and some simple
> text processing.
>
> Feel free to contribute in bug fixing and improving or maybe even
> rewriting it in Clojure (there are not too much lines of code).
>

There's a "task" I have in my todo list since a long time, which is to
extract more of ccw "structural editing" and "clojure source code grammar
parser" into external projects.

Currently, "structural editing" in ccw is already totally decoupled from
Eclipse, or even any graphical toolkit (Swing / SWT). The only dependencies
of the "clojure grammar definition+parsley parser+structural edition
a-la-paredit commands" are clojure and clojure-contrib.

If you're interested, I could reprioritize this task and put it near the top
of my todo list.

As an example, calling a "paredit.clj" command looks like this: call a
multimethod named paredit.core/paredit:

  * call the parser to get a parsetree. Note that the parsetree follows
clojure.xml format.
  * give the parsetree to the paredit command, along with the command name
and the state of the editor (plain textual content, cursor position,
selection length). As a result you'll get a set of text changes to apply to
the source code in the form of a list of maps representing deltas: {:keys
[offset length text]} (in the original source code, replace the range
[offset (+ offset length)[ with text to effectively apply the paredit
command you invoked)

in code (pseudo-code, not my dev environment at hand), this would look like
with the current shape of the code/namespaces:

;; how would we invoke "raise over sexp" to get "(spy foo)" transformed into
"foo" with the cursor before "f" char and no current selection
(require '[paredit.parser :as p] '[paredit.core :as s])
(let [original-code "(spy foo)"
      parsetree (p/parse original-code)
      raise-over-delta (s/paredit :paredit-raise-sexp parsetree {:text
original-code :offset 5 :length 0})]
  raise-over-delta)
=> {:text "(spy foo)" :offset 5 :length 0 :modifs [ {:text "foo" :offset 0
:length 9} ]}

HTH,

-- 
Laurent



>
> The main idea is to take what is best in Eclipse, NetBeans and
> ergonomy of Mac OS and put into light tool.
> I hope you will enjoy it.
>
> Bye!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com<clojure%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to