Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ crashes on new test ParserExec/ListLabelsOnRuleRefStartOfAlt.txt #3845

Closed
parrt opened this issue Aug 28, 2022 · 9 comments
Closed

C++ crashes on new test ParserExec/ListLabelsOnRuleRefStartOfAlt.txt #3845

parrt opened this issue Aug 28, 2022 · 9 comments

Comments

@parrt
Copy link
Member

parrt commented Aug 28, 2022

Looks like there's an issue in ArrayPredictionContext::equals() exposed by this test from this Test.cpp line:

  tree::ParseTree *tree = parser.expression();

Run

$ cd ~/antlr/code/antlr4/runtime/Cpp
$ cmake . -DTRACE_ATN=ON -DCMAKE_BUILD_TYPE=Debug

Then from test dir we get :

$ cat input
a and b
$ ln -s /Users/parrt/antlr/code/antlr4/runtime/Cpp/dist/libantlr4-runtime.dylib 
$ clang++ -g -std=c++17 -I /Users/parrt/antlr/code/antlr4/runtime/Cpp/runtime/src -L. -lantlr4-runtime *.cpp
$ ./a.out input
Segmentation fault: 11

and see from lldb (with Debug mode for cmake build of lib):

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x00000001013167e4 libantlr4-runtime.4.10.1.dylib`antlr4::atn::operator==(lhs=0x0000000000000000, rhs=0x0000000000000000) at PredictionContext.h:206:16
   203 	  };
   204 	
   205 	  inline bool operator==(const PredictionContext &lhs, const PredictionContext &rhs) {
-> 206 	    return lhs.equals(rhs);
   207 	  }
   208 	
   209 	  inline bool operator!=(const PredictionContext &lhs, const PredictionContext &rhs) {

and trace:

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x00000001013167e4 libantlr4-runtime.4.10.1.dylib`antlr4::atn::operator==(lhs=0x0000000000000000, rhs=0x0000000000000000) at PredictionContext.h:206:16
    frame #1: 0x0000000101346c10 libantlr4-runtime.4.10.1.dylib`(anonymous namespace)::predictionContextEqual(lhs=nullptr, rhs=nullptr) at ArrayPredictionContext.cpp:25:17
    frame #2: 0x0000000101346b80 libantlr4-runtime.4.10.1.dylib`bool std::__1::equal<std::__1::__wrap_iter<std::__1::shared_ptr<antlr4::atn::PredictionContext const> const*>, std::__1::__wrap_iter<std::__1::shared_ptr<antlr4::atn::PredictionContext const> const*>, bool (*)(std::__1::shared_ptr<antlr4::atn::PredictionContext const> const&, std::__1::shared_ptr<antlr4::atn::PredictionContext const> const&)>(__first1=__wrap_iter<const std::__1::shared_ptr<const antlr4::atn::PredictionContext> *> @ 0x000000016fdfb6a0, __last1=__wrap_iter<const std::__1::shared_ptr<const antlr4::atn::PredictionContext> *> @ 0x000000016fdfb698, __first2=__wrap_iter<const std::__1::shared_ptr<const antlr4::atn::PredictionContext> *> @ 0x000000016fdfb690, __pred=(libantlr4-runtime.4.10.1.dylib`(anonymous namespace)::predictionContextEqual(std::__1::shared_ptr<antlr4::atn::PredictionContext const> const&, std::__1::shared_ptr<antlr4::atn::PredictionContext const> const&) at ArrayPredictionContext.cpp:24))(std::__1::shared_ptr<antlr4::atn::PredictionContext const> const&, std::__1::shared_ptr<antlr4::atn::PredictionContext const> const&)) at equal.h:31:10
    frame #3: 0x0000000101346994 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ArrayPredictionContext::equals(this=0x000000016fdfba68, other=0x00006000026058d8) const at ArrayPredictionContext.cpp:82:10
    frame #4: 0x00000001013167f0 libantlr4-runtime.4.10.1.dylib`antlr4::atn::operator==(lhs=0x000000016fdfba68, rhs=0x00006000026058d8) at PredictionContext.h:206:16
    frame #5: 0x0000000101395120 libantlr4-runtime.4.10.1.dylib`antlr4::atn::PredictionContext::mergeArrays(a=std::__1::shared_ptr<const antlr4::atn::ArrayPredictionContext>::element_type @ 0x00006000026058d8 strong=4 weak=1, b=std::__1::shared_ptr<const antlr4::atn::ArrayPredictionContext>::element_type @ 0x0000600002605b78 strong=1 weak=1, rootIsWildcard=false, mergeCache=0x0000600003504028) at PredictionContext.cpp:411:9
    frame #6: 0x0000000101393320 libantlr4-runtime.4.10.1.dylib`antlr4::atn::PredictionContext::merge(a=std::__1::shared_ptr<const antlr4::atn::PredictionContext>::element_type @ 0x00006000026058d8 strong=4 weak=1, b=std::__1::shared_ptr<const antlr4::atn::PredictionContext>::element_type @ 0x0000600002104068 strong=45 weak=1, rootIsWildcard=false, mergeCache=0x0000600003504028) at PredictionContext.cpp:210:10
    frame #7: 0x0000000101318564 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ATNConfigSet::add(this=0x0000000100405be0, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605b18 strong=1 weak=1, mergeCache=0x0000600003504028) at ATNConfigSet.cpp:64:41
    frame #8: 0x00000001013799b4 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closure_(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605b18 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:890:14
    frame #9: 0x00000001013797d4 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closureCheckingStopState(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605b18 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:880:3
    frame #10: 0x0000000101379e3c libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closure_(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605ab8 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:959:7
    frame #11: 0x00000001013797d4 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closureCheckingStopState(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605ab8 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:880:3
    frame #12: 0x0000000101379e3c libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closure_(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605a58 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:959:7
    frame #13: 0x00000001013797d4 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closureCheckingStopState(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605a58 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:880:3
    frame #14: 0x0000000101379e3c libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closure_(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x00006000026059f8 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:959:7
    frame #15: 0x00000001013797d4 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closureCheckingStopState(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x00006000026059f8 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:880:3
    frame #16: 0x0000000101379e3c libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closure_(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605998 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:959:7
    frame #17: 0x00000001013797d4 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closureCheckingStopState(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605998 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:880:3
    frame #18: 0x0000000101379e3c libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closure_(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605938 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:959:7
    frame #19: 0x00000001013797d4 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closureCheckingStopState(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605938 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:880:3
    frame #20: 0x0000000101379e3c libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closure_(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605878 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:959:7
    frame #21: 0x00000001013797d4 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closureCheckingStopState(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605878 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:880:3
    frame #22: 0x0000000101379e3c libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closure_(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605818 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:959:7
    frame #23: 0x00000001013797d4 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closureCheckingStopState(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605818 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:880:3
    frame #24: 0x0000000101379e3c libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closure_(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x00006000026057b8 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:959:7
    frame #25: 0x00000001013797d4 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closureCheckingStopState(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x00006000026057b8 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:880:3
    frame #26: 0x0000000101379e3c libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closure_(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605638 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:959:7
    frame #27: 0x00000001013797d4 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closureCheckingStopState(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605638 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=-1, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:880:3
    frame #28: 0x0000000101379734 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closureCheckingStopState(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605578 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=0, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:868:9
    frame #29: 0x0000000101379e3c libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closure_(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605518 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=0, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:959:7
    frame #30: 0x00000001013797d4 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closureCheckingStopState(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605518 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=0, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:880:3
    frame #31: 0x0000000101379e3c libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closure_(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x00006000026053f8 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=0, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:959:7
    frame #32: 0x00000001013797d4 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closureCheckingStopState(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x00006000026053f8 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=0, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:880:3
    frame #33: 0x0000000101379e3c libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closure_(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605218 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=0, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:959:7
    frame #34: 0x00000001013797d4 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closureCheckingStopState(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605218 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, depth=0, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:880:3
    frame #35: 0x000000010137939c libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::closure(this=0x0000600003504000, config=std::__1::shared_ptr<antlr4::atn::ATNConfig>::element_type @ 0x0000600002605218 strong=1 weak=1, configs=0x0000000100405be0, closureBusy=size=0, collectPredicates=false, fullCtx=true, treatEofAsEpsilon=false) at ParserATNSimulator.cpp:825:3
    frame #36: 0x00000001013777b8 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::computeReachSet(this=0x0000600003504000, closure_=0x00000001004058e0, t=4, fullCtx=true) at ParserATNSimulator.cpp:523:7
    frame #37: 0x0000000101376dd8 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::execATNWithFullContext(this=0x0000600003504000, dfa=0x00000001004048b0, D=0x00006000029055e0, s0=0x0000000100405460, input=0x000000016fdfece0, startIndex=1, outerContext=0x0000600002c08200) at ParserATNSimulator.cpp:355:13
    frame #38: 0x0000000101375be8 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::execATN(this=0x0000600003504000, dfa=0x00000001004048b0, s0=0x0000600002905570, input=0x000000016fdfece0, startIndex=1, outerContext=0x0000600002c08200) at ParserATNSimulator.cpp:238:20
    frame #39: 0x0000000101374f20 libantlr4-runtime.4.10.1.dylib`antlr4::atn::ParserATNSimulator::adaptivePredict(this=0x0000600003504000, input=0x000000016fdfece0, decision=4, outerContext=0x0000600002c08200) at ParserATNSimulator.cpp:155:16
    frame #40: 0x0000000100009c28 a.out`TestParser::expression(this=0x000000016fdfedb0, precedence=0) at TestParser.cpp:227:54
    frame #41: 0x0000000100009904 a.out`TestParser::expression(this=0x000000016fdfedb0) at TestParser.cpp:179:11
    frame #42: 0x0000000100001758 a.out`main(argc=2, argv=0x000000016fdff148) at Test.cpp:31:34
    frame #43: 0x000000010006908c dyld`start + 520
