feat: add comment support to saccharine language
Add '#' comment syntax that works like Python comments. Comments can take up a whole line or appear at the end of a line. All characters after '#' until the next newline or EOF are ignored. Closes #24
This commit is contained in:
1
tests/comments.expected
Normal file
1
tests/comments.expected
Normal file
@@ -0,0 +1 @@
|
||||
VALUE
|
||||
15
tests/comments.test
Normal file
15
tests/comments.test
Normal file
@@ -0,0 +1,15 @@
|
||||
# This is a full-line comment at the start
|
||||
# The following defines the identity function
|
||||
identity := \x.x # This is an end-of-line comment
|
||||
|
||||
# Define a simple function that applies a function twice
|
||||
twice := \f.\x.(f (f x))
|
||||
|
||||
# Test that comments don't interfere with expressions
|
||||
result := (twice identity VALUE) # Should just return VALUE
|
||||
|
||||
# Multiple comments in a row
|
||||
# can appear anywhere
|
||||
# without breaking the code
|
||||
|
||||
result # Final comment at the end
|
||||
Reference in New Issue
Block a user