Skip to content

Instantly share code, notes, and snippets.

@straight-shoota
Created February 18, 2021 00:09
Show Gist options
  • Save straight-shoota/5588b2a1652382423e18dcf0c944d66e to your computer and use it in GitHub Desktop.
Save straight-shoota/5588b2a1652382423e18dcf0c944d66e to your computer and use it in GitHub Desktop.
Formatting expression value comment
# These are the invalid syntax comments extracted from crystal master (at 152e390fb1368fafd5c3d6028f46ee149f0f216a)
# /src/** files using the code from https://github.com/crystal-lang/crystal/pull/8851
# src/hash.cr
{}
{}
# src/regex.cr
Regex::MatchData("tal")
{}
Regex::MatchData("Skiing")
Regex::MatchData("sledding")
Regex::MatchData("Skiing")
Regex::MatchData("sledding")
Regex::MatchData("Skiing")
Regex::MatchData("sledding")
Regex::MatchData("Skiing")
Regex::MatchData("sledding")
Regex::MatchData("foo")
Regex::MatchData("bar")
Regex::MatchData("_x_" 1:"x")
Regex::MatchData("_y_" 1:"y")
Regex::MatchData("_x_")
Regex::MatchData("_x_")
Regex::MatchData("_x_")
Regex::MatchData("_x_")
Regex::MatchData("f")
Regex::MatchData("foo")
Regex::MatchData("foo")
Regex::MatchData("foo")
Regex::MatchData("foooooooo")
Regex::MatchData("fopop" 1:"op")
Regex::MatchData("foobar")
Regex::MatchData("fobar")
Regex::MatchData("spice" 1:"spice" 2:nil)
Regex::MatchData("asdf" 1:"sd")
Regex::MatchData("asdf" grp:"sd")
Regex::MatchData("hay")
Regex::MatchData("hay")
Regex::MatchData("hay")
Regex::MatchData("stack")
Regex::MatchData("hay")
Regex::MatchData("a")
Regex::MatchData("y")
# src/indexable.cr
[[]]
[]
# src/yaml.cr
{
"data" => {
"string" => "foobar",
"array" => ["John", "Sarah"],
"hash" => {"key" => "value"},
"paragraph" => "foo\nbar\n"
}
# src/http/client.cr
author=John+Doe&offset=20
# src/colorize.cr
"foo" without color
"foo" in red
"foo" in orange
"foo" in aqua
# src/crypto/bcrypt/password.cr
$2a$10$rI4xRiuAN2fyiKwynO6PPuorfuoM4L2PVv6hlnVJEmNLjqcibAfHq
$2a$10$rI4xRiuAN2fyiKwynO6PPuorfuoM4L2PVv6hlnVJEmNLjqcibAfHq
# src/uri.cr
URI::Params(@raw_params={"id" => ["30"], "limit" => ["5"]})
# src/uuid/json.cr
UUID(ba714f86-cac6-42c7-8956-bcf5105e1b81)
# src/object.cr
[one, two, three, etc.]
# src/bit_array.cr
BitArray[00110]
BitArray[01]
BitArray[010]
# src/big/big_decimal.cr
BigDecimal(@value=5, @scale=2)
BigDecimal(@value=33333, @scale=5)
# src/big/big_int.cr
123456789101101987654321
123456789123456789123456789123456789
123456789123456789123456789
# src/kernel.cr
Content of file1
[]
Content of file2
# src/string.cr
Regex::MatchData("foo")
Regex::MatchData("foo")
"�hello" (invalid UTF-8 character)
"�" (invalid UTF-8 character)
"�" (invalid UTF-8 character)
"�h" (invalid UTF-8 character)
# src/enumerable.cr
30 (2 * 5 * 3)
15 (5 * 3)
9 (1 + 5 + 3)
8 (5 + 3)
3 (Bob's size)
5 (Alice's size)
1 (Bob's index)
[Regex::MatchData("Al"), nil]
[Regex::MatchData("Al")]
# src/json/to_json.cr
2016-04-05 12:48:03.856 UTC
2016-04-05 12:36:21 UTC
{"foo" => 2016-04-05 12:36:21 UTC, "bar" => 2019-09-04 20:26:02 UTC)}
{"birthdays":{"foo":1459859781,"bar":1567628762}}
[2016-04-05 12:36:21 UTC, 2019-09-04 20:26:02 UTC]
# src/json/serialization.cr
A(@json_unmapped={"b" => 2_i64}, @a=1)
{"a":1,"b":2}
A(@a=1, @b=1.0)
# src/json/pull_parser.cr
raise an exception. The current token is a string ("values"), not the end of an object.
# src/log.cr
Log for db source
Log for db.pool source
Log for db source
# src/complex.cr
0.0 + 1.0i
2.0581710272714924 + 0.48586827175664565i
0.6505149978319906 + 0.20135959813668655i
2.1609640474436813 + 0.6689021062254881i
1.4978661367769956 + 0.4636476090008061i
-22.720847417619233 + 49.645957334580565i
42.0 - 2.0i
42.0 + 2.0i
1.0 + 0.0i
5.0 - 12.0i
1.0 + 0.0i
0.0 + 1.0i
# src/macros.cr
"[1, 2, 3].map(&.to_s) ["1", "2", "3"]"
"[1, 2, 3].map(&.to_s) ["1", "2", "3"]"
# src/csv/lexer.cr
CSV::Token(@kind=Cell, @value="one")
CSV::Token(@kind=Cell, @value="two")
CSV::Token(@kind=Newline, @value="two")
CSV::Token(@kind=Cell, @value="three")
CSV::Token(@kind=Eof, @value="three")
# src/file.cr
2015-09-23 06:24:19 UTC
2015-10-20 13:11:12 UTC
# src/benchmark.cr
00:00:00.0005840
# src/time/span.cr
2017-03-01 00:00:00
2018-02-28 00:00:00
1.00:00:00
01:02:03
1.02:03:04.000000005
00:00:00.500000000
00:00:05.500000000
00:00:30
00:00:05.000000012
10:00:00
30.00:00:00
00:00:00.000010000
10:10:10
10.10:10:10
# src/time/location.cr
[#<Time::Location::Zone +01:00 (0s) STD>]
2016-02-15 21:01:10 +01:00 Europe/Berlin
# src/time/format/custom/http_date.cr
2016-02-14 21:00:00 UTC
2016-02-14 21:00:00 UTC
2016-02-14 21:00:00 UTC
2016-02-14 21:00:00 UTC
# src/array.cr
[]
[]
[]
[]
[]
[]
[9, #<Indexable::ItemIterator>]
[[1, 2, 3], [4, 5, 6, [7, 8]], 9, #<Indexable::ItemIterator>, 12, 13]
[]
[]
[]
[]
# src/tuple.cr
1 (Int32)
1 (Int32 | String | Char)
# src/time.cr
2018-03-08 22:05:13 +01:00 Europe/Berlin
2018-03-08 18:05:13 -03:00 America/Buenos_Aires
2016-04-05 00:00:00.0 +00:00
2016-04-05 00:00:00.0 +00:00
2016-04-05 00:00:00.0 +00:00
2016-04-05 00:00:00.0 +02:00 Europe/Berlin
2018-03-08 21:05:13 UTC
2018-03-08 21:05:13 UTC
2001-02-03 04:05:06.789 UTC
2001-02-03 04:05:06 UTC
?
2015-10-05 00:00:00 +00:00
2018-03-08 21:05:13 UTC
2018-03-08 21:05:13 UTC
2018-03-08 22:05:13 +01:00 Europe/Berlin
2018-03-08 18:05:13 -03:00 America/Buenos_Aires
2018-03-08 22:05:13.0 UTC
2018-03-08 22:05:13 +01:00 Europe/Berlin
10:20:30
2016-02-15 10:20:30 UTC
2016-02-15 10:20:30 +01:00 Europe/Berlin
2016-02-15 00:00:00 UTC
# src/yaml/serialization.cr
A(@yaml_unmapped={"b" => 2_i64}, @a=1)
A(@a=1, @b=1.0)
# src/yaml/to_yaml.cr
[2016-04-05 12:36:21 UTC, 2019-09-04 20:26:02 UTC]
---\nvalues:\n- 1459859781\n- 1567628762\n
# src/compiler/crystal/tools/doc/markdown/markdown.cr
<h2>This is title</h2>
<p>This is a <a href="https://crystal-lang.org">link</a></p>
# src/semantic_version.cr
SemanticVersion::Prerelease(@identifiers=["rc", 1, 3])
# src/log/format.cr
- [foo.bar] Hello
- INFO: Hello
- ERROR: Oh, no!
# src/levenshtein.cr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment