Ruby parser with character ranges

J

Jonathan Edwards

Is there a parser for ruby syntax that identifies the exact ranges of
characters for each nonterminal? I need this to instrument ruby code.
Just getting line numbers is not adequate.

Thanks,
Jonathan
 
H

Hal Fulton

Jonathan said:
Is there a parser for ruby syntax that identifies the exact ranges of
characters for each nonterminal? I need this to instrument ruby code.
Just getting line numbers is not adequate.

irb has a lexer that is pretty easy to use. I think it only stores
the beginning location, though, but it should be easy to get the
range.

No example handy, sorry... if you can't figure it out, I can assist,
though...

Hal
 
G

gabriele renzi

il Fri, 12 Dec 2003 22:52:17 GMT, Jonathan Edwards
Is there a parser for ruby syntax that identifies the exact ranges of
characters for each nonterminal? I need this to instrument ruby code.
Just getting line numbers is not adequate.

dunno if this helps, but you may find useful ripper
look at [ruby-talk: 86056] for the latest reference to it
 
D

daz

Jonathan said:
Is there a parser for ruby syntax that identifies the exact ranges of
characters for each nonterminal? I need this to instrument ruby code.
Just getting line numbers is not adequate.

Thanks,
Jonathan


Referring to example in www.ruby-talk.org/83656

If the token has an associated value, use length of value
or start position of following token.

Comments are followed by TkNL.

Strings end where the next token begins
(e.g. TkSPACE / TkCOMMA ...)



daz
 
J

Jonathan Edwards

Thanks but I need a parse, not a lexical scan. I am looking for all
subexpressions, not just the tokens.

Jonathan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top