class
GUIStyleSheetParser
Parses a GUI style sheet source file and outputs a GUIStyleSheet.
Public
Constructors
GUIStyleSheetParser
Methods
Parse
Attempts to parse the provided style sheet file and outputs the parsed style sheet, if successful.
GetErrors
Returns errors in case parsing failed.
GetWarnings
Returns any warnings generated during the parse process.
Private
Methods
TryParseIntegerLiteral
Attempts to parse the next token as an integer literal.
Integer literal is detected as a set of digits with no decimal point or suffix. If successful, returns true and outputs the parsed value.
TryParseIntegerLiteral
Attempts to parse the next token as an integer literal.
Integer literal is detected as a set of digits with no decimal point or suffix. If successful, returns true and outputs the parsed value.
TryParsePixelLiteral
Attempts to parse the next token as a pixel literal.
Pixel literal is detected as a set of digits with no decimal point with 'px' suffix. If successful, returns true and outputs the parsed value.
TryParsePixelLiteral
Attempts to parse the next token as a pixel literal.
Pixel literal is detected as a set of digits with no decimal point with 'px' suffix. If successful, returns true and outputs the parsed value.
TryParseDecimalLiteral
Attempts to parse the next token as a decimal literal.
Decimal literal is detected as a set of digits with an optional decimal point. If successful, returns true and outputs the parsed value.
TryParsePercentLiteral
Attempts to parse the next token as a percent literal.
Percent literal is detected as a set of digits with an optional decimal point, with a '%' suffix. If successful, returns true and outputs the parsed value.
TryParseStringLiteral
Attempts to parse the next token as a string literal.
String literal is detected as a pair of '"', with an optional text in-between. If successful, returns true and outputs the parsed value.
TryParseElementSelector
Attempts to parse the next token as an element selector.
If successful, returns true and outputs the parsed value.
TryParseNone
Attempts to parse the next token as 'none' token and returns true if successful.
TryParseColor
Attempts to parse the next token (or set of tokens) as a color.
Can be a hex color (#FFFFFF, rgb(), hsl(), rgba() or hsla() construct). If successful, returns true and outputs the parsed value.
TryParseURL
Attempts to parse the next tokens as url("some-url").
If successful, returns true and outputs the parsed value.
TryParseIcon
Attempts to parse the next tokens as icon(icon-name, icon-size).
If successful, returns true and outputs the parsed value.
TryParseImage
Attempts to parse the next token as an image based on provided path or icon name.
If successful, returns true and outputs the parsed value.
TryParseFont
Attempts to parse the next token as an image loaded from the resource system based on provided font name.
If successful, returns true and outputs the parsed value.
TryParseRectOffset
TryParseBorderStyle
Attempts to parse the next token as a border style.
Token must be one of supported border style identifiers. If successful, returns true and outputs the parsed value.
TryParseBorderStyle
TryParseBorderWidth
TryParseBorderColor
TryParseTextAlign
Attempts to parse the next token as a text alignment style.
Token must be one of supported text alignment identifiers. If successful, returns true and outputs the parsed value.
TryParseVerticalAlign
Attempts to parse the next token as a vertical alignment style.
Token must be one of supported vertical alignment identifiers. If successful, returns true and outputs the parsed value.
TryParseWordWrapMode
Attempts to parse the next token as a word wrap mode.
Token must be one of supported word wrap mode identifiers. If successful, returns true and outputs the parsed value.
TryParseVisibility
Attempts to parse the next token as a visibility mode.
Token must be one of supported visibility mode identifiers. If successful, returns true and outputs the parsed value.
TryParseBorderElement
Attempts to parse the next 1 to 3 tokens as style, width and color for the border.
Tokens may be provided in any order, but cannot be duplicated. If successful, returns true and outputs the parsed value.
TryParseBorderRadius
Attempts to parse the next set of 1 to 4 tokens as colors for each corner.
If successful, returns true and outputs the parsed values.
If one value is parsed, all corners are assigned the parsed value. If two values are parsed, first value is assigned to top-left/bottom-right and second value to bottom-left/top-right corners. If three values are parsed, first value is assigned to top-left, second value to bottom-left/top-right, and third value to bottom-right corner. If four values are parsed, first value is assigned to top-left, second value to top-right, third value to bottom-right, and fourth value to bottom-left corner.
TryParseAndLookupVariableValue
Attempts to parse the variable value of the specified type.
Internally redirects to the correct parsing method depending on the value type.
- expectedType
- Variable type to parse.
- outValue
- Output value.
Returns: True if parsing is successful, false otherwise.
TryParseProperty
Attempts to parse a property and its value.
If successful, returns true and writes the property data in the provided data structure.
TryParseVariable
Attempts to parse a variable declaration and its value.
If successful, returns true and appends (or overwrites) the variable in the provided context.
TryParseRuleset
Attempts to parse all properties and/or variable declarations in a particular ruleset.
If successful returns true and the rule information is added to the local ruleset array.
TryParseSelectorList
Parses all selectors and generates a selector list, if any are provided.
TryParseAndLookupVariableValue
TryParseAndLookupVariableValue
TryParseAndLookupVariableValue
TryParseInteger
Attempts to parse an integer from the provided string.
Returns true if successful, and outputs the parsed integer.
TryParseFloat
Attempts to parse a float from the provided string.
Returns true if successful, and outputs the parsed float.
TryParseHexColor
Attempts to parse a color from the provided hex string (e. #FFFFFF or #FFFFFFAA).
Returns true if successful, and outputs the parsed color.
IsCurrentToken
Returns true if the current token is of the specified type.
IsCurrentToken
Returns true if the current token is of the specified type and has the provided spelling.
GetCurrentTokenType
Returns the type of the current token.
GetCurrentToken
Returns the current token.
GetCurrentTokenAndAdvance
Returns the current token and advances to the next token.
GetCurrentTokenAndAdvance
Returns the current token if it matches the provided type, and advances to the next token.
If the type is not matching and error is logged and null is returned.
GetCurrentTokenAndAdvance
Returns the current token if it matches the provided type and spelling, and advances to the next token.
If the type or spelling is not matching and error is logged and null is returned.
SkipToken
Skips the current token if it matches the provided type.
Warning
Records a warning message.
Error
Records an error message and returns null.
ErrorUnexpected
Records an error message that the current token is unexpected and returns null.
ErrorUnexpected
Records an error message that the current token doesn't match and returns null.
ErrorUnexpected
Records an error message that the current token doesn't match and returns null.
staticValueTypeToString
Converts property value type into a human readable string.