mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-30 04:44:44 +00:00
Test: tested multi-line comments are recognized
This commit is contained in:
parent
2b9d82e07e
commit
abae84af56
2 changed files with 15 additions and 3 deletions
|
@ -1,5 +1,13 @@
|
||||||
# 基本的な構文をパーサーがパスできるかチェックする
|
#[
|
||||||
# Check that a parser can pass the basic syntax
|
基本的な構文をパーサーがパスできるかチェックする
|
||||||
|
Check that a parser can pass the basic syntax
|
||||||
|
#[
|
||||||
|
`#[`から`]#`までが複数行コメントとして扱われる
|
||||||
|
コメント内部で入れ子で複数行コメントを付けれるが、閉じ忘れに注意
|
||||||
|
The comment from `#[` to `]#` is treated as a multi-line comment.
|
||||||
|
Nested multi-line comments can be added inside comments, but be careful not to forget to close them.
|
||||||
|
]#
|
||||||
|
]#
|
||||||
|
|
||||||
_a = 1_234 + 1113.* 3_000.2e-4 ** 0003 * .4
|
_a = 1_234 + 1113.* 3_000.2e-4 ** 0003 * .4
|
||||||
a, _, ...b = five_elem_tuple
|
a, _, ...b = five_elem_tuple
|
||||||
|
@ -7,6 +15,10 @@ f x, y =
|
||||||
x + y
|
x + y
|
||||||
if! True, do!:
|
if! True, do!:
|
||||||
print! "\"\\hello, world\\\""
|
print! "\"\\hello, world\\\""
|
||||||
|
#[
|
||||||
|
indented comment
|
||||||
|
dedented comment
|
||||||
|
]#
|
||||||
10.times! do!:
|
10.times! do!:
|
||||||
if! x.y.z, do!:
|
if! x.y.z, do!:
|
||||||
print! ""
|
print! ""
|
||||||
|
|
|
@ -18,7 +18,6 @@ fn test_lexer_for_basic() -> ParseResult<()> {
|
||||||
let mut lexer = Lexer::new(Input::File(FILE1.into()));
|
let mut lexer = Lexer::new(Input::File(FILE1.into()));
|
||||||
let newline = "\n";
|
let newline = "\n";
|
||||||
let /*mut*/ token_array = vec![
|
let /*mut*/ token_array = vec![
|
||||||
(Newline, newline),
|
|
||||||
(Newline, newline),
|
(Newline, newline),
|
||||||
(Newline, newline),
|
(Newline, newline),
|
||||||
(Symbol, "_a"),
|
(Symbol, "_a"),
|
||||||
|
@ -64,6 +63,7 @@ fn test_lexer_for_basic() -> ParseResult<()> {
|
||||||
(Symbol, "print!"),
|
(Symbol, "print!"),
|
||||||
(StrLit, "\"\"\\hello, world\\\"\""),
|
(StrLit, "\"\"\\hello, world\\\"\""),
|
||||||
(Newline, newline),
|
(Newline, newline),
|
||||||
|
(Newline, newline),
|
||||||
(NatLit, "10"),
|
(NatLit, "10"),
|
||||||
(Dot, "."),
|
(Dot, "."),
|
||||||
(Symbol, "times!"),
|
(Symbol, "times!"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue