是否有类似于Nokogiri的语法来解析Ruby代码?

编程入门 行业动态 更新时间:2024-10-24 16:22:08
本文介绍了是否有类似于Nokogiri的语法来解析Ruby代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Nokogiri很棒.我可以做类似#css('.bla')这样的操作,它将返回第一个匹配的元素.

Nokogiri is awesome. I can do things like #css('.bla') which will return the first matching element.

现在,我们需要对Ruby源代码进行一些解析-查找类中的所有方法,等等.我们正在使用 ruby​​_parser gem,但是它所做的只是梳理您的源代码并吐出S表达式.对于这些S表达式,是否有类似Nokogiri的功能,它们可以完成为找到的名为'foo'的第一个方法返回S表达式"之类的事情?

Right now we need to do some parsing of Ruby source code - finding all methods within a class etc. We're using the ruby_parser gem, but all it does is comb your source code and spit out S-expressions. Is there anything like Nokogiri for these S-expressions which can do things like "return S-expression for first method found named 'foo'"?

推荐答案

我唯一能想到的是亚当·桑德森(Adam Sanderson)的SExpPath库.

The only thing I can think of, is Adam Sanderson's SExpPath library.

更多推荐

是否有类似于Nokogiri的语法来解析Ruby代码?

本文发布于:2023-11-06 21:21:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564701.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:类似于   语法   代码   Nokogiri   Ruby

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!