Skip to content

Conversation

@superiums
Copy link

  • optional choose ; or linebreak to split a statement. linebreak was automaticlly analyzied when a new line start. but except a new lined followed these chars:
    '{' | '(' | '[' | ',' | '>' | '=' | ';' | '\n' | '\\'
  • added \ to the end of a line to contiue a line.

tested with following cases:

# 测试1: 纯换行符分割
let a = 1
let b = a + 2
echo b
echo "1 pass"

# 测试2: 分号结尾
let c = 3; let d = c * 4;
echo d
echo "2 pass"

# 测试3: 混合分割
let e = 5;
let f = e + 6  # 无分号
let g = f // 7;
echo g
echo "3 pass"

# 测试4: 控制结构自动终止
if g > 0 {
    echo "Positive"
}

echo "pass 4"

let sum =0
for i in 0 to 10 {
    echo i
    let sum = sum + i
}
echo sum
echo "pass 5"

# 测试5: 多行字符串
let logo = "
    ██╗  ██╗███████╗
    ██║  ██║██╔════╝
    ███████║█████╗  
    ██╔══██║██╔══╝  
    ██║  ██║███████╗
    ╚═╝  ╚═╝╚══════╝
"
echo logo
echo "pass 6"

# 测试6: 续行符连接
let long_expr = 1 + 2 + \
                3 + 4 + \
                5
echo long_expr                

echo "pass all"
# 测试7: 文件末尾装饰换行符

@adam-mcdaniel
Copy link
Owner

I'll take a look in the morning!! Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants