diff options
author | Bad Diode <bd@badd10de.dev> | 2024-06-14 17:55:51 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2024-06-14 17:55:51 +0200 |
commit | 3aae2f36047e9adc6a59b886492254eb4370777d (patch) | |
tree | 7d8f8fc069393dd38e9688d8d7cf77117ba5235f /tests | |
parent | deaf192df939c9ec9a62ef4febaf76ade0dcbb01 (diff) | |
download | bdl-3aae2f36047e9adc6a59b886492254eb4370777d.tar.gz bdl-3aae2f36047e9adc6a59b886492254eb4370777d.zip |
Starting fresh with the `badlang`
Diffstat (limited to 'tests')
-rw-r--r-- | tests/literals.bad | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/literals.bad b/tests/literals.bad new file mode 100644 index 0000000..673494d --- /dev/null +++ b/tests/literals.bad | |||
@@ -0,0 +1,33 @@ | |||
1 | ; String literals | ||
2 | "this is a string literal" | ||
3 | "" ; empty string literals | ||
4 | "make sure ; can be used inside strings without issues" | ||
5 | "\tmake sure to parse \"escape chars\" properly\n" | ||
6 | "unicode 🥰 glyphs inside strings 😀" | ||
7 | |||
8 | ; Integers. | ||
9 | 12345 | ||
10 | +420 ; ints can be positive | ||
11 | -69 ; ... or negative | ||
12 | 0b1101 ; we can write in binary form | ||
13 | 0xff ; ... or hex (but not octal) | ||
14 | 0014515 ; leading zeroes are allowed | ||
15 | 1_000_000 ; we support separators | ||
16 | 0xffff_ffff_ffff_ffff ; ... also on hex | ||
17 | 0b1001_1111 ; ... and binary representations | ||
18 | |||
19 | ; Reals. | ||
20 | 0.123 | ||
21 | +3.0 ; reals can be positive | ||
22 | -1.3 ; ... or negative 1 | ||
23 | 2.45e5 ; we can use scientific notation | ||
24 | +1.23e+6 ; +/- can be on the number and/or the exponent | ||
25 | -3.14e-1 ; the exponents are always integers | ||
26 | -3.21e+0xff ; ... in any of its forms | ||
27 | |||
28 | ; Booleans. | ||
29 | true | ||
30 | false | ||
31 | |||
32 | ; Nil. | ||
33 | nil | ||