killme2008 / killme2008/aviatorscript

【BUG】不以分号结尾的let 语句执行报错

Open
#551 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
5.2k
Forks
906
PR merge metrics
No merged PRs in 30d

Description

AviatorEvaluator.execute("let a = 3", env); // 本意是想通过脚本往env里put一个变量

执行报错,aviator版本5.3.3
Exception in thread "main" com.googlecode.aviator.exception.ExpressionSyntaxErrorException: Syntax error: missing ';' for let statement at 9, lineNumber: 1, token : null,
while parsing expression: `
let a = 3^^^
`at com.googlecode.aviator.AviatorEvaluatorInstance.innerCompile(AviatorEvaluatorInstance.java:1545)

另外能否提供一个全局选项控制变量必须经过let显式声明后才能使用?类似visual basic里的Option Explicit,无需声明很容易误用:
let date = now();
data = data + 1 // 拼写错误,执行报错语句不够清晰易懂,如果能提示data未声明会好很多

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the reported behavior with AviatorEvaluator.execute("let a = 3", env) on version 5.3.3. Start at AviatorEvaluatorInstance.java:1545 and trace the let-statement parser; the issue also requests an explicit-declaration option, so clarify its intended scope and interaction with the existing syntax. Done requires an agreed behavior for both requests and verification that the resulting errors or declarations match it.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.