@parrt
Copy link
Member Author

parrt commented Aug 28, 2022

It appears that there are two NULL pointers coming in here:

Line 24 in ArrayPredictionContext.h:

  bool predictionContextEqual(const Ref<const PredictionContext> &lhs, const Ref<const PredictionContext> &rhs) {
    return *lhs == *rhs;
  }

It looks like ArrayPredictionContext::equals() try to compare a number of things for equality using that function but it's not checking for NULL. As those are references I'm not sure how to check for NULL. Ok, it looks like it is undefined behavior to make a reference to an item so this is somehow making a reference to NULL objects:

line 82: ArrayPredictionContext.cpp:

std::equal(parents.begin(), parents.end(), array.parents.begin(), predictionContextEqual);

@parrt parrt mentioned this issue Aug 28, 2022
10 tasks
parrt added a commit to parrt/antlr4 that referenced this issue Aug 28, 2022
@mike-lischke
Copy link
Member

Right, null is not expected in predictionContextEqual. It could be changed to do so, but IMO the correct solution is to check if parents is empty, something like:

bool ArrayPredictionContext::equals(const PredictionContext &other) const {//
  if (this == std::addressof(other)) {
    return true;
  }
  if (getContextType() != other.getContextType()) {
    return false;
  }
  const auto &array = downCast<const ArrayPredictionContext&>(other);
  return returnStates.size() == array.returnStates.size() &&
         parents.size() == array.parents.size() &&
         cachedHashCodeEqual(cachedHashCode(), array.cachedHashCode()) &&
         std::memcmp(returnStates.data(), array.returnStates.data(), returnStates.size() * sizeof(decltype(returnStates)::value_type)) == 0 &&
         (parents.size() == 0 || std::equal(parents.begin(), parents.end(), array.parents.begin(), predictionContextEqual));
}

Also, splitting this large set of tests into individual lines would increase readability significantly.

@parrt
Copy link
Member Author

parrt commented Sep 3, 2022

Well, I've simplified and am running into limits of my C++.

bool ArrayPredictionContext::equals(const PredictionContext &other) const {
  if (this == std::addressof(other)) {
    return true;
  }
  if (getContextType() != other.getContextType()) {
    return false;
  }
  const auto &array = downCast<const ArrayPredictionContext&>(other);
  const bool sameSize = returnStates.size() == array.returnStates.size() &&
                        parents.size() == array.parents.size();
  const bool sameHash = cachedHashCodeEqual(cachedHashCode(), array.cachedHashCode());
  const size_t stateSizeBytes = sizeof(decltype(returnStates)::value_type);
  const bool stateArraysEqual =
    std::memcmp(returnStates.data(), array.returnStates.data(),
                returnStates.size() * stateSizeBytes) == 0;
  // stack of contexts is the same
  std::cout << parents.size() << "\n"; 
  std::cout << array.parents.size() << "\n";
  const bool parentCtxEqual = std::equal(parents.begin(), parents.end(), array.parents.begin(),  <======= crash
                                         predictionContextEqual);
  return sameSize && sameHash && stateArraysEqual && parentCtxEqual;
}

It prints 2 and then 2 then crashes on that std:equal. I set a breakpoint and get two vectors to compare that look fine minus the nullptr last element:

