【问题标题】:Is it possible to import another language with grammar-kit?是否可以使用语法工具包导入另一种语言?
【发布时间】:2019-08-08 13:55:53
【问题描述】:

我正在为 PyCharm 中的 Kivy 开发一个自定义语言支持插件,我认为我需要将一些 python 表达式导入其中,因为 .kv 文件允许在属性定义和 on_properties 回调定义中使用一些 python 代码。

这有必要吗?怎么可能?那我该怎么做呢?

【问题讨论】:

    标签: python intellij-idea intellij-plugin bnf grammar-kit


    【解决方案1】:

    如果您需要在一个文件中包含多种语言,这是可能的。 一种更简单的方法是让您的一些 PSI 元素实现 PsiLanguageInjectionHost 接口。这将允许将其他语言注入此类元素。

    如果这还不够,您可以考虑这里描述的更复杂的方法: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206765105-Tutorial-Custom-templating-language-plugin

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-04-07
      • 2011-10-05
      • 2015-10-31
      • 1970-01-01
      • 1970-01-01
      • 2021-07-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多