CBMC
format_specifier.cpp File Reference

Format specifiers for String.format. More...

#include "format_specifier.h"
#include <regex>
+ Include dependency graph for format_specifier.cpp:

Go to the source code of this file.

Functions

static format_specifiert format_specifier_of_match (std::smatch &m)
 Helper function for parsing format strings. More...
 
std::vector< format_elementtparse_format_string (std::string s)
 Regexp is taken directly from openJDK implementation: http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/9b8c96f96a0f/src/share/classes/java/util/Formatter.java#l2506. More...
 

Detailed Description

Format specifiers for String.format.

Definition in file format_specifier.cpp.

Function Documentation

◆ format_specifier_of_match()

static format_specifiert format_specifier_of_match ( std::smatch &  m)
static

Helper function for parsing format strings.

This follows the implementation in openJDK of the java.util.Formatter class: http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/9b8c96f96a0f/src/share/classes/java/util/Formatter.java#l2660

Parameters
ma match in a regular expression
Returns
Format specifier represented by the matched string. The groups in the match should represent: index, flag, width, precision, date and conversion type.

Definition at line 24 of file format_specifier.cpp.

◆ parse_format_string()

std::vector<format_elementt> parse_format_string ( std::string  s)

Regexp is taken directly from openJDK implementation: http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/9b8c96f96a0f/src/share/classes/java/util/Formatter.java#l2506.

Parse the given string into format specifiers and text.

Definition at line 48 of file format_specifier.cpp.