(lldb) p parents
(std::vector<std::shared_ptr<const antlr4::atn::PredictionContext>, std::allocator<std::shared_ptr<const antlr4::atn::PredictionContext> > >) $2 = size=2 {
  [0] = std::__1::shared_ptr<const antlr4::atn::PredictionContext>::element_type @ 0x0000600002100fb8 strong=41 weak=1 {
    __ptr_ = 0x0000600002100fb8
  }
  [1] = nullptr {
    __ptr_ = nullptr
  }
}
(lldb) p array.parents
(const std::vector<std::shared_ptr<const antlr4::atn::PredictionContext>, std::allocator<std::shared_ptr<const antlr4::atn::PredictionContext> > >) $3 = size=2 {
  [0] = std::__1::shared_ptr<const antlr4::atn::PredictionContext>::element_type @ 0x0000600002100fb8 strong=41 weak=1 {
    __ptr_ = 0x0000600002100fb8
  }
  [1] = nullptr {
    __ptr_ = nullptr
  }
}

We must be pushing a null somewhere as this will try to deref that nullptr:

bool predictionContextEqual(const Ref<const PredictionContext> &lhs, const Ref<const PredictionContext> &rhs) {
    return *lhs == *rhs;
}

@parrt
Copy link
Member Author

parrt commented Sep 3, 2022

My related PR is #3863

@parrt
Copy link
Member Author

parrt commented Sep 3, 2022

I have simplified the grammar. Here is complete test case:

grammar Test;

expression
    : expression (AND expression)+
    | IDENTIFIER
    ;

AND : 'and' ;
IDENTIFIER : [a-zA-Z_]+ ;
WS : [ \t\r\n]+ -> skip ;

Using my antlr4-tools:

$ cd ~/antlr/code/antlr4
$ mvn -DskipTests install
$ cd /tmp/foo # dir with grammar
$ antlr4 -v 4.11-SNAPSHOT -Dlanguage=Cpp *.g4

and Test.cpp:

#include <iostream>

#include "antlr4-runtime.h"
#include "TestLexer.h"
#include "TestParser.h"

using namespace antlr4;

class TreeShapeListener : public tree::ParseTreeListener {
public:
  void visitTerminal(tree::TerminalNode *) override {}
  void visitErrorNode(tree::ErrorNode *) override {}
  void exitEveryRule(ParserRuleContext *) override {}
  void enterEveryRule(ParserRuleContext *ctx) override {
    for (auto child : ctx->children) {
      tree::ParseTree *parent = child->parent;
      ParserRuleContext *rule = dynamic_cast<ParserRuleContext *>(parent);
      if (rule != ctx) {
        throw "Invalid parse tree shape detected.";
      }
    }
  }
};

int main(int argc, const char* argv[]) {
  ANTLRFileStream input;
  input.loadFromFile(argv[1]);
  TestLexer lexer(&input);
  CommonTokenStream tokens(&lexer);
  TestParser parser(&tokens);
  tree::ParseTree *tree = parser.expression();
  TreeShapeListener listener;
  tree::ParseTreeWalker::DEFAULT.walk(&listener, tree);
  return 0;
}

Compile and run:

