ANTLR Support Libraries 2.7.1+
Functions
ANTLRUtil.cpp File Reference
#include <antlr/config.hpp>
#include <antlr/IOException.hpp>
#include <iostream>
#include <cctype>
#include <string>
Include dependency graph for ANTLRUtil.cpp:

Functions

std ::istream & eatwhite (std ::istream &is)
 
std ::string read_string (std ::istream &in)
 
std ::string read_identifier (std ::istream &in)
 
void read_AttributeNValue (std ::istream &in, std ::string &attribute, std ::string &value)
 

Function Documentation

◆ eatwhite()

std ::istream& eatwhite ( std ::istream &  is)

Eat whitespace from the input stream

Parameters
isthe stream to read from

◆ read_AttributeNValue()

void read_AttributeNValue ( std ::istream &  in,
std ::string &  attribute,
std ::string &  value 
)

Read a attribute="value" thing. Leading whitespace is skipped. Between attribute and '=' no whitespace is allowed. After the '=' it is permitted.

Parameters
inthe istream to read from.
attributestring the attribute name is put in
valuestring the value of the attribute is put in
Exceptions
IOExceptionif something is fishy. E.g. malformed quoting or missing '='

◆ read_identifier()

std ::string read_identifier ( std ::istream &  in)

◆ read_string()

std ::string read_string ( std ::istream &  in)

Read a string enclosed by '"' from a stream. Also handles escaping of ". Skips leading whitespace.

Parameters
inthe istream to read from.
Returns
the string read from file exclusive the '"'
Exceptions
IOExceptionif string is badly formatted