Skip to content
Jimmy Cushnie edited this page Nov 12, 2019 · 8 revisions

Base types are the building blocks of SUCC data. Each base type has rules for turning it into text and back into data. They can appear as standalone pieces of data, in collections, and as elements in complex types.

This article covers the rules for all the built-in base types. If you want to add your own base type, see Adding Custom Base Types.

String

A string is a piece of text. Strings in SUCC are interpreted fairly literally, where the interpreted string is the same as the value of the data line. The exception is that if a value's first and last character are both ", the first and last character are trimmed from the string. This allows you to save strings that have leading or trailing spaces, since those would otherwise be trimmed when interpreting what the value of the data line is.

# These two values are interpreted exactly the same by SUCC.
string1: Hello World
string2: "Hello World"

You can make strings always get quoted with FileStyle.AlwaysQuoteStrings

If a string contains newlines, it is serialized in a special way: the data line's value is set to """, each line of the string is made a child data line, and one final data line is added with the value """.

Verse1: """
    Once upon a midnight dreary, while I pondered weak and weary,
    Over many a quaint and curious volume of forgotten lore,            # snap snap snap
    While I nodded, nearly napping, suddenly there came a tapping,
    As of some one gently rapping, rapping at my chamber door.
    "Tis some visitor," I muttered, "tapping at my chamber door -
    Only this, and nothing more."
    """

If one line of a multi-line string contains leading or trailing spaces, that line can be individually encased in "s just like a single-line string, and the "s will be trimmed when interpreting the string.

Remember when working with SUCC strings that the # character is serialized as \#. See Data Line Comments for more details.

Integer Types

Integers are whole numbers. There are several C# integer types:

SUCC saves them using the digits 0-9, optionally preceded by the - character to indicate a negative number.

IntList:
    - 1
    - 0
    - -22
    - 69
    - -69
    - 696969

Floating-Point Types

Floating point types are numbers which can have a decimal place in them. There are several C# floating point types:

They consist of two parts: an integer part, which follows the rules described above, and an optional subsequent fractional part, which consists of a decimal place . character followed by more digits:

FloatList:
    - 1.0
    - -2.7
    - 3333333333333333.33333

Rational floats can be written using the / divisor sign, with one float on each side:

RationalFloatList:
	- 1/3
	- 7/4
	- 22 / 7 # whitespace on either side of the divisor is ignored

Floats also have a few special values:

  • infinity is infinity
  • -infinity is negative infinity
  • nan is the Not a Number value

None of those values are case sensitive.

Note that SUCC does NOT save scientific notation (i.e. it will save 0.0000001 instead of 1E-07).

Boolean

A boolean value of true can be represented in SUCC as true, on, yes, or y. A boolean value of false can be represented as false, off, no, or n. None of these values are case sensitive.

SUCC is Good: true
Easy Save is Good: NO #dab
Goteem: yes

You can choose which way to save bools with FileStyle.BoolStyle

DateTime

DateTime values are represented in SUCC with the format yyyy-MM-dd HH:mm:ss. SUCC uses 24 hour time. SUCC DateTimes have only seconds precision. It is up to your program whether to interpret a DateTime as UTC or in a local timezone; that information is not serialized.

DateTimeList:
    - 2000-07-21 00:00:00
    - 2018-09-22 11:33:00
    - 2019-02-21 22:41:03

Enums

SUCC represents enums as either the name of that element (without any information about any namespaces or classes that enum type belongs to) or the number representing that enum.

enum Instruments
{
    piano,
    guitar,
    drums,
}
# The following two lists of instruments will parse exactly the same.
Instruments:
    - guitar
    - guitar
    - piano
    
Instruments2:
    - 1
    - 1
    - 0

You can force SUCC to always save enums as numbers, rather than names, with FileStyle.EnumStyle