1 #ifndef SCANSCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
2 #define SCANSCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
4 #if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
15 enum CHOMP
{ STRIP
= -1, CLIP
, KEEP
};
16 enum ACTION
{ NONE
, BREAK
, THROW
};
17 enum FOLD
{ DONT_FOLD
, FOLD_BLOCK
, FOLD_FLOW
};
19 struct ScanScalarParams
{
20 ScanScalarParams(): eatEnd(false), indent(0), detectIndent(false), eatLeadingWhitespace(0), escape(0), fold(DONT_FOLD
),
21 trimTrailingSpaces(0), chomp(CLIP
), onDocIndicator(NONE
), onTabInIndentation(NONE
), leadingSpaces(false) {}
24 RegEx end
; // what condition ends this scalar?
25 bool eatEnd
; // should we eat that condition when we see it?
26 int indent
; // what level of indentation should be eaten and ignored?
27 bool detectIndent
; // should we try to autodetect the indent?
28 bool eatLeadingWhitespace
; // should we continue eating this delicious indentation after 'indent' spaces?
29 char escape
; // what character do we escape on (i.e., slash or single quote) (0 for none)
30 FOLD fold
; // how do we fold line ends?
31 bool trimTrailingSpaces
; // do we remove all trailing spaces (at the very end)
32 CHOMP chomp
; // do we strip, clip, or keep trailing newlines (at the very end)
33 // Note: strip means kill all, clip means keep at most one, keep means keep all
34 ACTION onDocIndicator
; // what do we do if we see a document indicator?
35 ACTION onTabInIndentation
; // what do we do if we see a tab where we should be seeing indentation spaces
41 std::string
ScanScalar(Stream
& INPUT
, ScanScalarParams
& info
);
44 #endif // SCANSCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66