@@ -3354,7 +3354,7 @@ defmodule Kernel do
3354
3354
3355
3355
## Sigils
3356
3356
3357
- @ doc """
3357
+ @ doc ~S """
3358
3358
Handles the sigil ~S. It simply returns a string
3359
3359
without escaping characters and without interpolations.
3360
3360
@@ -3363,15 +3363,15 @@ defmodule Kernel do
3363
3363
iex> ~S(foo)
3364
3364
"foo"
3365
3365
3366
- iex> ~S(f\ # {o}o)
3367
- "f\\ \ # {o}o"
3366
+ iex> ~S(f#{o}o)
3367
+ "f\#{o}o"
3368
3368
3369
3369
"""
3370
3370
defmacro sigil_S ( string , [ ] ) do
3371
3371
string
3372
3372
end
3373
3373
3374
- @ doc """
3374
+ @ doc ~S """
3375
3375
Handles the sigil ~s. It returns a string as if it was double quoted
3376
3376
string, unescaping characters and replacing interpolations.
3377
3377
@@ -3380,15 +3380,18 @@ defmodule Kernel do
3380
3380
iex> ~s(foo)
3381
3381
"foo"
3382
3382
3383
- iex> ~s(f\ # {:o}o)
3383
+ iex> ~s(f#{:o}o)
3384
3384
"foo"
3385
3385
3386
+ iex> ~s(f\#{:o}o)
3387
+ "f\#{:o}o"
3388
+
3386
3389
"""
3387
3390
defmacro sigil_s ( { :<<>> , line , pieces } , [ ] ) do
3388
3391
{ :<<>> , line , Macro . unescape_tokens ( pieces ) }
3389
3392
end
3390
3393
3391
- @ doc """
3394
+ @ doc ~S """
3392
3395
Handles the sigil ~C. It simply returns a char list
3393
3396
without escaping characters and without interpolations.
3394
3397
@@ -3397,15 +3400,15 @@ defmodule Kernel do
3397
3400
iex> ~C(foo)
3398
3401
'foo'
3399
3402
3400
- iex> ~C(f\ # {o}o)
3401
- 'f\\ \ # {o}o'
3403
+ iex> ~C(f#{o}o)
3404
+ 'f\#{o}o'
3402
3405
3403
3406
"""
3404
3407
defmacro sigil_C ( { :<<>> , _line , [ string ] } , [ ] ) when is_binary ( string ) do
3405
3408
String . to_char_list ( string )
3406
3409
end
3407
3410
3408
- @ doc """
3411
+ @ doc ~S """
3409
3412
Handles the sigil ~c. It returns a char list as if it were a single
3410
3413
quoted string, unescaping characters and replacing interpolations.
3411
3414
@@ -3414,9 +3417,12 @@ defmodule Kernel do
3414
3417
iex> ~c(foo)
3415
3418
'foo'
3416
3419
3417
- iex> ~c(f\ # {:o}o)
3420
+ iex> ~c(f#{:o}o)
3418
3421
'foo'
3419
3422
3423
+ iex> ~c(f\#{:o}o)
3424
+ 'f\#{:o}o'
3425
+
3420
3426
"""
3421
3427
3422
3428
# We can skip the runtime conversion if we are
@@ -3450,13 +3456,13 @@ defmodule Kernel do
3450
3456
quote do: Regex . compile! ( unquote ( binary ) , unquote ( :binary . list_to_bin ( options ) ) )
3451
3457
end
3452
3458
3453
- @ doc """
3459
+ @ doc ~S """
3454
3460
Handles the sigil ~R. It returns a Regex pattern without escaping
3455
3461
nor interpreting interpolations.
3456
3462
3457
3463
## Examples
3458
3464
3459
- iex> Regex.match?(~R(f\ # {1,3}o), "f\ # o")
3465
+ iex> Regex.match?(~R(f#{1,3}o), "f#o")
3460
3466
true
3461
3467
3462
3468
"""
@@ -3465,7 +3471,7 @@ defmodule Kernel do
3465
3471
Macro . escape ( regex )
3466
3472
end
3467
3473
3468
- @ doc """
3474
+ @ doc ~S """
3469
3475
Handles the sigil ~w. It returns a list of "words" split by whitespace.
3470
3476
3471
3477
## Modifiers
@@ -3476,7 +3482,7 @@ defmodule Kernel do
3476
3482
3477
3483
## Examples
3478
3484
3479
- iex> ~w(foo \ # {:bar} baz)
3485
+ iex> ~w(foo #{:bar} baz)
3480
3486
["foo", "bar", "baz"]
3481
3487
3482
3488
iex> ~w(--source test/enum_test.exs)
@@ -3496,7 +3502,7 @@ defmodule Kernel do
3496
3502
split_words ( binary , modifiers )
3497
3503
end
3498
3504
3499
- @ doc """
3505
+ @ doc ~S """
3500
3506
Handles the sigil ~W. It returns a list of "words" split by whitespace
3501
3507
without escaping nor interpreting interpolations.
3502
3508
@@ -3508,8 +3514,8 @@ defmodule Kernel do
3508
3514
3509
3515
## Examples
3510
3516
3511
- iex> ~W(foo \ # {bar} baz)
3512
- ["foo", "\\ \ # {bar}", "baz"]
3517
+ iex> ~W(foo #{bar} baz)
3518
+ ["foo", "\#{bar}", "baz"]
3513
3519
3514
3520
"""
3515
3521
defmacro sigil_W ( { :<<>> , _line , [ string ] } , modifiers ) when is_binary ( string ) do
0 commit comments