diff --git a/src/include/ANTLRErrorListener.cpp b/src/include/ANTLRErrorListener.cpp
deleted file mode 100644
index 6ceadb87..00000000
--- a/src/include/ANTLRErrorListener.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
- * Use of this file is governed by the BSD 3-clause license that
- * can be found in the LICENSE.txt file in the project root.
- */
-
-#include "ANTLRErrorListener.h"
-
-antlr4::ANTLRErrorListener::~ANTLRErrorListener()
-{
-}
diff --git a/src/include/ANTLRErrorListener.h b/src/include/ANTLRErrorListener.h
deleted file mode 100755
index d6efad1d..00000000
--- a/src/include/ANTLRErrorListener.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
- * Use of this file is governed by the BSD 3-clause license that
- * can be found in the LICENSE.txt file in the project root.
- */
-
-#pragma once
-
-#include "RecognitionException.h"
-
-namespace antlrcpp {
- class BitSet;
-}
-
-namespace antlr4 {
-
- /// How to emit recognition errors (an interface in Java).
- class ANTLR4CPP_PUBLIC ANTLRErrorListener {
- public:
- virtual ~ANTLRErrorListener();
-
- ///
- /// Upon syntax error, notify any interested parties. This is not how to
- /// recover from errors or compute error messages.
- /// specifies how to recover from syntax errors and how to compute error
- /// messages. This listener's job is simply to emit a computed message,
- /// though it has enough information to create its own message in many cases.
- ///
- /// The is non-null for all syntax errors except
- /// when we discover mismatched token errors that we can recover from
- /// in-line, without returning from the surrounding rule (via the single
- /// token insertion and deletion mechanism).
- ///
- ///
- /// What parser got the error. From this
- /// object, you can access the context as well
- /// as the input stream.
- ///
- /// The offending token in the input token
- /// stream, unless recognizer is a lexer (then it's null). If
- /// no viable alternative error, {@code e} has token at which we
- /// started production for the decision.
- ///
- /// The line number in the input where the error occurred.
- ///
- /// The character position within that line where the error occurred.
- ///
- /// The message to emit.
- ///
- /// The exception generated by the parser that led to
- /// the reporting of an error. It is null in the case where
- /// the parser was able to recover in line without exiting the
- /// surrounding rule.
- virtual void syntaxError(Recognizer *recognizer, Token *offendingSymbol, size_t line,
- size_t charPositionInLine, const std::string &msg, std::exception_ptr e) = 0;
-
- /**
- * This method is called by the parser when a full-context prediction
- * results in an ambiguity.
- *
- *
Each full-context prediction which does not result in a syntax error
- * will call either {@link #reportContextSensitivity} or
- * {@link #reportAmbiguity}.
- *
- * When {@code ambigAlts} is not null, it contains the set of potentially
- * viable alternatives identified by the prediction algorithm. When
- * {@code ambigAlts} is null, use {@link ATNConfigSet#getAlts} to obtain the
- * represented alternatives from the {@code configs} argument.
- *
- * When {@code exact} is {@code true}, all of the potentially
- * viable alternatives are truly viable, i.e. this is reporting an exact
- * ambiguity. When {@code exact} is {@code false}, at least two of
- * the potentially viable alternatives are viable for the current input, but
- * the prediction algorithm terminated as soon as it determined that at
- * least the minimum potentially viable alternative is truly
- * viable.
- *
- * When the {@link PredictionMode#LL_EXACT_AMBIG_DETECTION} prediction
- * mode is used, the parser is required to identify exact ambiguities so
- * {@code exact} will always be {@code true}.
- *
- * This method is not used by lexers.
- *
- * @param recognizer the parser instance
- * @param dfa the DFA for the current decision
- * @param startIndex the input index where the decision started
- * @param stopIndex the input input where the ambiguity was identified
- * @param exact {@code true} if the ambiguity is exactly known, otherwise
- * {@code false}. This is always {@code true} when
- * {@link PredictionMode#LL_EXACT_AMBIG_DETECTION} is used.
- * @param ambigAlts the potentially ambiguous alternatives, or {@code null}
- * to indicate that the potentially ambiguous alternatives are the complete
- * set of represented alternatives in {@code configs}
- * @param configs the ATN configuration set where the ambiguity was
- * identified
- */
- virtual void reportAmbiguity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex, bool exact,
- const antlrcpp::BitSet &ambigAlts, atn::ATNConfigSet *configs) = 0;
-
- /**
- * This method is called when an SLL conflict occurs and the parser is about
- * to use the full context information to make an LL decision.
- *
- * If one or more configurations in {@code configs} contains a semantic
- * predicate, the predicates are evaluated before this method is called. The
- * subset of alternatives which are still viable after predicates are
- * evaluated is reported in {@code conflictingAlts}.
- *
- * This method is not used by lexers.
- *
- * @param recognizer the parser instance
- * @param dfa the DFA for the current decision
- * @param startIndex the input index where the decision started
- * @param stopIndex the input index where the SLL conflict occurred
- * @param conflictingAlts The specific conflicting alternatives. If this is
- * {@code null}, the conflicting alternatives are all alternatives
- * represented in {@code configs}. At the moment, conflictingAlts is non-null
- * (for the reference implementation, but Sam's optimized version can see this
- * as null).
- * @param configs the ATN configuration set where the SLL conflict was
- * detected
- */
- virtual void reportAttemptingFullContext(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex,
- const antlrcpp::BitSet &conflictingAlts, atn::ATNConfigSet *configs) = 0;
-
- /**
- * This method is called by the parser when a full-context prediction has a
- * unique result.
- *
- * Each full-context prediction which does not result in a syntax error
- * will call either {@link #reportContextSensitivity} or
- * {@link #reportAmbiguity}.
- *
- * For prediction implementations that only evaluate full-context
- * predictions when an SLL conflict is found (including the default
- * {@link ParserATNSimulator} implementation), this method reports cases
- * where SLL conflicts were resolved to unique full-context predictions,
- * i.e. the decision was context-sensitive. This report does not necessarily
- * indicate a problem, and it may appear even in completely unambiguous
- * grammars.
- *
- * {@code configs} may have more than one represented alternative if the
- * full-context prediction algorithm does not evaluate predicates before
- * beginning the full-context prediction. In all cases, the final prediction
- * is passed as the {@code prediction} argument.
- *
- * Note that the definition of "context sensitivity" in this method
- * differs from the concept in {@link DecisionInfo#contextSensitivities}.
- * This method reports all instances where an SLL conflict occurred but LL
- * parsing produced a unique result, whether or not that unique result
- * matches the minimum alternative in the SLL conflicting set.
- *
- * This method is not used by lexers.
- *
- * @param recognizer the parser instance
- * @param dfa the DFA for the current decision
- * @param startIndex the input index where the decision started
- * @param stopIndex the input index where the context sensitivity was
- * finally determined
- * @param prediction the unambiguous result of the full-context prediction
- * @param configs the ATN configuration set where the unambiguous prediction
- * was determined
- */
- virtual void reportContextSensitivity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex,
- size_t prediction, atn::ATNConfigSet *configs) = 0;
- };
-
-} // namespace antlr4
diff --git a/src/include/ANTLRErrorStrategy.cpp b/src/include/ANTLRErrorStrategy.cpp
deleted file mode 100644
index 1655a573..00000000
--- a/src/include/ANTLRErrorStrategy.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
- * Use of this file is governed by the BSD 3-clause license that
- * can be found in the LICENSE.txt file in the project root.
- */
-
-#include "ANTLRErrorStrategy.h"
-
-antlr4::ANTLRErrorStrategy::~ANTLRErrorStrategy()
-{
-}
diff --git a/src/include/ANTLRErrorStrategy.h b/src/include/ANTLRErrorStrategy.h
deleted file mode 100755
index a3eecd14..00000000
--- a/src/include/ANTLRErrorStrategy.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
- * Use of this file is governed by the BSD 3-clause license that
- * can be found in the LICENSE.txt file in the project root.
- */
-
-#pragma once
-
-#include "Token.h"
-
-namespace antlr4 {
-
- ///
- /// The interface for defining strategies to deal with syntax errors encountered
- /// during a parse by ANTLR-generated parsers. We distinguish between three
- /// different kinds of errors:
- ///
- ///
- /// - The parser could not figure out which path to take in the ATN (none of
- /// the available alternatives could possibly match)
- /// - The current input does not match what we were looking for
- /// - A predicate evaluated to false
- ///
- ///
- /// Implementations of this interface report syntax errors by calling
- /// .
- ///
- /// TODO: what to do about lexers
- ///
- class ANTLR4CPP_PUBLIC ANTLRErrorStrategy {
- public:
-
- ///
- /// Reset the error handler state for the specified {@code recognizer}.
- /// the parser instance
- virtual ~ANTLRErrorStrategy();
-
- virtual void reset(Parser *recognizer) = 0;
-
- /**
- * This method is called when an unexpected symbol is encountered during an
- * inline match operation, such as {@link Parser#match}. If the error
- * strategy successfully recovers from the match failure, this method
- * returns the {@link Token} instance which should be treated as the
- * successful result of the match.
- *
- * This method handles the consumption of any tokens - the caller should
- * not call {@link Parser#consume} after a successful recovery.
- *
- * Note that the calling code will not report an error if this method
- * returns successfully. The error strategy implementation is responsible
- * for calling {@link Parser#notifyErrorListeners} as appropriate.
- *
- * @param recognizer the parser instance
- * @throws RecognitionException if the error strategy was not able to
- * recover from the unexpected input symbol
- */
- virtual Token* recoverInline(Parser *recognizer) = 0;
-
- ///
- /// This method is called to recover from exception {@code e}. This method is
- /// called after by the default exception handler
- /// generated for a rule method.
- ///
- ///
- /// the parser instance
- /// the recognition exception to recover from
- /// if the error strategy could not recover from
- /// the recognition exception
- virtual void recover(Parser *recognizer, std::exception_ptr e) = 0;
-
- ///
- /// This method provides the error handler with an opportunity to handle
- /// syntactic or semantic errors in the input stream before they result in a
- /// .
- ///
- /// The generated code currently contains calls to after
- /// entering the decision state of a closure block ({@code (...)*} or
- /// {@code (...)+}).
- ///
- /// For an implementation based on Jim Idle's "magic sync" mechanism, see
- /// .
- ///
- ///
- /// the parser instance
- /// if an error is detected by the error
- /// strategy but cannot be automatically recovered at the current state in
- /// the parsing process
- virtual void sync(Parser *recognizer) = 0;
-
- ///
- /// Tests whether or not {@code recognizer} is in the process of recovering
- /// from an error. In error recovery mode, adds
- /// symbols to the parse tree by calling
- /// {@link Parser#createErrorNode(ParserRuleContext, Token)} then
- /// {@link ParserRuleContext#addErrorNode(ErrorNode)} instead of
- /// {@link Parser#createTerminalNode(ParserRuleContext, Token)}.
- ///
- /// the parser instance
- /// {@code true} if the parser is currently recovering from a parse
- /// error, otherwise {@code false}
- virtual bool inErrorRecoveryMode(Parser *recognizer) = 0;
-
- ///
- /// This method is called by when the parser successfully matches an input
- /// symbol.
- ///
- /// the parser instance
- virtual void reportMatch(Parser *recognizer) = 0;
-
- ///
- /// Report any kind of . This method is called by
- /// the default exception handler generated for a rule method.
- ///
- /// the parser instance
- /// the recognition exception to report
- virtual void reportError(Parser *recognizer, const RecognitionException &e) = 0;
- };
-
-} // namespace antlr4
diff --git a/src/include/ANTLRFileStream.cpp b/src/include/ANTLRFileStream.cpp
deleted file mode 100755
index 674817ac..00000000
--- a/src/include/ANTLRFileStream.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
- * Use of this file is governed by the BSD 3-clause license that
- * can be found in the LICENSE.txt file in the project root.
- */
-
-#include "ANTLRFileStream.h"
-
-using namespace antlr4;
-
-void ANTLRFileStream::loadFromFile(const std::string &fileName) {
- _fileName = fileName;
- if (_fileName.empty()) {
- return;
- }
-
- std::ifstream stream(fileName, std::ios::binary);
-
- ANTLRInputStream::load(stream);
-}
-
-std::string ANTLRFileStream::getSourceName() const {
- return _fileName;
-}
diff --git a/src/include/ANTLRFileStream.h b/src/include/ANTLRFileStream.h
deleted file mode 100755
index 6c7d619a..00000000
--- a/src/include/ANTLRFileStream.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
- * Use of this file is governed by the BSD 3-clause license that
- * can be found in the LICENSE.txt file in the project root.
- */
-
-#pragma once
-
-#include "ANTLRInputStream.h"
-
-namespace antlr4 {
-
- /// This is an ANTLRInputStream that is loaded from a file all at once
- /// when you construct the object (or call load()).
- // TODO: this class needs testing.
- class ANTLR4CPP_PUBLIC ANTLRFileStream : public ANTLRInputStream {
- public:
- ANTLRFileStream() = default;
- ANTLRFileStream(const std::string &) = delete;
- ANTLRFileStream(const char *data, size_t length) = delete;
- ANTLRFileStream(std::istream &stream) = delete;
-
- // Assumes a file name encoded in UTF-8 and file content in the same encoding (with or w/o BOM).
- virtual void loadFromFile(const std::string &fileName);
- virtual std::string getSourceName() const override;
-
- private:
- std::string _fileName; // UTF-8 encoded file name.
- };
-
-} // namespace antlr4
diff --git a/src/include/ANTLRInputStream.cpp b/src/include/ANTLRInputStream.cpp
deleted file mode 100755
index b6470af9..00000000
--- a/src/include/ANTLRInputStream.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
-/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
- * Use of this file is governed by the BSD 3-clause license that
- * can be found in the LICENSE.txt file in the project root.
- */
-
-#include
-
-#include "Exceptions.h"
-#include "misc/Interval.h"
-#include "IntStream.h"
-
-#include "support/Utf8.h"
-#include "support/CPPUtils.h"
-
-#include "ANTLRInputStream.h"
-
-using namespace antlr4;
-using namespace antlrcpp;
-
-using misc::Interval;
-
-ANTLRInputStream::ANTLRInputStream() {
- InitializeInstanceFields();
-}
-
-ANTLRInputStream::ANTLRInputStream(std::string_view input): ANTLRInputStream() {
- load(input.data(), input.length());
-}
-
-ANTLRInputStream::ANTLRInputStream(const char *data, size_t length) {
- load(data, length);
-}
-
-ANTLRInputStream::ANTLRInputStream(std::istream &stream): ANTLRInputStream() {
- load(stream);
-}
-
-void ANTLRInputStream::load(const std::string &input, bool lenient) {
- load(input.data(), input.size(), lenient);
-}
-
-void ANTLRInputStream::load(const char *data, size_t length, bool lenient) {
- // Remove the UTF-8 BOM if present.
- const char *bom = "\xef\xbb\xbf";
- if (length >= 3 && strncmp(data, bom, 3) == 0) {
- data += 3;
- length -= 3;
- }
- if (lenient) {
- _data = Utf8::lenientDecode(std::string_view(data, length));
- } else {
- auto maybe_utf32 = Utf8::strictDecode(std::string_view(data, length));
- if (!maybe_utf32.has_value()) {
- throw IllegalArgumentException("UTF-8 string contains an illegal byte sequence");
- }
- _data = std::move(maybe_utf32).value();
- }
- p = 0;
-}
-
-void ANTLRInputStream::load(std::istream &stream, bool lenient) {
- if (!stream.good() || stream.eof()) // No fail, bad or EOF.
- return;
-
- _data.clear();
-
- std::string s((std::istreambuf_iterator(stream)), std::istreambuf_iterator());
- load(s.data(), s.length(), lenient);
-}
-
-void ANTLRInputStream::reset() {
- p = 0;
-}
-
-void ANTLRInputStream::consume() {
- if (p >= _data.size()) {
- assert(LA(1) == IntStream::EOF);
- throw IllegalStateException("cannot consume EOF");
- }
-
- if (p < _data.size()) {
- p++;
- }
-}
-
-size_t ANTLRInputStream::LA(ssize_t i) {
- if (i == 0) {
- return 0; // undefined
- }
-
- ssize_t position = static_cast(p);
- if (i < 0) {
- i++; // e.g., translate LA(-1) to use offset i=0; then _data[p+0-1]
- if ((position + i - 1) < 0) {
- return IntStream::EOF; // invalid; no char before first char
- }
- }
-
- if ((position + i - 1) >= static_cast(_data.size())) {
- return IntStream::EOF;
- }
-
- return _data[static_cast((position + i - 1))];
-}
-
-size_t ANTLRInputStream::LT(ssize_t i) {
- return LA(i);
-}
-
-size_t ANTLRInputStream::index() {
- return p;
-}
-
-size_t ANTLRInputStream::size() {
- return _data.size();
-}
-
-// Mark/release do nothing. We have entire buffer.
-ssize_t ANTLRInputStream::mark() {
- return -1;
-}
-
-void ANTLRInputStream::release(ssize_t /* marker */) {
-}
-
-void ANTLRInputStream::seek(size_t index) {
- if (index <= p) {
- p = index; // just jump; don't update stream state (line, ...)
- return;
- }
- // seek forward, consume until p hits index or n (whichever comes first)
- index = std::min(index, _data.size());
- while (p < index) {
- consume();
- }
-}
-
-std::string ANTLRInputStream::getText(const Interval &interval) {
- if (interval.a < 0 || interval.b < 0) {
- return "";
- }
-
- size_t start = static_cast(interval.a);
- size_t stop = static_cast(interval.b);
-
-
- if (stop >= _data.size()) {
- stop = _data.size() - 1;
- }
-
- size_t count = stop - start + 1;
- if (start >= _data.size()) {
- return "";
- }
-
- auto maybeUtf8 = Utf8::strictEncode(std::u32string_view(_data).substr(start, count));
- if (!maybeUtf8.has_value()) {
- throw IllegalArgumentException("Input stream contains invalid Unicode code points");
- }
- return std::move(maybeUtf8).value();
-}
-
-std::string ANTLRInputStream::getSourceName() const {
- if (name.empty()) {
- return IntStream::UNKNOWN_SOURCE_NAME;
- }
- return name;
-}
-
-std::string ANTLRInputStream::toString() const {
- auto maybeUtf8 = Utf8::strictEncode(_data);
- if (!maybeUtf8.has_value()) {
- throw IllegalArgumentException("Input stream contains invalid Unicode code points");
- }
- return std::move(maybeUtf8).value();
-}
-
-void ANTLRInputStream::InitializeInstanceFields() {
- p = 0;
-}
diff --git a/src/include/ANTLRInputStream.h b/src/include/ANTLRInputStream.h
deleted file mode 100755
index 413eadef..00000000
--- a/src/include/ANTLRInputStream.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
- * Use of this file is governed by the BSD 3-clause license that
- * can be found in the LICENSE.txt file in the project root.
- */
-
-#pragma once
-
-#include
-
-#include "CharStream.h"
-
-namespace antlr4 {
-
- // Vacuum all input from a stream and then treat it
- // like a string. Can also pass in a string or char[] to use.
- // Input is expected to be encoded in UTF-8 and converted to UTF-32 internally.
- class ANTLR4CPP_PUBLIC ANTLRInputStream : public CharStream {
- protected:
- /// The data being scanned.
- // UTF-32
- std::u32string _data;
-
- /// 0..n-1 index into string of next char
- size_t p;
-
- public:
- /// What is name or source of this char stream?
- std::string name;
-
- ANTLRInputStream();
-
- ANTLRInputStream(std::string_view input);
-
- ANTLRInputStream(const char *data, size_t length);
- ANTLRInputStream(std::istream &stream);
-
- virtual void load(const std::string &input, bool lenient);
- virtual void load(const char *data, size_t length, bool lenient);
- virtual void load(std::istream &stream, bool lenient);
-
- virtual void load(const std::string &input) { load(input, false); }
- virtual void load(const char *data, size_t length) { load(data, length, false); }
- virtual void load(std::istream &stream) { load(stream, false); }
-
- /// Reset the stream so that it's in the same state it was
- /// when the object was created *except* the data array is not
- /// touched.
- virtual void reset();
- virtual void consume() override;
- virtual size_t LA(ssize_t i) override;
- virtual size_t LT(ssize_t i);
-
- ///
- /// Return the current input symbol index 0..n where n indicates the
- /// last symbol has been read. The index is the index of char to
- /// be returned from LA(1).
- ///
- virtual size_t index() override;
- virtual size_t size() override;
-
- ///
- /// mark/release do nothing; we have entire buffer
- virtual ssize_t mark() override;
- virtual void release(ssize_t marker) override;
-
- ///
- /// consume() ahead until p==index; can't just set p=index as we must
- /// update line and charPositionInLine. If we seek backwards, just set p
- ///
- virtual void seek(size_t index) override;
- virtual std::string getText(const misc::Interval &interval) override;
- virtual std::string getSourceName() const override;
- virtual std::string toString() const override;
-
- private:
- void InitializeInstanceFields();
- };
-
-} // namespace antlr4
diff --git a/src/include/antlr4-common.h b/src/include/antlr4-common.h
deleted file mode 100644
index d7f9a65f..00000000
--- a/src/include/antlr4-common.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
- * Use of this file is governed by the BSD 3-clause license that
- * can be found in the LICENSE.txt file in the project root.
- */
-
-#pragma once
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include