【问题标题】:Using GUIDs as attributes to substitute in a stringtemplate.org template使用 GUID 作为属性来替换 stringtemplate.org 模板
【发布时间】:2015-02-19 20:13:14
【问题描述】:

模板(stringtemplate.org 4 引擎)中是否有办法使用 GUID 作为要替换的属性或降低 stringtemplate 的表现力,因此它不会将分隔符之间的值评估为属性查找以外的任何值?

示例: 以下失败并出现 Antlr4.StringTemplate.Compiler.TemplateException。

Template template = new Template("{AAA04EC0-301F-11D3-BF1B-00C04F79AAAC}", '{', '}');

【问题讨论】:

    标签: stringtemplate stringtemplate-4


    【解决方案1】:

    是和不是。

    是:StringTemplate 组语法已更新,允许- 字符作为属性名称的一部分出现(但不作为第一个字符)。我不确定模板词法分析器是否已更新以允许您实际使用这样的属性。您应该在项目的问题跟踪器上提交问题: https://github.com/antlr/stringtemplate4/issues

    否:属性名称不能以数字开头,因此只能使用以字母开头的 GUID 值。

    【讨论】:

    • 不完全是我所看到的。 “A-B”仍然抛出,“A-”被接受。无论如何,我都会提交缺陷。
    猜你喜欢
    • 1970-01-01
    • 2012-07-23
    • 2018-02-27
    • 2023-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-26
    相关资源
    最近更新 更多