-
-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #157 from kaushalmodi/nim_underscore
Allow standalone _ to be recognized as identifier in Nim
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- nim -*- | ||
import random | ||
proc randBool(): bool = | ||
randomize() | ||
result = rand(1).bool | ||
for _ in 0..5: | ||
echo randBool() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
[ | ||
{"type":"Comment","value":"# -*- nim -*-"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"KeywordNamespace","value":"import"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"random"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"Keyword","value":"proc "}, | ||
{"type":"NameFunction","value":"randBool"}, | ||
{"type":"Punctuation","value":"():"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"KeywordType","value":"bool"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Operator","value":"="}, | ||
{"type":"Text","value":"\n "}, | ||
{"type":"Name","value":"randomize"}, | ||
{"type":"Punctuation","value":"()"}, | ||
{"type":"Text","value":"\n "}, | ||
{"type":"Name","value":"result"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Operator","value":"="}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"rand"}, | ||
{"type":"Punctuation","value":"("}, | ||
{"type":"LiteralNumberInteger","value":"1"}, | ||
{"type":"Punctuation","value":")."}, | ||
{"type":"KeywordType","value":"bool"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"Keyword","value":"for"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"_"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"OperatorWord","value":"in"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"LiteralNumberFloat","value":"0"}, | ||
{"type":"Punctuation","value":".."}, | ||
{"type":"LiteralNumberInteger","value":"5"}, | ||
{"type":"Punctuation","value":":"}, | ||
{"type":"Text","value":"\n "}, | ||
{"type":"Name","value":"echo"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"randBool"}, | ||
{"type":"Punctuation","value":"()"}, | ||
{"type":"Text","value":"\n"} | ||
] |