$ clang++ -g -std=c++17 -I /Users/parrt/antlr/code/antlr4/runtime/Cpp/runtime/src -L/Users/parrt/antlr/code/antlr4/runtime/Cpp/dist -lantlr4-runtime *.cpp
$ lldb ./a.out input
(lldb) target create "./a.out"
Current executable set to '/tmp/foo/a.out' (arm64).
(lldb) settings set -- target.run-args  "input"
(lldb) run
Process 12425 launched: '/tmp/foo/a.out' (arm64)
Process 12425 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x00000001013126f8 libantlr4-runtime.4.10.1.dylib`antlr4::atn::operator==(lhs=0x0000000000000000, rhs=0x0000000000000000) at PredictionContext.h:206:16
   203 	  };
   204 	
   205 	  inline bool operator==(const PredictionContext &lhs, const PredictionContext &rhs) {
-> 206 	    return lhs.equals(rhs);
   207 	  }
   208 	
   209 	  inline bool operator!=(const PredictionContext &lhs, const PredictionContext &rhs) {
Target 0: (a.out) stopped.

@parrt parrt removed this from the 4.11 milestone Sep 3, 2022
@mike-lischke
Copy link
Member

mike-lischke commented Sep 4, 2022

I wonder why @jcking doesn't help. It's code from one of his last patches. Wasn't the test not there at that time?

What you see here is that the parents vector has a size != 0, but seems to contain null references (empty shared_ptr). I wonder if that is a valid state (a parent list with null entries). If not then this should be fixed instead of changing ArrayPredictionContext. If it is then we need to fix predictionContextEqual. My suggestion above is nonsense. It checks if the arrays have content, but that's not what causes the trouble (empty arrays do nothing).

  bool predictionContextEqual(const Ref<const PredictionContext> &lhs, const Ref<const PredictionContext> &rhs) {
    // What should happen here? Are lhs and rhs equal if one or both of them are null?
    if (!lhs && !rhs) { 
      return true;
    }

    return *lhs == *rhs;
  }

What if only one is null?

@parrt
Copy link
Member Author

parrt commented Sep 4, 2022

I believe it should NOT have nullptr. There is sometimes a sentinel indicating empty stack but it's a real value and should be compared. (This bug/test is new.)

ericvergnaud pushed a commit to ericvergnaud/antlr4 that referenced this issue Sep 9, 2022
kaby76 added a commit to kaby76/antlr4 that referenced this issue Nov 5, 2022
@parrt
Copy link
Member Author

parrt commented Nov 13, 2022

Improving ATN simulation trace: #3957

More info. Looks like parent element can be null:

public class ArrayPredictionContext extends PredictionContext {
	/** Parent can be null only if full ctx mode and we make an array
	 *  from {@link #EMPTY} and non-empty. We merge {@link #EMPTY} by using null parent and
	 *  returnState == {@link #EMPTY_RETURN_STATE}.
	 */
	public final PredictionContext[] parents;

parrt added a commit to parrt/antlr4 that referenced this issue Nov 14, 2022
…ay of parent contexts, last one of which is nullptr.

Signed-off-by: Terence Parr <[email protected]>
parrt added a commit to parrt/antlr4 that referenced this issue Nov 14, 2022
…ay of parent contexts, last one of which is nullptr.

Signed-off-by: Terence Parr <[email protected]>
@parrt
Copy link
Member Author

parrt commented Nov 14, 2022

Fixed by #3958

@parrt parrt added this to the 4.11.2 milestone Nov 14, 2022
@parrt parrt closed this as completed Nov 14, 2022
parrt added a commit that referenced this issue Nov 14, 2022
Signed-off-by: Terence Parr <[email protected]>
parrt added a commit to parrt/antlr4 that referenced this issue Nov 14, 2022
parrt added a commit that referenced this issue Dec 21, 2022
* Fix CMake syntax for variable expansion

When using variables to compare (like in if clause) the variable
shouldn't be quoted. More details can be found at the link below:

https://cmake.org/cmake/help/latest/command/if.html#variable-expansion

Signed-off-by: HS <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* initial commit

Signed-off-by: Eric Vergnaud <[email protected]>

* renamed for clarity

Signed-off-by: Eric Vergnaud <[email protected]>

* renamed for clarity

Signed-off-by: Eric Vergnaud <[email protected]>

* able to locate antlr4 runtime using ts-node, missing types

Signed-off-by: Eric Vergnaud <[email protected]>

* progressing

Signed-off-by: Eric Vergnaud <[email protected]>

* able to 'run' a test. It fails but it compiles and resolves!

Signed-off-by: Eric Vergnaud <[email protected]>

* reflect refactored runtime

Signed-off-by: Eric Vergnaud <[email protected]>

* able to run RecursiveLexerRuleRefWithWildcardPlus_1 test locally

Signed-off-by: Eric Vergnaud <[email protected]>

* passes LexerExec tests in IntelliJ

Signed-off-by: Eric Vergnaud <[email protected]>

* make ATN private

Signed-off-by: Eric Vergnaud <[email protected]>

* ignore same tests as JavaScript

Signed-off-by: Eric Vergnaud <[email protected]>

* compiles Parser and Lexer bu local run fails

Signed-off-by: Eric Vergnaud <[email protected]>

* ParserExec.TokenOffset test successful in IntelliJ !

Signed-off-by: Eric Vergnaud <[email protected]>

* Progressing, passing 131 of 348 tests

Signed-off-by: Eric Vergnaud <[email protected]>

* pass 327 tests out of 348

Signed-off-by: Eric Vergnaud <[email protected]>

* more successful tests

Signed-off-by: Eric Vergnaud <[email protected]>

* 333 successful tests out of 348

Signed-off-by: Eric Vergnaud <[email protected]>

* all tests pass except 7 caused by #3868

Signed-off-by: Eric Vergnaud <[email protected]>

* update getting-started doc

Signed-off-by: nicksxs <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* add blank github action file for hosted CI

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* update getting started document to say java 11

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Revert "update getting started document to say java 11"

This reverts commit 1df58f7.

Signed-off-by: Eric Vergnaud <[email protected]>

* add C# book code links

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Add Jim/Ken to readme

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Update Swift Package to support static library

Add static library distribution in SPM

Signed-off-by: Hell_Ghost <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Update Package.swift

Signed-off-by: Hell_Ghost [email protected]
Signed-off-by: Hell_Ghost <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Add caching support for maven & dependencies. Also, include caching for
cpp builds using actions/ccache.

Builds are more reliable (avoids the archive.apache server which
intermittently reports timeouts) and also significantly improves the
overall builds times (down from 46 mins to 28 mins).

The slowest part of the build now is the Windows+cpp builds because
there is no reliable cache implementation yet. MacOS+cpp (65% cache hit) is
also relatively slow compared to Ubuntu+cpp (99% cache hit).

Signed-off-by: HS <[email protected]>
Signed-off-by: Terence Parr <[email protected]>

# Conflicts:
#	.github/workflows/hosted.yml
Signed-off-by: Eric Vergnaud <[email protected]>

* use snap to install go 1.19

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* grr...install snap

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* ugh. start snap

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* ugh. start snap

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* ugh. cant get snap to install go

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* try downloading golang with curl

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Issue #3823: Temporarily disable a few tests on CI

The tests are currently failing. The underlying issues have been fixed
on dev and so the builds will be turned back with the next release.

Signed-off-by: HS <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* update actions status badge

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* update getting started document to say java 11

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Revert "update getting started document to say java 11"

This reverts commit 3591ee0.

Signed-off-by: Eric Vergnaud <[email protected]>

* update getting-started doc

Signed-off-by: nicksxs <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* make getValue visible to external profiler tools.

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Fix #3508: Document the $parser attribute and its use in target-agnostic grammars.

Signed-off-by: Ross Patterson <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Add accessor to IntervalSet for intervals

Signed-off-by: James Taylor <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Remove libuuid dependency from C++ runtime

libuuid and its headers are not referenced anywhere, so remove it.

Signed-off-by: Bryan Tan <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Add `@SuppressWarnings("CheckReturnValue")` to prevent error_prone lib errors.

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: Fixes for #3718

  o Implement collections with generics to solve hash collisions
  o Fix type casting in LL start parser simulation optimization
  o General minor tidy ups

Acknowledgements to @kaby76 for help with tracing errors

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #3718 Revert accidental keyboard error in Java target

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #3718 Correct DFAState index in Lexer ATN Simulator

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #3718 Fix go runtime test runners

With older versions of go, there was no good way to tell the compiler to use your local
development copy of a particular package instead of the one installed in GOPATH/src/...

However, we are now using modules, which allows us to tell the compiler that instead of
a module downloaded to GOPATH/pkg, to use a local copy on disk.

Hence this change removes the need to copy the whole of the go installation to a
tempoorary location, then put the antlr go runtime in to the go installation as if it was
part of the compiler. Hence the execution time for the go tests is now faster than before.

This works because when the generated code is placed in the temporary location, we create
a go.mod file for it, tell the module to replace the online module for the go runtime with
the local copy on disk, then ro a go mod tidy to add the dependencies from the code (which
avoids network access, so it is instant), which adds the ANTLR dependency itself (which is
then replaced at compile time).

All go runtime tests now pass.

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Rm remote github actions; hosted seems to work

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* install golang with curl; go was missing from dev

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: Rework of all Hash() and Equals() methods - implement generic collections

 - Implement new collections using generics that implement the functionality
   required by the Java runtime in a more idiomatic Go way.
 - Fix Hash() and Equals() for all objects in the runtime
 - Fix getConflictingAlts so that it behaves the same way as Java, using a
   new generic collection
 - Replaces the use of the array2DHashSet, which was causing unneeded memory
   allocations. Replaced with generic collection that allocates minimally
   (though, I think I can improve on that with a little analysis).

Jim Idle - [email protected]

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #3718 Correct DFAState index in Lexer ATN Simulator

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* feat: Reduce initial memory allocations for collections

  - Many small collections are created at runtime, the default allocation for
    maps, even though small, still requires memory. Specifying a very small
    initial allocation prevents unnecesary allocations and has no measurable
    effect on performance. A small incremental change.

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #3758 Allow for string being a keyword and fix go template to use escapedName

  - The go template was ignoring the use of escapedName in many places and was
    not consistenet with the Java version.
  - Added 'string' to the list of reserved words for the Go target

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #3758 Add go.sum to the repo

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #3758 Ensure that standard runtime extensions are included in go.mod

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #2826  Go template is incorrect for dynamic scopes

closes #2826
obviates PR #3101

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #2016 - Generate correct iGo code for lists in a grammar, such as `label+=arg+`

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* feat: Bump poms to use 4.11 Snapshot

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* turn off Golang test at circleci for now

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Replace smart-quote with single-quote in code examples

Signed-off-by: Tim McCormack <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Augment error message during testing to include full cause of problem.

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Augment error message during testing to include full cause of problem. (round 2 to avoid null ptr)

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Cpp: Link to threads library

As detailed in #3708, it is necessary to link against the (p)threads
library in order to be able to use std::call_once without producing
linker errors.

Since this function is frequently used in ANTLR's cpp version, this
commit ensures that the respective library is always linked against in
order to avoid this error, even if downstream users are not explicitly
linking against an appropriate threads library.

Fixes #3708

Signed-off-by: Robert Adam <[email protected]>

Co-authored-by: Bryan Tan <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* add test for #2016 and fix java.

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* ensure all targets have the appropriate argument list for the template causing the problem.

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Fix other targets

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix format

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* add check that $args is a list

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* change made by @lingyv-li to fix bug in DART exposed by this test.

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix AssertIsList in multiple targets. Go doesn't pass test and has no AssertIsList so I'm dropping that test from the Go test suite.

How did a comment to the C++ runnerFor my future reference as to how to build things from the command line.

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* C++ gets an exception with this test so I'm turning it off. See #3845

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* feat: #3840 Move Go to version v4.11.0

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* feat: #3840 Create the v4 version of the Go runtime

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* feat: Create the v4 runtime layout for the Go runtime, ready for release tagging

Note that the vast majority of the changes here are just copying the runtime file in to
the /v4 subdirectory so that we can support legacy projects that use GOPATH only, as well
as users that can use go modules. At a later release, we will delete the default path, and move
the v4 subdirectory back to the top level. But, we cannot do that on this release.

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Reenable go tests on CircleCI

Signed-off-by: Ivan Kochurkin <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Fold constants in generated code for all runtimes

Go: getInlineTestSetWordSize 32 -> 64
Dart: get rid of BigInt
Swift: optimize TestSetInline
Python: fixes #3698
JavaScript: fixes #3699

Signed-off-by: Ivan Kochurkin <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Use int literals instead of refs for Python and JavaScript

Update getMultiTokenAlternativeDescriptor test

fixes #3703

Signed-off-by: Ivan Kochurkin <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* update release doc for Go version numbers

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #2016 Fix Go template list reference, go runtime and got test template for list labels

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* feat: Add a deprecation message to the existing v1 module

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Split tool and runtime tests for GitHub workflow

Build only necessary modules for tests

Signed-off-by: Ivan Kochurkin <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Remove not used methods from FileUtils (runtime tests)

Signed-off-by: Ivan Kochurkin <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Update dependencies of antlr4-maven-plugin

Signed-off-by: Ivan Kochurkin <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Update jUnit: 5.8.2 -> 5.9.0

Signed-off-by: Ivan Kochurkin <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Fixes #3733; update ST4 so it uses proper ANTLR 3

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* tweak doc

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Set to 4.11.0 not 4.11 in poms

Signed-off-by: Eric Vergnaud <[email protected]>

* [maven-release-plugin] prepare release 4.11.0

Signed-off-by: Eric Vergnaud <[email protected]>

* [maven-release-plugin] prepare for next development iteration

Signed-off-by: Eric Vergnaud <[email protected]>

* Damn. java target said 4.10.2 not 4.11.0

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* roll back to 4.11.0; made mistake

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* roll back to 4.11.0; made mistake

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* [maven-release-plugin] prepare release antlr4-master-4.11.0

Signed-off-by: Eric Vergnaud <[email protected]>

* [maven-release-plugin] prepare for next development iteration

Signed-off-by: Eric Vergnaud <[email protected]>

* use build and twine to publish source and wheel

Signed-off-by: Qijia Liu <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* tweak doc

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* tweak c++ build script to make Mac binaries with cmake/make

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* tweak release doc

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* tweak code / doc related to bad previous release

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* [maven-release-plugin] prepare release 4.11.1

Signed-off-by: Eric Vergnaud <[email protected]>

* [maven-release-plugin] prepare for next development iteration

Signed-off-by: Eric Vergnaud <[email protected]>

* clean up deploy c++ source script

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* cleanup code generation

Signed-off-by: Eric Vergnaud <[email protected]>

* don't initialize default param values twice

Signed-off-by: Eric Vergnaud <[email protected]>

* add missing field

Signed-off-by: Eric Vergnaud <[email protected]>

* update codegen template for 4.11.1

Signed-off-by: Eric Vergnaud <[email protected]>

* support new param: Parser

Signed-off-by: Eric Vergnaud <[email protected]>

* fix template for 4.11

Signed-off-by: Eric Vergnaud <[email protected]>

* default export Listener and Visitor

Signed-off-by: Eric Vergnaud <[email protected]>

* also default export parser and lexer

Signed-off-by: Eric Vergnaud <[email protected]>

* all tests pass except 7 caused by #3868

Signed-off-by: Eric Vergnaud <[email protected]>

* fix issues

Signed-off-by: Eric Vergnaud <[email protected]>

* make it easy to break

Signed-off-by: Eric Vergnaud <[email protected]>

* fix #3868

Signed-off-by: Eric Vergnaud <[email protected]>

* ALL TESTS PASS!!!!

Signed-off-by: Eric Vergnaud <[email protected]>

* cross fingers with CI

Signed-off-by: Eric Vergnaud <[email protected]>

* try fixing broken go tests

Signed-off-by: Eric Vergnaud <[email protected]>

* Try fix typescript CI

Signed-off-by: Eric Vergnaud <[email protected]>

* disable cpp for now

Signed-off-by: Eric Vergnaud <[email protected]>

* fix broken config

Signed-off-by: Eric Vergnaud <[email protected]>

* try fix macos gh build

Signed-off-by: Eric Vergnaud <[email protected]>

* improve speed by caching node_modules

Signed-off-by: Eric Vergnaud <[email protected]>

* no longer using ts-node

Signed-off-by: Eric Vergnaud <[email protected]>

* fix all tsc warnings

Signed-off-by: Eric Vergnaud <[email protected]>

* try fix MacOS CI

Signed-off-by: Eric Vergnaud <[email protected]>

* CI errors seem random, reactivate ubuntu

Signed-off-by: Eric Vergnaud <[email protected]>

* Disable node_modules caching, which seems to randomly fail in CI

Signed-off-by: Eric Vergnaud <[email protected]>

* don't delete symlink contents on windows (java bug with is SymbolicLink ?)

Signed-off-by: Eric Vergnaud <[email protected]>

* fix broken windows CI

Signed-off-by: ERIC-WINDOWS\ericv <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* verify windows ci

Signed-off-by: ERIC-WINDOWS\ericv <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Revert "verify windows ci"

This reverts commit 770d821.

Signed-off-by: Eric Vergnaud <[email protected]>

* reinstate full CI

Signed-off-by: Eric Vergnaud <[email protected]>

* manually merged

* manually merge

* fix merge

* fix broken template

* add template for invoking context list

* fix typo

* fix test templates

* Add code of conduct but with a different name since I do not like that name

Signed-off-by: Terence Parr <[email protected]>

* Update C# release instructions

* Tweak code of conduct

Signed-off-by: Terence Parr <[email protected]>

* Bring back the Package.swift in the project's root

Signed-off-by: Nikolay Edigaryev <[email protected]>

* swift-target.md: fix SPM installation instructions

Signed-off-by: Nikolay Edigaryev <[email protected]>

* the scope (parser or lexer) in @parser::header was dropped, so keep track of it and only include @Header in Listener and Visitor code

Signed-off-by: Eric Vergnaud <[email protected]>

* drop workaround in favor of #3878

* drop cache usage since it fails in CI

* #3878 was missing some scenarios

* fix issue when deleting test folder

* fix warnings

* drop duplicate behavior

* drop alien 'abstractRecognizer' property

* drop alien property 'channels'

* fix various codegen issues

* change import

* restore js extensions, see microsoft/TypeScript#50501

* use consistent inheritance

* more API

* more API stuff

* fix typo

* fix typescript exports

* use ts-node to run typescript tests

* webpack runtime before linking

* fix exec paths on windows

Signed-off-by: ERIC-WINDOWS\ericv <[email protected]>

* fix failing tests

* fix a few import issues

* merge typescript-target with latest dev

* runs Java and JavaScript tests after merging typescript-target

* merge test template

* skip unsupported test

* fix template prototype

* fix missing merge

* bump typescript beta version after rebase

* update docs

* rollback unwanted changes

Signed-off-by: HS <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>
Signed-off-by: nicksxs <[email protected]>
Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Hell_Ghost <[email protected]>
Signed-off-by: Hell_Ghost [email protected]
Signed-off-by: Ross Patterson <[email protected]>
Signed-off-by: James Taylor <[email protected]>
Signed-off-by: Bryan Tan <[email protected]>
Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Tim McCormack <[email protected]>
Signed-off-by: Ivan Kochurkin <[email protected]>
Signed-off-by: Qijia Liu <[email protected]>
Signed-off-by: ERIC-WINDOWS\ericv <[email protected]>
Signed-off-by: Nikolay Edigaryev <[email protected]>
Co-authored-by: HS <[email protected]>
Co-authored-by: nicksxs <[email protected]>
Co-authored-by: Terence Parr <[email protected]>
Co-authored-by: Hell_Ghost <[email protected]>
Co-authored-by: Ross Patterson <[email protected]>
Co-authored-by: James Taylor <[email protected]>
Co-authored-by: Bryan Tan <[email protected]>
Co-authored-by: Jim.Idle <[email protected]>
Co-authored-by: Tim McCormack <[email protected]>
Co-authored-by: Robert Adam <[email protected]>
Co-authored-by: Bryan Tan <[email protected]>
Co-authored-by: Ivan Kochurkin <[email protected]>
Co-authored-by: Qijia Liu <[email protected]>
Co-authored-by: Nikolay Edigaryev <[email protected]>
ncordon pushed a commit to neo4j/cypher-language-support that referenced this issue Sep 25, 2023
* Fix CMake syntax for variable expansion

When using variables to compare (like in if clause) the variable
shouldn't be quoted. More details can be found at the link below:

https://cmake.org/cmake/help/latest/command/if.html#variable-expansion

Signed-off-by: HS <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* initial commit

Signed-off-by: Eric Vergnaud <[email protected]>

* renamed for clarity

Signed-off-by: Eric Vergnaud <[email protected]>

* renamed for clarity

Signed-off-by: Eric Vergnaud <[email protected]>

* able to locate antlr4 runtime using ts-node, missing types

Signed-off-by: Eric Vergnaud <[email protected]>

* progressing

Signed-off-by: Eric Vergnaud <[email protected]>

* able to 'run' a test. It fails but it compiles and resolves!

Signed-off-by: Eric Vergnaud <[email protected]>

* reflect refactored runtime

Signed-off-by: Eric Vergnaud <[email protected]>

* able to run RecursiveLexerRuleRefWithWildcardPlus_1 test locally

Signed-off-by: Eric Vergnaud <[email protected]>

* passes LexerExec tests in IntelliJ

Signed-off-by: Eric Vergnaud <[email protected]>

* make ATN private

Signed-off-by: Eric Vergnaud <[email protected]>

* ignore same tests as JavaScript

Signed-off-by: Eric Vergnaud <[email protected]>

* compiles Parser and Lexer bu local run fails

Signed-off-by: Eric Vergnaud <[email protected]>

* ParserExec.TokenOffset test successful in IntelliJ !

Signed-off-by: Eric Vergnaud <[email protected]>

* Progressing, passing 131 of 348 tests

Signed-off-by: Eric Vergnaud <[email protected]>

* pass 327 tests out of 348

Signed-off-by: Eric Vergnaud <[email protected]>

* more successful tests

Signed-off-by: Eric Vergnaud <[email protected]>

* 333 successful tests out of 348

Signed-off-by: Eric Vergnaud <[email protected]>

* all tests pass except 7 caused by #3868

Signed-off-by: Eric Vergnaud <[email protected]>

* update getting-started doc

Signed-off-by: nicksxs <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* add blank github action file for hosted CI

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* update getting started document to say java 11

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Revert "update getting started document to say java 11"

This reverts commit 1df58f77820b5feb747d34cc6aff26276db8b6dd.

Signed-off-by: Eric Vergnaud <[email protected]>

* add C# book code links

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Add Jim/Ken to readme

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Update Swift Package to support static library

Add static library distribution in SPM

Signed-off-by: Hell_Ghost <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Update Package.swift

Signed-off-by: Hell_Ghost [email protected]
Signed-off-by: Hell_Ghost <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Add caching support for maven & dependencies. Also, include caching for
cpp builds using actions/ccache.

Builds are more reliable (avoids the archive.apache server which
intermittently reports timeouts) and also significantly improves the
overall builds times (down from 46 mins to 28 mins).

The slowest part of the build now is the Windows+cpp builds because
there is no reliable cache implementation yet. MacOS+cpp (65% cache hit) is
also relatively slow compared to Ubuntu+cpp (99% cache hit).

Signed-off-by: HS <[email protected]>
Signed-off-by: Terence Parr <[email protected]>

# Conflicts:
#	.github/workflows/hosted.yml
Signed-off-by: Eric Vergnaud <[email protected]>

* use snap to install go 1.19

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* grr...install snap

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* ugh. start snap

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* ugh. start snap

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* ugh. cant get snap to install go

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* try downloading golang with curl

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Issue #3823: Temporarily disable a few tests on CI

The tests are currently failing. The underlying issues have been fixed
on dev and so the builds will be turned back with the next release.

Signed-off-by: HS <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* update actions status badge

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* update getting started document to say java 11

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Revert "update getting started document to say java 11"

This reverts commit 3591ee0b51c6bb914f7ef0749182306fefe9cc18.

Signed-off-by: Eric Vergnaud <[email protected]>

* update getting-started doc

Signed-off-by: nicksxs <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* make getValue visible to external profiler tools.

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Fix #3508: Document the $parser attribute and its use in target-agnostic grammars.

Signed-off-by: Ross Patterson <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Add accessor to IntervalSet for intervals

Signed-off-by: James Taylor <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Remove libuuid dependency from C++ runtime

libuuid and its headers are not referenced anywhere, so remove it.

Signed-off-by: Bryan Tan <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Add `@SuppressWarnings("CheckReturnValue")` to prevent error_prone lib errors.

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: Fixes for antlr/antlr4#3718

  o Implement collections with generics to solve hash collisions
  o Fix type casting in LL start parser simulation optimization
  o General minor tidy ups

Acknowledgements to @kaby76 for help with tracing errors

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #3718 Revert accidental keyboard error in Java target

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #3718 Correct DFAState index in Lexer ATN Simulator

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #3718 Fix go runtime test runners

With older versions of go, there was no good way to tell the compiler to use your local
development copy of a particular package instead of the one installed in GOPATH/src/...

However, we are now using modules, which allows us to tell the compiler that instead of
a module downloaded to GOPATH/pkg, to use a local copy on disk.

Hence this change removes the need to copy the whole of the go installation to a
tempoorary location, then put the antlr go runtime in to the go installation as if it was
part of the compiler. Hence the execution time for the go tests is now faster than before.

This works because when the generated code is placed in the temporary location, we create
a go.mod file for it, tell the module to replace the online module for the go runtime with
the local copy on disk, then ro a go mod tidy to add the dependencies from the code (which
avoids network access, so it is instant), which adds the ANTLR dependency itself (which is
then replaced at compile time).

All go runtime tests now pass.

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Rm remote github actions; hosted seems to work

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* install golang with curl; go was missing from dev

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: Rework of all Hash() and Equals() methods - implement generic collections

 - Implement new collections using generics that implement the functionality
   required by the Java runtime in a more idiomatic Go way.
 - Fix Hash() and Equals() for all objects in the runtime
 - Fix getConflictingAlts so that it behaves the same way as Java, using a
   new generic collection
 - Replaces the use of the array2DHashSet, which was causing unneeded memory
   allocations. Replaced with generic collection that allocates minimally
   (though, I think I can improve on that with a little analysis).

Jim Idle - [email protected]

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #3718 Correct DFAState index in Lexer ATN Simulator

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* feat: Reduce initial memory allocations for collections

  - Many small collections are created at runtime, the default allocation for
    maps, even though small, still requires memory. Specifying a very small
    initial allocation prevents unnecesary allocations and has no measurable
    effect on performance. A small incremental change.

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #3758 Allow for string being a keyword and fix go template to use escapedName

  - The go template was ignoring the use of escapedName in many places and was
    not consistenet with the Java version.
  - Added 'string' to the list of reserved words for the Go target

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #3758 Add go.sum to the repo

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #3758 Ensure that standard runtime extensions are included in go.mod

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #2826  Go template is incorrect for dynamic scopes

closes #2826
obviates PR #3101

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #2016 - Generate correct iGo code for lists in a grammar, such as `label+=arg+`

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* feat: Bump poms to use 4.11 Snapshot

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* turn off Golang test at circleci for now

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Replace smart-quote with single-quote in code examples

Signed-off-by: Tim McCormack <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Augment error message during testing to include full cause of problem.

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Augment error message during testing to include full cause of problem. (round 2 to avoid null ptr)

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Cpp: Link to threads library

As detailed in #3708, it is necessary to link against the (p)threads
library in order to be able to use std::call_once without producing
linker errors.

Since this function is frequently used in ANTLR's cpp version, this
commit ensures that the respective library is always linked against in
order to avoid this error, even if downstream users are not explicitly
linking against an appropriate threads library.

Fixes #3708

Signed-off-by: Robert Adam <[email protected]>

Co-authored-by: Bryan Tan <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* add test for #2016 and fix java.

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* ensure all targets have the appropriate argument list for the template causing the problem.

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Fix other targets

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix format

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* add check that $args is a list

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* change made by @lingyv-li to fix bug in DART exposed by this test.

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix AssertIsList in multiple targets. Go doesn't pass test and has no AssertIsList so I'm dropping that test from the Go test suite.

How did a comment to the C++ runnerFor my future reference as to how to build things from the command line.

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* C++ gets an exception with this test so I'm turning it off. See antlr/antlr4#3845

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* feat: #3840 Move Go to version v4.11.0

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* feat: #3840 Create the v4 version of the Go runtime

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* feat: Create the v4 runtime layout for the Go runtime, ready for release tagging

Note that the vast majority of the changes here are just copying the runtime file in to
the /v4 subdirectory so that we can support legacy projects that use GOPATH only, as well
as users that can use go modules. At a later release, we will delete the default path, and move
the v4 subdirectory back to the top level. But, we cannot do that on this release.

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Reenable go tests on CircleCI

Signed-off-by: Ivan Kochurkin <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Fold constants in generated code for all runtimes

Go: getInlineTestSetWordSize 32 -> 64
Dart: get rid of BigInt
Swift: optimize TestSetInline
Python: fixes #3698
JavaScript: fixes #3699

Signed-off-by: Ivan Kochurkin <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Use int literals instead of refs for Python and JavaScript

Update getMultiTokenAlternativeDescriptor test

fixes #3703

Signed-off-by: Ivan Kochurkin <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* update release doc for Go version numbers

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* fix: #2016 Fix Go template list reference, go runtime and got test template for list labels

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* feat: Add a deprecation message to the existing v1 module

Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Split tool and runtime tests for GitHub workflow

Build only necessary modules for tests

Signed-off-by: Ivan Kochurkin <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Remove not used methods from FileUtils (runtime tests)

Signed-off-by: Ivan Kochurkin <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Update dependencies of antlr4-maven-plugin

Signed-off-by: Ivan Kochurkin <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Update jUnit: 5.8.2 -> 5.9.0

Signed-off-by: Ivan Kochurkin <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Fixes #3733; update ST4 so it uses proper ANTLR 3

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* tweak doc

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Set to 4.11.0 not 4.11 in poms

Signed-off-by: Eric Vergnaud <[email protected]>

* [maven-release-plugin] prepare release 4.11.0

Signed-off-by: Eric Vergnaud <[email protected]>

* [maven-release-plugin] prepare for next development iteration

Signed-off-by: Eric Vergnaud <[email protected]>

* Damn. java target said 4.10.2 not 4.11.0

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* roll back to 4.11.0; made mistake

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* roll back to 4.11.0; made mistake

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* [maven-release-plugin] prepare release antlr4-master-4.11.0

Signed-off-by: Eric Vergnaud <[email protected]>

* [maven-release-plugin] prepare for next development iteration

Signed-off-by: Eric Vergnaud <[email protected]>

* use build and twine to publish source and wheel

Signed-off-by: Qijia Liu <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* tweak doc

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* tweak c++ build script to make Mac binaries with cmake/make

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* tweak release doc

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* tweak code / doc related to bad previous release

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* [maven-release-plugin] prepare release 4.11.1

Signed-off-by: Eric Vergnaud <[email protected]>

* [maven-release-plugin] prepare for next development iteration

Signed-off-by: Eric Vergnaud <[email protected]>

* clean up deploy c++ source script

Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* cleanup code generation

Signed-off-by: Eric Vergnaud <[email protected]>

* don't initialize default param values twice

Signed-off-by: Eric Vergnaud <[email protected]>

* add missing field

Signed-off-by: Eric Vergnaud <[email protected]>

* update codegen template for 4.11.1

Signed-off-by: Eric Vergnaud <[email protected]>

* support new param: Parser

Signed-off-by: Eric Vergnaud <[email protected]>

* fix template for 4.11

Signed-off-by: Eric Vergnaud <[email protected]>

* default export Listener and Visitor

Signed-off-by: Eric Vergnaud <[email protected]>

* also default export parser and lexer

Signed-off-by: Eric Vergnaud <[email protected]>

* all tests pass except 7 caused by #3868

Signed-off-by: Eric Vergnaud <[email protected]>

* fix issues

Signed-off-by: Eric Vergnaud <[email protected]>

* make it easy to break

Signed-off-by: Eric Vergnaud <[email protected]>

* fix #3868

Signed-off-by: Eric Vergnaud <[email protected]>

* ALL TESTS PASS!!!!

Signed-off-by: Eric Vergnaud <[email protected]>

* cross fingers with CI

Signed-off-by: Eric Vergnaud <[email protected]>

* try fixing broken go tests

Signed-off-by: Eric Vergnaud <[email protected]>

* Try fix typescript CI

Signed-off-by: Eric Vergnaud <[email protected]>

* disable cpp for now

Signed-off-by: Eric Vergnaud <[email protected]>

* fix broken config

Signed-off-by: Eric Vergnaud <[email protected]>

* try fix macos gh build

Signed-off-by: Eric Vergnaud <[email protected]>

* improve speed by caching node_modules

Signed-off-by: Eric Vergnaud <[email protected]>

* no longer using ts-node

Signed-off-by: Eric Vergnaud <[email protected]>

* fix all tsc warnings

Signed-off-by: Eric Vergnaud <[email protected]>

* try fix MacOS CI

Signed-off-by: Eric Vergnaud <[email protected]>

* CI errors seem random, reactivate ubuntu

Signed-off-by: Eric Vergnaud <[email protected]>

* Disable node_modules caching, which seems to randomly fail in CI

Signed-off-by: Eric Vergnaud <[email protected]>

* don't delete symlink contents on windows (java bug with is SymbolicLink ?)

Signed-off-by: Eric Vergnaud <[email protected]>

* fix broken windows CI

Signed-off-by: ERIC-WINDOWS\ericv <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* verify windows ci

Signed-off-by: ERIC-WINDOWS\ericv <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>

* Revert "verify windows ci"

This reverts commit 770d8218ecbc1a94d60854d5b00cc3c761c3469c.

Signed-off-by: Eric Vergnaud <[email protected]>

* reinstate full CI

Signed-off-by: Eric Vergnaud <[email protected]>

* manually merged

* manually merge

* fix merge

* fix broken template

* add template for invoking context list

* fix typo

* fix test templates

* Add code of conduct but with a different name since I do not like that name

Signed-off-by: Terence Parr <[email protected]>

* Update C# release instructions

* Tweak code of conduct

Signed-off-by: Terence Parr <[email protected]>

* Bring back the Package.swift in the project's root

Signed-off-by: Nikolay Edigaryev <[email protected]>

* swift-target.md: fix SPM installation instructions

Signed-off-by: Nikolay Edigaryev <[email protected]>

* the scope (parser or lexer) in @parser::header was dropped, so keep track of it and only include @Header in Listener and Visitor code

Signed-off-by: Eric Vergnaud <[email protected]>

* drop workaround in favor of #3878

* drop cache usage since it fails in CI

* #3878 was missing some scenarios

* fix issue when deleting test folder

* fix warnings

* drop duplicate behavior

* drop alien 'abstractRecognizer' property

* drop alien property 'channels'

* fix various codegen issues

* change import

* restore js extensions, see microsoft/TypeScript#50501

* use consistent inheritance

* more API

* more API stuff

* fix typo

* fix typescript exports

* use ts-node to run typescript tests

* webpack runtime before linking

* fix exec paths on windows

Signed-off-by: ERIC-WINDOWS\ericv <[email protected]>

* fix failing tests

* fix a few import issues

* merge typescript-target with latest dev

* runs Java and JavaScript tests after merging typescript-target

* merge test template

* skip unsupported test

* fix template prototype

* fix missing merge

* bump typescript beta version after rebase

* update docs

* rollback unwanted changes

Signed-off-by: HS <[email protected]>
Signed-off-by: Eric Vergnaud <[email protected]>
Signed-off-by: nicksxs <[email protected]>
Signed-off-by: Terence Parr <[email protected]>
Signed-off-by: Hell_Ghost <[email protected]>
Signed-off-by: Hell_Ghost [email protected]
Signed-off-by: Ross Patterson <[email protected]>
Signed-off-by: James Taylor <[email protected]>
Signed-off-by: Bryan Tan <[email protected]>
Signed-off-by: Jim.Idle <[email protected]>
Signed-off-by: Tim McCormack <[email protected]>
Signed-off-by: Ivan Kochurkin <[email protected]>
Signed-off-by: Qijia Liu <[email protected]>
Signed-off-by: ERIC-WINDOWS\ericv <[email protected]>
Signed-off-by: Nikolay Edigaryev <[email protected]>
Co-authored-by: HS <[email protected]>
Co-authored-by: nicksxs <[email protected]>
Co-authored-by: Terence Parr <[email protected]>
Co-authored-by: Hell_Ghost <[email protected]>
Co-authored-by: Ross Patterson <[email protected]>
Co-authored-by: James Taylor <[email protected]>
Co-authored-by: Bryan Tan <[email protected]>
Co-authored-by: Jim.Idle <[email protected]>
Co-authored-by: Tim McCormack <[email protected]>
Co-authored-by: Robert Adam <[email protected]>
Co-authored-by: Bryan Tan <[email protected]>
Co-authored-by: Ivan Kochurkin <[email protected]>
Co-authored-by: Qijia Liu <[email protected]>
Co-authored-by: Nikolay Edigaryev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants