literals.carbon 614 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. // --- string
  5. 'C'
  6. "Hello\nWorld\n"
  7. "\"\'\t\r\n"
  8. '''Single line string'''
  9. ''' Multi line
  10. string
  11. '''
  12. // --- true-false
  13. true false
  14. // --- type-literals
  15. array bool char str type ;
  16. i8 i16 i32 i64 i128 i10
  17. u8 u16 u32 u64 u128 u11
  18. f8 f16 f32 f64 f128 f12
  19. // --- numbers
  20. 12345 6789 00012345
  21. 1234.56789
  22. 0.875
  23. 0.3e5
  24. 1e5
  25. .123
  26. .1e3
  27. 0b1011_0010
  28. 0b_010
  29. 0b2345
  30. 0B011
  31. 0x2AE5
  32. 0x_F109
  33. 0xD8_E2.5F_7Bp8
  34. 0xabcdef.abcdef
  35. 0XA85CE