Constants

textparse_smc.inc

Everything below describes the SMC Parse, or "SourceMod Configuration" format. This parser is entirely event based. You must hook events to receive data. The file format itself is nearly identical to Valve's KeyValues format (also known as VDF).

The SMC file format is defined as: WHITESPACE: 0x20, \n, \t, \r IDENTIFIER: Any ASCII character EXCLUDING ", {, }, ;, //, / *, or WHITESPACE. STRING : Any set of symbols enclosed in quotes. Note: if a STRING does not have quotes, it is parsed as an IDENTIFIER. Basic syntax is comprised of SECTIONBLOCKs. A SECTIONBLOCK defined as: SECTIONNAME { OPTION } OPTION can be repeated any number of times inside a SECTIONBLOCK. A new line will terminate an OPTION, but there can be more than one OPTION per line. OPTION is defined any of: "KEY" "VALUE" SECTIONBLOCK SECTIONNAME, KEY, VALUE, and SINGLEKEY are strings SECTIONNAME cannot have trailing characters if quoted, but the quotes can be optionally removed. If SECTIONNAME is not enclosed in quotes, the entire sectionname string is used (minus surrounding whitespace). If KEY is not enclosed in quotes, the key is terminated at first whitespace. If VALUE is not properly enclosed in quotes, the entire value string is used (minus surrounding whitespace). The VALUE may have inner quotes, but the key string may not. For an example, see scripting/testsuite/textparse_test.cfg WHITESPACE should be ignored. Comments are text occurring inside the following tokens, and should be stripped unless they are inside literal strings: ;<TEXT> //<TEXT> / *<TEXT> * /

Parser invalid code.

SMCParser
enum SMCParser
{
	Invalid_SMCParser = 0
};

Parse result directive.

SMCResult
enum SMCResult
{
	SMCParse_Continue,          /* Continue parsing */
	SMCParse_Halt,              /* Stop parsing here */
	SMCParse_HaltFail           /* Stop parsing and return failure */
};

Parse error codes.

SMCError
enum SMCError
{
	SMCError_Okay = 0,          /* No error */
	SMCError_StreamOpen,        /* Stream failed to open */
	SMCError_StreamError,       /* The stream died... somehow */
	SMCError_Custom,            /* A custom handler threw an error */
	SMCError_InvalidSection1,   /* A section was declared without quotes, and had extra tokens */
	SMCError_InvalidSection2,   /* A section was declared without any header */
	SMCError_InvalidSection3,   /* A section ending was declared with too many unknown tokens */
	SMCError_InvalidSection4,   /* A section ending has no matching beginning */
	SMCError_InvalidSection5,   /* A section beginning has no matching ending */
	SMCError_InvalidTokens,     /* There were too many unidentifiable strings on one line */
	SMCError_TokenOverflow,     /* The token buffer overflowed */
	SMCError_InvalidProperty1,  /* A property was declared outside of any section */
};