Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

open-axiom repository from github

24005 views
1
// -*- C++ -*-
2
// Copyright (C) 2013, Gabriel Dos Reis.
3
// All rights reserved.
4
// Written by Gabriel Dos Reis.
5
//
6
// Redistribution and use in source and binary forms, with or without
7
// modification, are permitted provided that the following conditions are
8
// met:
9
//
10
// - Redistributions of source code must retain the above copyright
11
// notice, this list of conditions and the following disclaimer.
12
//
13
// - Redistributions in binary form must reproduce the above copyright
14
// notice, this list of conditions and the following disclaimer in
15
// the documentation and/or other materials provided with the
16
// distribution.
17
//
18
// - Neither the name of OpenAxiom, nor the names of its contributors may
19
// be used to endorse or promote products derived from this software
20
// without specific prior written permission.
21
//
22
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
23
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24
// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
25
// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
26
// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34
#include <open-axiom/Input>
35
36
namespace OpenAxiom {
37
// -- Input::NonEmptyText --
38
Input::NonEmptyLine::NonEmptyLine(Ordinal n, const Text& t)
39
: structure::binary<Ordinal, Text>(n, t)
40
{ }
41
42
// -- Input::Line --
43
const Input::NonEmptyLine&
44
Input::Line::get() const {
45
return source()->at(index());
46
}
47
48
// -- Input::Source --
49
Input::Line
50
Input::Source::line(LineNumber n, const Text& t) {
51
Index idx = size();
52
emplace_back(n, t);
53
return { this, idx };
54
}
55
}
56
57