Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/HSPC/Tokenize.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ data HSPCToken

tokenize :: String -> [HSPCToken]
tokenize [] = []
tokenize ('{' : cs) = tokenize $ dropWhile (/= '}') cs
tokenize (c : cs)
| "//" `isPrefixOf` (c : cs) = tokenize $ dropWhile (/= '\n') cs
-- End includes this annoying '.'
Expand Down
4 changes: 3 additions & 1 deletion test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ testSuite =
TestSpec "Divide(div) literal ints" "operators_divide_two_ints" 2,
TestSpec "Brackets with literal ints" "operators_brackets" 26,
TestSpec "Unary minus with literal ints" "operators_unary_minus_int" 75,
TestSpec "Unary plus with literal ints" "operators_unary_plus_int" 25
TestSpec "Unary plus with literal ints" "operators_unary_plus_int" 25,
TestSpec "{} comments" "comments_curly_brace" 12,
TestSpec "// comments" "comments_single_line" 12
]

main :: IO ()
Expand Down
Empty file.
9 changes: 9 additions & 0 deletions test/sample_programs/comments_curly_brace.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

program CommentExample;

begin
{
halt(0);
}
halt(12);
end.
Empty file.
7 changes: 7 additions & 0 deletions test/sample_programs/comments_single_line.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

program CommentExample;

begin
//halt(0);
halt(12);
end.
Loading