antlr4-runtime
Version:
JavaScript runtime for ANTLR4
25 lines (21 loc) • 884 B
JavaScript
/* Copyright (c) 2012-2022 The ANTLR Project Contributors. All rights reserved.
* Use is of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
import Transition from "./Transition.js";
export default class ActionTransition extends Transition {
constructor(target, ruleIndex, actionIndex, isCtxDependent) {
super(target);
this.serializationType = Transition.ACTION;
this.ruleIndex = ruleIndex;
this.actionIndex = actionIndex===undefined ? -1 : actionIndex;
this.isCtxDependent = isCtxDependent===undefined ? false : isCtxDependent; // e.g., $i ref in pred
this.isEpsilon = true;
}
matches(symbol, minVocabSymbol, maxVocabSymbol) {
return false;
}
toString() {
return "action_" + this.ruleIndex + ":" + this.actionIndex;
}
}