btool
A parser/converter/transpiler for .bib files
StyleParserState.cpp
Go to the documentation of this file.
1
#include <
StyleParserState.hpp
>
2
#include <boost/algorithm/string.hpp>
3
#include <
IdentifierParserState.hpp
>
4
#include <string>
5
#include <cctype>
6
7
using namespace
std::literals::string_literals;
8
14
StyleParserState::StyleParserState
(
ParserContext
&context, std::vector<BibElement> &result) noexcept
15
:
AbstractParserState
{context, result} {}
16
23
auto
StyleParserState::handleCharacter
(
const
char
c) ->
ParserState
* {
24
if
(c ==
'{'
) {
25
if
(style.empty()) {
26
fail(
"Style-Name must not be empty"
s);
27
}
else
{
28
result.push_back({
""
, boost::trim_copy(style), {}});
29
const
auto
identifierState =
new
IdentifierParserState
{context, result};
30
delete
this
;
31
return
identifierState;
32
}
33
}
else
if
(std::isgraph(c)) {
34
style += c;
35
return
this
;
36
}
else
{
37
fail(
"Invalid Character in Style-Name, got so far: ["
s + style +
"]"
s);
38
}
39
}
StyleParserState::handleCharacter
auto handleCharacter(char c) -> ParserState *override
Definition:
StyleParserState.cpp:23
ParserState
Definition:
ParserState.hpp:7
AbstractParserState
Definition:
AbstractParserState.hpp:13
ParserContext
Definition:
ParserContext.hpp:10
IdentifierParserState
Identifier Parser State.
Definition:
IdentifierParserState.hpp:14
StyleParserState.hpp
StyleParserState::StyleParserState
StyleParserState(ParserContext &context, std::vector< BibElement > &result) noexcept
Definition:
StyleParserState.cpp:14
IdentifierParserState.hpp
src
StyleParserState.cpp
Generated by
1.8.19