repeated_tuple_index.carbon 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. //
  5. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/repeated_tuple_index.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/repeated_tuple_index.carbon
  10. // CHECK:STDOUT: - filename: repeated_tuple_index.carbon
  11. // CHECK:STDOUT: tokens:
  12. x.0.1.2.3.foo.4.5
  13. // CHECK:STDOUT: - { index: 1, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "x", identifier: 0, has_leading_space: true }
  14. // CHECK:STDOUT: - { index: 2, kind: "Period", line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: "." }
  15. // CHECK:STDOUT: - { index: 3, kind: "IntLiteral", line: {{ *}}[[@LINE-3]], column: 3, indent: 1, spelling: "0", value: "0" }
  16. // CHECK:STDOUT: - { index: 4, kind: "Period", line: {{ *}}[[@LINE-4]], column: 4, indent: 1, spelling: "." }
  17. // CHECK:STDOUT: - { index: 5, kind: "IntLiteral", line: {{ *}}[[@LINE-5]], column: 5, indent: 1, spelling: "1", value: "1" }
  18. // CHECK:STDOUT: - { index: 6, kind: "Period", line: {{ *}}[[@LINE-6]], column: 6, indent: 1, spelling: "." }
  19. // CHECK:STDOUT: - { index: 7, kind: "IntLiteral", line: {{ *}}[[@LINE-7]], column: 7, indent: 1, spelling: "2", value: "2" }
  20. // CHECK:STDOUT: - { index: 8, kind: "Period", line: {{ *}}[[@LINE-8]], column: 8, indent: 1, spelling: "." }
  21. // CHECK:STDOUT: - { index: 9, kind: "IntLiteral", line: {{ *}}[[@LINE-9]], column: 9, indent: 1, spelling: "3", value: "3" }
  22. // CHECK:STDOUT: - { index: 10, kind: "Period", line: {{ *}}[[@LINE-10]], column: 10, indent: 1, spelling: "." }
  23. // CHECK:STDOUT: - { index: 11, kind: "Identifier", line: {{ *}}[[@LINE-11]], column: 11, indent: 1, spelling: "foo", identifier: 1 }
  24. // CHECK:STDOUT: - { index: 12, kind: "Period", line: {{ *}}[[@LINE-12]], column: 14, indent: 1, spelling: "." }
  25. // CHECK:STDOUT: - { index: 13, kind: "IntLiteral", line: {{ *}}[[@LINE-13]], column: 15, indent: 1, spelling: "4", value: "4" }
  26. // CHECK:STDOUT: - { index: 14, kind: "Period", line: {{ *}}[[@LINE-14]], column: 16, indent: 1, spelling: "." }
  27. // CHECK:STDOUT: - { index: 15, kind: "IntLiteral", line: {{ *}}[[@LINE-15]], column: 17, indent: 1, spelling: "5", value: "5" }
  28. 1.2.3.4
  29. // CHECK:STDOUT: - { index: 16, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "1.2", value: "12*10^-1", has_leading_space: true }
  30. // CHECK:STDOUT: - { index: 17, kind: "Period", line: {{ *}}[[@LINE-2]], column: 4, indent: 1, spelling: "." }
  31. // CHECK:STDOUT: - { index: 18, kind: "IntLiteral", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: "3", value: "3" }
  32. // CHECK:STDOUT: - { index: 19, kind: "Period", line: {{ *}}[[@LINE-4]], column: 6, indent: 1, spelling: "." }
  33. // CHECK:STDOUT: - { index: 20, kind: "IntLiteral", line: {{ *}}[[@LINE-5]], column: 7, indent: 1, spelling: "4", value: "4" }
  34. tuple.1.2
  35. // CHECK:STDOUT: - { index: 21, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "tuple", identifier: 2, has_leading_space: true }
  36. // CHECK:STDOUT: - { index: 22, kind: "Period", line: {{ *}}[[@LINE-2]], column: 6, indent: 1, spelling: "." }
  37. // CHECK:STDOUT: - { index: 23, kind: "IntLiteral", line: {{ *}}[[@LINE-3]], column: 7, indent: 1, spelling: "1", value: "1" }
  38. // CHECK:STDOUT: - { index: 24, kind: "Period", line: {{ *}}[[@LINE-4]], column: 8, indent: 1, spelling: "." }
  39. // CHECK:STDOUT: - { index: 25, kind: "IntLiteral", line: {{ *}}[[@LINE-5]], column: 9, indent: 1, spelling: "2", value: "2" }
  40. tuple . 1.2
  41. // CHECK:STDOUT: - { index: 26, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "tuple", identifier: 2, has_leading_space: true }
  42. // CHECK:STDOUT: - { index: 27, kind: "Period", line: {{ *}}[[@LINE-2]], column: 7, indent: 1, spelling: ".", has_leading_space: true }
  43. // CHECK:STDOUT: - { index: 28, kind: "RealLiteral", line: {{ *}}[[@LINE-3]], column: 9, indent: 1, spelling: "1.2", value: "12*10^-1", has_leading_space: true }
  44. "hello"1.2
  45. // CHECK:STDOUT: - { index: 29, kind: "StringLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "\"hello\"", value: "hello", has_leading_space: true }
  46. // CHECK:STDOUT: - { index: 30, kind: "RealLiteral", line: {{ *}}[[@LINE-2]], column: 8, indent: 1, spelling: "1.2", value: "12*10^-1" }