doc.odin 656 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. package cel
  3. sample := `
  4. x = 123;
  5. y = 321.456;
  6. z = x * (y - 1) / 2;
  7. w = "foo" + "bar";
  8. # This is a comment
  9. asd = "Semicolons are optional"
  10. a = {id = {b = 123}} # Dict
  11. b = a.id.b
  12. f = [1, 4, 9] # Array
  13. g = f[2]
  14. h = x < y and w == "foobar"
  15. i = h ? 123 : "google"
  16. j = nil
  17. "127.0.0.1" = "value" # Keys can be strings
  18. "foo" = {
  19. "bar" = {
  20. "baz" = 123, # optional commas if newline is present
  21. "zab" = 456,
  22. "abz" = 789,
  23. },
  24. };
  25. bar = @"foo"["bar"].baz
  26. `;
  27. main :: proc() {
  28. p, ok := create_from_string(sample);
  29. if !ok {
  30. return;
  31. }
  32. defer destroy(p);
  33. if p.error_count == 0 {
  34. print(p);
  35. }
  36. }
  37. */
  38. package cel