Alexsandro,

I don't know about Parsatron, but Parse-EZ (
https://github.com/protoflex/parse-ez) provides the 'line-pos' function 
that returns the line and column info.

Here is the equivalent code for your example using Parse-EZ:
--------------
(use 'protoflex.parse)

(defn anbn []
  (let [as (regex #"a+")
        bs (string (apply str (repeat (count as) \b)))]
    (str as bs)))

(defn xdny [] (regex #"xd+y"))

(defn pL [] (any anbn xdny))
-------------

and you call your pL function through the parser entry function "parse":

user=> (parse pL "xddy")
"xddy"

user=> (parse pL "aabb")
"aabb"

user=> (parse pL "aac")
Parse Error (exception thrown)


On Thursday, August 23, 2012 7:54:16 PM UTC+5:30, Alexsandro Soares wrote:
>
> Ok. Thanks for the answer.
>
> Is there any way to get the line and column?
>
> For example, in this parser 
>
> (defparser ident []
>    (>> (letter) (many (either (letter) (digit)))))
>
> I want the token and the initial line and column. How can I change this 
> code?
>
> Cheers,
> Alex
>
>

-- 
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