liquid-java / liquid-java/liquidjava

State Names should be able to start with UpperCase

未关闭
#25 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

enhancement good first issue
主要语言
Java
星标
67
派生
36
平均合并
10 天 18 小时
30 天内合并 PR
3

描述

## Why
There is some confusion about what can be written in uppercase and lowercase, and we only defined that in the Grammar.

During the user study, some participants started writing the state names capitalized (i.e., first letter Upper Case and the remaining in lower case). However, the current grammar does not allow it since capitalization is reserved for Alias.

Maybe it would make sense to allow both types to be capitalized specially since we got different annotation for each that serve as syntax sugar but help desambiguate.

## Example
```java
@StateSet({"Uninitialized", "Initialized"})
public class SM1 {

@StateRefinement(to="Uninitialized(this)")
public SM1() {}

@StateRefinement(from="Uninitialized(this)", to="Initialized(this)")
public void initialize() {}
}
...
public static void main(String[] args) {
SM1 sm1 = new SM1();
sm1.initialize(); //Error
}
```
The states are capitalized so they are handled as alias which should not be the correct behavior.

## Steps
1. Allow in the grammar that states can be capital (confirm if it is needed).
2. When parsing the refinements AST make sure the capitalized states are treated as such and not as alias.
3. Test with examples.

## Current Approach
Check if any of the state names provided starts with uppercase - if so, immediately return with an error.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先定位 grammar 和 refinements AST parser,然后跟踪当前如何将首字母大写的状态名称分类为别名。运行 issue 中描述的示例,并添加或更新涵盖首字母大写状态和别名的测试。完成标准是:有效的首字母大写状态名称能够解析为状态,同时不破坏别名处理。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
compilers
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。