test_tb_parser.tb.txt 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. # Test file for the text node system and its parser
  2. # Everything is a tree of nodes with a name and value.
  3. # The values may be strings, numbers or arrays.
  4. # If there is no colon, the entire line will be treated as a value and no quotes is needed around strings.
  5. # Any quotes will be part of the string.
  6. strings
  7. string1 A string
  8. string2 "A string"
  9. string3 'A string'
  10. string4 "'A string'"
  11. string5 Foo\nBar
  12. # If there is a colon (compact mode), there must be quotes around strings.
  13. # First comes the value (optional)
  14. # Then comes other child nodes (separated by comma)
  15. strings_compact
  16. string1: this should fail
  17. string2: "A string"
  18. string3: 'A string'
  19. string4: "'A string'"
  20. string5: '"A string"'
  21. string6: "\"A string\""
  22. string7: "\\"
  23. string8: "\""
  24. string9: "\\\\\\\\"
  25. string10: "\\\\\""
  26. string11: "\"\"\'\'"
  27. string12: @language_string_token
  28. string13: #ffdd00
  29. numbers
  30. integer1 42
  31. float1 1.1
  32. # The following lines should have extra trailing white space
  33. integer2 42
  34. float2 1.1
  35. numbers_compact
  36. integer1: -10
  37. integer2: -10, something_else: "foo"
  38. float1: 1.0
  39. float2: -1.0
  40. float3: -.2
  41. float4: -.2, something_else: "foo"
  42. # The following lines should have extra trailing white space after the numbers
  43. float5: 1.1
  44. float6: 1.1 , something_else: "foo"
  45. numbers_with_unit
  46. number1 10px
  47. number2 -10px
  48. number3: 10px
  49. number4: -10px
  50. number5: -2.1px
  51. number6: -.1px, something_else: "foo"
  52. # The following line should have extra trailing white space
  53. number7: 1px
  54. compact_with_children
  55. string: "A string", child1: "Child 1", child2: "Child 2"
  56. integer: -10, child1: 1, child2: 2
  57. float: 1.0, child1: 1.0, child2: 2.0
  58. compact_no_value: string: "A string", int: 42, float: 3.14
  59. subgroup: string1: "A string, with \"comma\"", string2: "'Another string'"
  60. string3: "And another string"
  61. arrays
  62. numbers 1 2 .5 1.0E-8 1000000000
  63. dimensions 1px 2px
  64. # Not supported yet
  65. # strings: "Foo" "'Foo'" 'Foo' '"Foo"' "Foo 'bar'"
  66. # mixed: "foo" 2 "bar" 4.0
  67. # Strings can span over multiple lines by ending with a \
  68. strings_multiline
  69. string1: "Line 1\nLine 2\nLine 3"
  70. string2: "a" \
  71. "b" \
  72. "c"
  73. string3: 'A' \
  74. 'B'
  75. string4: 'Line 1\n' \
  76. 'Line 2\n'\
  77. 'Line 3\n'
  78. subgroup: first: "Foo", second: "A" \
  79. "B"
  80. string5: "The last string"
  81. comments_and_space
  82. # Testing indented comments
  83. one 1
  84. # There was a empty line before this line
  85. two 2
  86. # There was some dangling space before this line
  87. three 3
  88. include_file
  89. file1
  90. @file test_tb_parser_included.tb.txt
  91. file2
  92. @file: "test_tb_parser_included.tb.txt"
  93. # Include a file with some definitions referenced below, as an example
  94. # of how to use f.ex a style file.
  95. @file test_tb_parser_definitions.tb.txt
  96. include_branch
  97. # include the branch styles>Pretty that was included above.
  98. test1
  99. @include styles>Chocolate
  100. test2: @include: "styles>Vanilla"
  101. # It's also possible to include from named node trees, using "@treename>noderequest"
  102. conditions
  103. @if 1
  104. value 42
  105. @else
  106. value 43
  107. # It's also possible to check condition from named node trees, using "@if @treename>noderequest"