ANTLR JavaScript目标 [英] ANTLR JavaScript Target

查看:111
本文介绍了ANTLR JavaScript目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用ANTLR为带有Java目标的标记语言生成解析器+树语法,该语法很好用.现在,我试图在JavaScript中获取目标,以便在我的Web浏览器中使用它.

但是,我无法找到有关如何执行此操作的任何好的文档.我在ANTLR IDE中使用eclipse,当我将语言指定为JavaScript时,出现以下错误.

此行有多个标记

  • (10):内部错误:组JavaScript不满足接口ANTLRCore:这些模板上的参数不匹配[treeParser(语法,名称,作用域,令牌,令牌名,globalAction,规则,numRules,位集,labelType,ASTLabelType ,superClass,成员,filterMode)]

  • (10):内部错误:java.util.NoSuchElementException:无此类属性:模板上下文[treeParser]中的filterMode

如果有人可以帮助我解决这个问题,或者给我指出一些我可以阅读有关ANTLR的JavaScript目标的材料,那就太好了.

谢谢

解决方案

有大约3个月前发布到GitHub的ANTLR4的新JS Lang目标:

antlr/antlr4-javascript

它尚未集成到正式版本中,但是您可以将其放入最新的ANTLR4代码库中,然后自己重​​新编译ANTLR.

I have been using ANTLR to generate a parser + tree grammar for a mark up language with Java target which works fine. Now I am trying to get the target in JavaScript to use it in my web browser.

However, I have not been able to locate any good documentation on how to go about doing this. I am using eclipse with ANTLR IDE, and when i specify the language as JavaScript, I get the following errors.

Multiple markers at this line

  • (10): internal error: group JavaScript does not satisfy interface ANTLRCore: mismatched arguments on these templates [treeParser(grammar, name, scopes, tokens, tokenNames, globalAction, rules, numRules, bitsets, labelType, ASTLabelType, superClass, members, filterMode)]

  • (10): internal error: java.util.NoSuchElementException: no such attribute: filterMode in template context [treeParser]

If anyone could help me out with this or point me to some material which I could read about the JavaScript target with ANTLR, it would be great.

Thanks

解决方案

There is a new JS Lang target for ANTLR4 that was posted to GitHub almost 3 months ago:

antlr/antlr4-javascript

It's not integrated into an official release yet, but you can probably just throw it into the latest ANTLR4 codebase and recompile ANTLR yourself.

这篇关于ANTLR JavaScript目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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