~ubuntu-branches/ubuntu/utopic/mongodb/utopic

« back to all changes in this revision

Viewing changes to src/third_party/yaml-cpp-0.5.1/src/scantag.cpp

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-07-03 09:23:46 UTC
  • mfrom: (1.3.10) (44.1.14 sid)
  • Revision ID: package-import@ubuntu.com-20140703092346-c5bvt46wnzougyly
Tags: 1:2.6.3-0ubuntu1
* New upstream stable release:
  - Dropped patches, included upstream:
    + 0003-All-platforms-but-Windows-find-hash-in-std-tr1.patch
    + 0008-Use-system-libstemmer.patch
    + 0011-Use-a-signed-char-to-store-BSONType-enumerations.patch
    + 0001-SERVER-12064-Atomic-operations-for-gcc-non-Intel-arc.patch
    + 0002-SERVER-12065-Support-ARM-and-AArch64-builds.patch
  - d/p/*: Refreshed/rebased remaining patches.
  - Use system provided libyaml-cpp:
    + d/control: Add libyaml-cpp-dev to BD's.
    + d/rules: Enable --with-system-yaml option.
    + d/p/fix-yaml-detection.patch: Fix detection of libyaml-cpp library.
  - d/mongodb-server.mongodb.upstart: Sync changes from upstream.
  - d/control,mongodb-dev.*: Drop mongodb-dev package; it has no reverse
    dependencies and upstream no longer install header files.
  - d/NEWS: Point users to upstream upgrade documentation for upgrades
    from 2.4 to 2.6.
* Merge from Debian unstable.
* d/control: BD on libv8-3.14-dev to ensure that transitioning to new v8
  versions is a explicit action due to changes in behaviour in >= 3.25
  (LP: #1295723).
* d/mongodb-server.prerm: Dropped debug echo call from maintainer script
  (LP: #1294455).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "scanner.h"
 
2
#include "regex.h"
 
3
#include "exp.h"
 
4
#include "yaml-cpp/exceptions.h"
 
5
 
 
6
namespace YAML
 
7
{
 
8
        const std::string ScanVerbatimTag(Stream& INPUT)
 
9
        {
 
10
                std::string tag;
 
11
                
 
12
                // eat the start character
 
13
                INPUT.get();
 
14
                
 
15
                while(INPUT) {
 
16
                        if(INPUT.peek() == Keys::VerbatimTagEnd) {
 
17
                                // eat the end character
 
18
                                INPUT.get();
 
19
                                return tag;
 
20
                        }
 
21
                
 
22
                        int n = Exp::URI().Match(INPUT);
 
23
                        if(n <= 0)
 
24
                                break;
 
25
                        
 
26
                        tag += INPUT.get(n);
 
27
                }
 
28
 
 
29
                throw ParserException(INPUT.mark(), ErrorMsg::END_OF_VERBATIM_TAG);
 
30
        }
 
31
        
 
32
        const std::string ScanTagHandle(Stream& INPUT, bool& canBeHandle)
 
33
        {
 
34
                std::string tag;
 
35
                canBeHandle = true;
 
36
                Mark firstNonWordChar;
 
37
                
 
38
                while(INPUT) {
 
39
                        if(INPUT.peek() == Keys::Tag) {
 
40
                                if(!canBeHandle)
 
41
                                        throw ParserException(firstNonWordChar, ErrorMsg::CHAR_IN_TAG_HANDLE);
 
42
                                break;
 
43
                        }
 
44
 
 
45
                        int n = 0;
 
46
                        if(canBeHandle) {
 
47
                                n = Exp::Word().Match(INPUT);
 
48
                                if(n <= 0) {
 
49
                                        canBeHandle = false;
 
50
                                        firstNonWordChar = INPUT.mark();
 
51
                                }
 
52
                        }
 
53
                        
 
54
                        if(!canBeHandle)
 
55
                                n = Exp::Tag().Match(INPUT);
 
56
 
 
57
                        if(n <= 0)
 
58
                                break;
 
59
                        
 
60
                        tag += INPUT.get(n);
 
61
                }
 
62
 
 
63
                return tag;
 
64
        }
 
65
        
 
66
        const std::string ScanTagSuffix(Stream& INPUT)
 
67
        {
 
68
                std::string tag;
 
69
                
 
70
                while(INPUT) {
 
71
                        int n = Exp::Tag().Match(INPUT);
 
72
                        if(n <= 0)
 
73
                                break;
 
74
                        
 
75
                        tag += INPUT.get(n);
 
76
                }
 
77
                
 
78
                if(tag.empty())
 
79
                        throw ParserException(INPUT.mark(), ErrorMsg::TAG_WITH_NO_SUFFIX);
 
80
                
 
81
                return tag;
 
82
        }
 
83
}
 
84