BIND 10 trac2375, updated. 8a5338e994c6509c38fb024f1212e629b334c9b4 [2375] getNextToken() and ungetNextToken() interface.

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Nov 12 17:18:22 UTC 2012


The branch, trac2375 has been updated
       via  8a5338e994c6509c38fb024f1212e629b334c9b4 (commit)
      from  6d1bc86b2cb43819564cf936290f514b6d4e42bf (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8a5338e994c6509c38fb024f1212e629b334c9b4
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Nov 12 18:14:46 2012 +0100

    [2375] getNextToken() and ungetNextToken() interface.
    
    With doxygen description of what it should do and empty method bodies,
    so the tests in following commits will at least compile.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dns/master_lexer.cc |   11 +++++++++++
 src/lib/dns/master_lexer.h  |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/master_lexer.cc b/src/lib/dns/master_lexer.cc
index d5da077..f4ded23 100644
--- a/src/lib/dns/master_lexer.cc
+++ b/src/lib/dns/master_lexer.cc
@@ -123,6 +123,17 @@ MasterLexer::getSourceLine() const {
     return (impl_->sources_.back()->getCurrentLine());
 }
 
+MasterLexer::Token
+MasterLexer::getNextToken(Options) {
+    // TODO load the token
+    return (impl_->token_);
+}
+
+void
+MasterLexer::ungetToken() {
+    // TODO
+}
+
 namespace {
 const char* const error_text[] = {
     "lexer not started",        // NOT_STARTED
diff --git a/src/lib/dns/master_lexer.h b/src/lib/dns/master_lexer.h
index 48ba919..54beb0f 100644
--- a/src/lib/dns/master_lexer.h
+++ b/src/lib/dns/master_lexer.h
@@ -147,6 +147,41 @@ public:
     /// \return The current line number of the source (see the description)
     size_t getSourceLine() const;
 
+    /// \brief Parse and return another token from the input.
+    ///
+    /// It reads a bit of the last opened source and produces another token
+    /// found in it.
+    ///
+    /// \param options The options can be used to modify the tokenization.
+    ///     The method can be made reporting things which are usually ignored
+    ///     by this parameter. Multiple options can be passed at once by
+    ///     bitwise or (eg. option1 | option 2). See description of available
+    ///     options.
+    /// \return Next token found in the input.
+    /// \throw isc::InvalidOperation in case the source is not available. This
+    ///     may mean the pushSource() has not been called yet, or that the
+    ///     current source has been read past the end.
+    /// \throw std::bad_alloc in case allocation of some internal resources
+    ///     or the token fail.
+    Token getNextToken(Options options = NONE);
+
+    /// \brief Return the last token back to the lexer.
+    ///
+    /// The method undoes the lasts call to getNextToken(). If you call the
+    /// getNextToken() again with the same options, it'll return the same
+    /// token. If the options are different, it may return a different token,
+    /// but it acts as if the previous getNextToken() was never called.
+    ///
+    /// It is possible to return only one token back in time (you can't call
+    /// ungetToken() twice in a row without calling getNextToken() in between
+    /// successfully).
+    ///
+    /// It does not work after change of source (by pushSource or popSource).
+    ///
+    /// \throw isc::InvalidOperation If called second time in a row or if
+    ///     getNextToken() was not called since the last change of the source.
+    void ungetToken();
+
 private:
     struct MasterLexerImpl;
     MasterLexerImpl* impl_;



More information about the bind10-changes mailing list