什么将是一个很好的Delphi词法分析器/解析器的Javascript语言文件? [英] What would be a good Delphi lexer/parser for Javascript language file?

查看:365
本文介绍了什么将是一个很好的Delphi词法分析器/解析器的Javascript语言文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景

我需要能够识别源中的变量和函数,以便通过后续代码来更改代码。我明白,我可能需要使用一个词法分析器来达到这个目的,但是没有使用我发现的词法分析器( Dyaclexx )。

I want to be able to parse Javascript source in a Delphi Application. I need to be able to identify variables and functions within the source for the purpose of making changes to the code through later code. I understand that I probably need to use a lexer for this purpose but have not had much luck using the lexer which I found (Dyaclexx).

问题

免费软件或开源的delphi解析器/词法分析器,它已经具有用于Javascript的令牌集,或者可以轻松地修改此目的而不需要太多麻烦?

Is there a suitable freeware or open source delphi parser/lexer which already has token sets for Javascript or could be easily modified for this purpose without too much trouble?

如果没有这样的工具已经可用,那么为了达到这个目的,学习自己的词典的最好方式是什么?

If there isn't such a tool already available then what would be the best way to learn about writing your own lexer for this purpose?

谢谢

推荐答案

对于词法分析,您可以看到 Synedit的源代码为JavaScript荧光笔。 Synedit上下文中的荧光笔是具有特殊钩子的词法分析器,可为编辑器组件提供突出显示。修剪这些钩子并得到一个简单的词法分析器是一件简单的工作。

For the lexer you can see Synedit's source code for the Javascript highlighter. A highlighter in Synedit context is a lexer with special hooks to provide highlighting to the editor component. Trimming those hooks and getting a plain lexer is a trivial job.

此外,Synedit编辑器可以方便地学习如何构建词法分析器,因为它将有助于实时直观地测试词法分析器。您可以在邮件列表中查看演示或询问更多信息。

Also Synedit editor can come handy while learning how to build lexers as it will be a help to visually test your lexers real-time. You can see the demos or ask at the mailing list for more.

这篇关于什么将是一个很好的Delphi词法分析器/解析器的Javascript语言文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