Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-05-12 09:08:10

0001 #ifndef SCANSCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
0002 #define SCANSCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
0003 
0004 #if defined(_MSC_VER) ||                                            \
0005     (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
0006      (__GNUC__ >= 4))  // GCC supports "pragma once" correctly since 3.4
0007 #pragma once
0008 #endif
0009 
0010 #include <string>
0011 
0012 #include "regex_yaml.h"
0013 #include "stream.h"
0014 
0015 namespace SHERPA_YAML {
0016 enum CHOMP { STRIP = -1, CLIP, KEEP };
0017 enum ACTION { NONE, BREAK, THROW };
0018 enum FOLD { DONT_FOLD, FOLD_BLOCK, FOLD_FLOW };
0019 
0020 struct ScanScalarParams {
0021   ScanScalarParams()
0022       : end(nullptr),
0023         eatEnd(false),
0024         indent(0),
0025         detectIndent(false),
0026         eatLeadingWhitespace(0),
0027         escape(0),
0028         fold(DONT_FOLD),
0029         trimTrailingSpaces(0),
0030         chomp(CLIP),
0031         onDocIndicator(NONE),
0032         onTabInIndentation(NONE),
0033         leadingSpaces(false) {}
0034 
0035   // input:
0036   const RegEx* end;   // what condition ends this scalar?
0037                       // unowned.
0038   bool eatEnd;        // should we eat that condition when we see it?
0039   int indent;         // what level of indentation should be eaten and ignored?
0040   bool detectIndent;  // should we try to autodetect the indent?
0041   bool eatLeadingWhitespace;  // should we continue eating this delicious
0042                               // indentation after 'indent' spaces?
0043   char escape;  // what character do we escape on (i.e., slash or single quote)
0044                 // (0 for none)
0045   FOLD fold;    // how do we fold line ends?
0046   bool trimTrailingSpaces;  // do we remove all trailing spaces (at the very
0047                             // end)
0048   CHOMP chomp;  // do we strip, clip, or keep trailing newlines (at the very
0049                 // end)
0050   //   Note: strip means kill all, clip means keep at most one, keep means keep
0051   // all
0052   ACTION onDocIndicator;      // what do we do if we see a document indicator?
0053   ACTION onTabInIndentation;  // what do we do if we see a tab where we should
0054                               // be seeing indentation spaces
0055 
0056   // output:
0057   bool leadingSpaces;
0058 };
0059 
0060 std::string ScanScalar(Stream& INPUT, ScanScalarParams& params);
0061 }
0062 
0063 #endif  // SCANSCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66