Dynalib Utils
Public Member Functions | List of all members
KAML::KAMLParser Class Reference

#include <KAMLParser.h>

Public Member Functions

 KAMLParser ()
 
virtual ~KAMLParser ()
 
TokenizergetTok ()
 
bool parseKaml (const String &buf, Node *rootNode)
 
bool parseBlock (Token &token, Node *parentNode, int parentIndent, int level)
 
bool parseTypeCast (Token &token)
 
void applyTypeCast (Node *valueNode)
 
bool parseBlockValue (Token &token, Node *parentNode, int level)
 parse the next value (scalar, list entry, or map entry) More...
 
bool parseFlowValue (Token &token, Node *parentNode)
 parse the next flow value (scalar, list entry, or map entry) More...
 
bool parseFlowList (Token &token, Node *parentNode)
 
bool parseFlowMap (Token &token, Node *parentNode)
 
bool parseScalar (Token &token, Node *scalarNode)
 
bool parseUnquotedString (Token &token, Node *scalarNode)
 parses an unquoted string into this node More...
 
bool parseFormattedString (Token &token, Node *scalarNode)
 parses a formatted string into this node More...
 

Constructor & Destructor Documentation

◆ KAMLParser()

KAML::KAMLParser::KAMLParser ( )

◆ ~KAMLParser()

KAML::KAMLParser::~KAMLParser ( )
virtual

Member Function Documentation

◆ applyTypeCast()

void KAML::KAMLParser::applyTypeCast ( Node valueNode)

◆ getTok()

Tokenizer * KAML::KAMLParser::getTok ( )

◆ parseBlock()

bool KAML::KAMLParser::parseBlock ( Token token,
Node parentNode,
int  parentIndent,
int  level 
)

test: "string" test: - "string"

  • "string" test:

key: 1 key2: 2 key3: 3

  • key: 1 key2: 2

test: // This is indented, so begins a new list as the map value

  • // This is indented, so begins a new map key: 1 key2: 2
  • key: 1 key2: 2

test: key: 1

  • A
  • B
  • - 1
    • 2
  • C

// The above parses as ["A", "B", [1, 2], "C"]

This call to parseBlock is for the purpose of starting a new list node, or the continuation of a parent list by adding sub-lists to it. When this call executes the called function will go to the parseBlock below, since the indent level will be zero.

This parseBlock will actually add new entries to the list node (parentNode), ultimately calling parseBlockValue.

skip CRLFs/Spaces then check for ":" to see if we have a map entry

◆ parseBlockValue()

bool KAML::KAMLParser::parseBlockValue ( Token token,
Node parentNode,
int  level 
)

parse the next value (scalar, list entry, or map entry)

Parameters
token
parentNodethis must be a list or map
Returns
parse result (true - parse was successful, false - parse failed)

◆ parseFlowList()

bool KAML::KAMLParser::parseFlowList ( Token token,
Node parentNode 
)

◆ parseFlowMap()

bool KAML::KAMLParser::parseFlowMap ( Token token,
Node parentNode 
)

◆ parseFlowValue()

bool KAML::KAMLParser::parseFlowValue ( Token token,
Node parentNode 
)

parse the next flow value (scalar, list entry, or map entry)

Parameters
token
parentNodethis must be a list or map
Returns
parse result (true - parse was successful, false - parse failed)

skip CRLFs/Spaces then check for ":" to see if we have a map entry

◆ parseFormattedString()

bool KAML::KAMLParser::parseFormattedString ( Token token,
Node scalarNode 
)

parses a formatted string into this node

Parameters
tokenthe token of the initial vertical bar
nodeholds the formatted string
Returns
bool

◆ parseKaml()

bool KAML::KAMLParser::parseKaml ( const String buf,
Node rootNode 
)

◆ parseScalar()

bool KAML::KAMLParser::parseScalar ( Token token,
Node scalarNode 
)

◆ parseTypeCast()

bool KAML::KAMLParser::parseTypeCast ( Token token)

◆ parseUnquotedString()

bool KAML::KAMLParser::parseUnquotedString ( Token token,
Node scalarNode 
)

parses an unquoted string into this node

Parameters
tokenthe first token of the unquoted string
nodeholds the unquoted string
Returns
bool

The documentation for this class was generated from the following files: