~ubuntu-branches/ubuntu/oneiric/kdesdk/oneiric-updates

« back to all changes in this revision

Viewing changes to poxml/antlr/antlr/InputBuffer.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Debian Qt/KDE Maintainers, Modestas Vainius, George Kiagiadakis, José Manuel Santamaría Lema, Pino Toscano
  • Date: 2011-04-27 12:23:44 UTC
  • mfrom: (1.1.58 upstream) (0.5.7 squeeze)
  • mto: (0.5.8 sid)
  • mto: This revision was merged to the branch mainline in revision 120.
  • Revision ID: james.westby@ubuntu.com-20110427122344-t9d1jf4lfnrl6hyv
Tags: 4:4.6.2-1
* New upstream release:
  - fixes plugin loading in kate sessions (Closes: #525853)
  - updates kate man page with respect to instance creation defaults
    (Closes: #598443)
  - fixes cursor position with static word-wrap in Kate (Closes: #570409)
  - xml2pot creates .pot files with the correct mimetype (Closes: #326060)
* Update installed files.
* Update lintian overrides.

[ Modestas Vainius ]
* Point debian/control Vcs fields to the new Git repository.
* Strip sequence numbers from debian/patches.
* Strip trailing whitespace in debian/copyright.
* Add kdeutils-dbg (<< 4:4.6) to kdesdk-dbg Breaks/Replaces (due to moved
  okteta).
* Add ${perl:Depends} to Depends of cervisia and kdesdk-kio-plugins.

[ George Kiagiadakis ]
* Add myself to uploaders.
* Refresh patch 02_append_kde.diff.
* Drop patch 03_kmtrace_compile.diff; fixed upstream in a better way.
* Add libkonq5-dev, libantlr-dev and antlr to build depends.
  (Closes: #505425)
* Bump kdepimlibs5-dev build dependency to version 4:4.6.
* Add new package: kdesdk-dolphin-plugins.

[ José Manuel Santamaría Lema ]
* Remove package kbugbuster.
* Enable DebianABIManager:
  - include DebianABIManager.cmake at the bottom of the main CMakeLists.txt
    (patch enable_debianabimanager.diff).
  - debian/control: managing all non-local unstable-BC libraries.
* Add packages for okteta:
  - okteta
  - okteta-dev
  - libkastencontrollers4
  - libkastencore4
  - libkastengui4
  - liboktetacore4
  - liboktetagui4
  - liboktetakastencontrollers4
  - liboktetakastencore4
  - liboktetakastengui4
* Add symbols files for new library packages.
* Bump kde-sc-dev-latest build dependency to 4:4.6.2.
* Bump pkg-kde-tools build dependency to 0.12.
* Switch debian/rules engine to dhmk based qt-kde-team/2/*
  - and remove cdbs from Build-Depends.
* Bump S-V to 3.9.1; update Replaces/Breaks/Conflicts.
* Add myself to Uploaders.

[ Pino Toscano ]
* Add build dependency on libqca2-dev.
* Do not ship kdesrc-build with kdesdk-scripts, it is packaged separately.
* Small updates to descriptions.
* Clean up Replaces/Breaks from the pre-squeeze era whenever possible.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef INC_InputBuffer_hpp__
2
 
#define INC_InputBuffer_hpp__
3
 
 
4
 
/**
5
 
 * <b>SOFTWARE RIGHTS</b>
6
 
 * <p>
7
 
 * ANTLR 2.6.0 MageLang Insitute, 1999
8
 
 * <p>
9
 
 * We reserve no legal rights to the ANTLR--it is fully in the
10
 
 * public domain. An individual or company may do whatever
11
 
 * they wish with source code distributed with ANTLR or the
12
 
 * code generated by ANTLR, including the incorporation of
13
 
 * ANTLR, or its output, into commerical software.
14
 
 * <p>
15
 
 * We encourage users to develop software with ANTLR. However,
16
 
 * we do ask that credit is given to us for developing
17
 
 * ANTLR. By "credit", we mean that if you use ANTLR or
18
 
 * incorporate any source code into one of your programs
19
 
 * (commercial product, research project, or otherwise) that
20
 
 * you acknowledge this fact somewhere in the documentation,
21
 
 * research report, etc... If you like ANTLR and have
22
 
 * developed a nice tool with the output, please mention that
23
 
 * you developed it using ANTLR. In addition, we ask that the
24
 
 * headers remain intact in our source code. As long as these
25
 
 * guidelines are kept, we expect to continue enhancing this
26
 
 * system and expect to make other tools available as they are
27
 
 * completed.
28
 
 * <p>
29
 
 * The ANTLR gang:
30
 
 * @version ANTLR 2.6.0 MageLang Insitute, 1999
31
 
 * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
32
 
 * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
33
 
 * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
34
 
 */
35
 
 
36
 
/**A Stream of characters fed to the lexer from a InputStream that can
37
 
 * be rewound via mark()/rewind() methods.
38
 
 * <p>
39
 
 * A dynamic array is used to buffer up all the input characters.  Normally,
40
 
 * "k" characters are stored in the buffer.  More characters may be stored during
41
 
 * guess mode (testing syntactic predicate), or when LT(i>k) is referenced.
42
 
 * Consumption of characters is deferred.  In other words, reading the next
43
 
 * character is not done by conume(), but deferred until needed by LA or LT.
44
 
 * <p>
45
 
 *
46
 
 * @see antlr.CharQueue
47
 
 */
48
 
 
49
 
#include "antlr/config.hpp"
50
 
#include "antlr/antlr_export.h"
51
 
#include "antlr/CircularQueue.hpp"
52
 
#include <string>
53
 
 
54
 
ANTLR_BEGIN_NAMESPACE(antlr)
55
 
 
56
 
class ANTLR_EXPORT InputBuffer {
57
 
protected:
58
 
        // char source
59
 
        // leave to subclasses
60
 
 
61
 
        // Number of active markers
62
 
        int nMarkers; // = 0;
63
 
 
64
 
        // Additional offset used when markers are active
65
 
        int markerOffset; // = 0;
66
 
 
67
 
        // Number of calls to consume() since last LA() or LT() call
68
 
        int numToConsume; // = 0;
69
 
 
70
 
        // Circular queue
71
 
        CircularQueue<int> queue;
72
 
 
73
 
public:
74
 
        /** Create a character buffer */
75
 
        InputBuffer();
76
 
 
77
 
        virtual ~InputBuffer() {}
78
 
 
79
 
        /** This method updates the state of the input buffer so that
80
 
         *  the text matched since the most recent mark() is no longer
81
 
         *  held by the buffer.  So, you either do a mark/rewind for
82
 
         *  failed predicate or mark/commit to keep on parsing without
83
 
         *  rewinding the input.
84
 
         */
85
 
        void commit();
86
 
 
87
 
        /** Mark another character for deferred consumption */
88
 
        virtual void consume();
89
 
 
90
 
        /** Ensure that the character buffer is sufficiently full */
91
 
        virtual void fill(int amount);
92
 
 
93
 
        /** Override this in subclasses to get the next character */
94
 
        virtual int getChar()=0;
95
 
 
96
 
        ANTLR_USE_NAMESPACE(std)string getLAChars() const;
97
 
 
98
 
        ANTLR_USE_NAMESPACE(std)string getMarkedChars() const;
99
 
 
100
 
        virtual bool isMarked() const;
101
 
 
102
 
        /** Get a lookahead character */
103
 
        virtual int LA(int i);
104
 
 
105
 
        /**Return an integer marker that can be used to rewind the buffer to
106
 
         * its current state.
107
 
         */
108
 
        virtual int mark();
109
 
 
110
 
        /**Rewind the character buffer to a marker.
111
 
         * @param mark Marker returned previously from mark()
112
 
         */
113
 
        virtual void rewind(int mark);
114
 
 
115
 
protected:
116
 
        /** Sync up deferred consumption */
117
 
        void syncConsume();
118
 
 
119
 
private:
120
 
        InputBuffer(const InputBuffer& other);
121
 
        InputBuffer& operator=(const InputBuffer& other);
122
 
};
123
 
 
124
 
/** Sync up deferred consumption */
125
 
inline void InputBuffer::syncConsume() {
126
 
#ifdef OLD_CODE
127
 
        while (numToConsume > 0) {
128
 
                if (nMarkers > 0)
129
 
                {
130
 
                        // guess mode -- leave leading characters and bump offset.
131
 
                        markerOffset++;
132
 
                } else {
133
 
                        // normal mode -- remove first character
134
 
                        queue.removeFirst();
135
 
                }
136
 
                numToConsume--;
137
 
        }
138
 
#endif
139
 
 
140
 
        if (numToConsume > 0) {
141
 
                if (nMarkers > 0) {
142
 
                        markerOffset += numToConsume;
143
 
                } else {
144
 
                        queue.removeItems( numToConsume );
145
 
                }
146
 
                numToConsume = 0;
147
 
        }
148
 
}
149
 
 
150
 
/** Get a lookahead character */
151
 
inline int InputBuffer::LA(int i)
152
 
{
153
 
        fill(i);
154
 
        return queue.elementAt(markerOffset + i - 1);
155
 
}
156
 
 
157
 
ANTLR_END_NAMESPACE
158
 
 
159
 
#endif //INC_InputBuffer_hpp__