openpinescript 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openpinescript/__init__.py +129 -0
- openpinescript/__main__.py +5 -0
- openpinescript/_cli.py +24 -0
- openpinescript/_engine/LICENSE +674 -0
- openpinescript/_engine/VERSION +1 -0
- openpinescript/_engine/dist/cli.mjs +108691 -0
- openpinescript/_engine/node_modules/antlr4ng/LICENSE.txt +29 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATN.cjs +3159 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATN.js +3159 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATN.mjs +3139 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNConfig.cjs +911 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNConfig.js +911 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNConfig.mjs +891 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNConfigSet.cjs +3781 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNConfigSet.js +3781 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNConfigSet.mjs +3761 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNDeserializationOptions.cjs +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNDeserializationOptions.js +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNDeserializationOptions.mjs +0 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNDeserializer.cjs +4300 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNDeserializer.js +4300 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNDeserializer.mjs +4280 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNSerializer.cjs +4798 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNSerializer.js +4798 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNSerializer.mjs +4778 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNSimulator.cjs +982 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNSimulator.js +982 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNSimulator.mjs +962 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNState.cjs +85 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNState.js +85 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ATNState.mjs +67 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/AbstractPredicateTransition.cjs +78 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/AbstractPredicateTransition.js +78 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/AbstractPredicateTransition.mjs +58 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ActionTransition.cjs +96 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ActionTransition.js +96 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ActionTransition.mjs +76 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/AmbiguityInfo.cjs +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/AmbiguityInfo.js +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/AmbiguityInfo.mjs +0 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ArrayPredictionContext.cjs +243 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ArrayPredictionContext.js +243 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ArrayPredictionContext.mjs +223 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/AtomTransition.cjs +904 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/AtomTransition.js +904 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/AtomTransition.mjs +884 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/BasicBlockStartState.cjs +112 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/BasicBlockStartState.js +112 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/BasicBlockStartState.mjs +92 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/BasicState.cjs +95 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/BasicState.js +95 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/BasicState.mjs +75 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/BlockEndState.cjs +96 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/BlockEndState.js +96 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/BlockEndState.mjs +76 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/BlockStartState.cjs +104 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/BlockStartState.js +104 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/BlockStartState.mjs +84 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/CodePointTransitions.cjs +947 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/CodePointTransitions.js +947 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/CodePointTransitions.mjs +927 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ContextSensitivityInfo.cjs +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ContextSensitivityInfo.js +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ContextSensitivityInfo.mjs +0 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/DecisionEventInfo.cjs +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/DecisionEventInfo.js +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/DecisionEventInfo.mjs +0 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/DecisionInfo.cjs +206 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/DecisionInfo.js +206 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/DecisionInfo.mjs +188 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/DecisionState.cjs +96 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/DecisionState.js +96 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/DecisionState.mjs +76 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/EmptyPredictionContext.cjs +237 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/EmptyPredictionContext.js +237 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/EmptyPredictionContext.mjs +217 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/EpsilonTransition.cjs +103 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/EpsilonTransition.js +103 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/EpsilonTransition.mjs +83 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LL1Analyzer.cjs +3159 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LL1Analyzer.js +3159 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LL1Analyzer.mjs +3139 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerATNConfig.cjs +961 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerATNConfig.js +961 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerATNConfig.mjs +941 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerATNSimulator.cjs +5604 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerATNSimulator.js +5604 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerATNSimulator.mjs +5584 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerAction.cjs +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerAction.js +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerAction.mjs +0 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerActionExecutor.cjs +305 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerActionExecutor.js +305 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerActionExecutor.mjs +285 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerActionType.cjs +42 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerActionType.js +42 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerActionType.mjs +22 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerChannelAction.cjs +163 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerChannelAction.js +163 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerChannelAction.mjs +143 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerCustomAction.cjs +169 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerCustomAction.js +169 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerCustomAction.mjs +149 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerIndexedCustomAction.cjs +142 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerIndexedCustomAction.js +142 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerIndexedCustomAction.mjs +122 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerModeAction.cjs +163 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerModeAction.js +163 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerModeAction.mjs +143 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerMoreAction.cjs +73 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerMoreAction.js +73 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerMoreAction.mjs +53 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerPopModeAction.cjs +73 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerPopModeAction.js +73 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerPopModeAction.mjs +53 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerPushModeAction.cjs +163 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerPushModeAction.js +163 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerPushModeAction.mjs +143 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerSkipAction.cjs +71 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerSkipAction.js +71 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerSkipAction.mjs +51 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerTypeAction.cjs +159 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerTypeAction.js +159 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LexerTypeAction.mjs +139 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LookaheadEventInfo.cjs +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LookaheadEventInfo.js +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LookaheadEventInfo.mjs +0 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LoopEndState.cjs +96 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LoopEndState.js +96 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/LoopEndState.mjs +76 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/NotSetTransition.cjs +921 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/NotSetTransition.js +921 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/NotSetTransition.mjs +901 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/OrderedATNConfigSet.cjs +3824 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/OrderedATNConfigSet.js +3824 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/OrderedATNConfigSet.mjs +3804 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ParseInfo.cjs +156 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ParseInfo.js +156 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ParseInfo.mjs +138 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ParserATNSimulator.cjs +6082 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ParserATNSimulator.js +6082 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ParserATNSimulator.mjs +6062 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PlusBlockStartState.cjs +113 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PlusBlockStartState.js +113 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PlusBlockStartState.mjs +93 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PlusLoopbackState.cjs +104 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PlusLoopbackState.js +104 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PlusLoopbackState.mjs +84 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PrecedencePredicateTransition.cjs +887 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PrecedencePredicateTransition.js +887 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PrecedencePredicateTransition.mjs +867 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PredicateEvalInfo.cjs +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PredicateEvalInfo.js +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PredicateEvalInfo.mjs +0 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PredicateTransition.cjs +892 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PredicateTransition.js +892 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PredicateTransition.mjs +872 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PredictionContext.cjs +153 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PredictionContext.js +153 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PredictionContext.mjs +133 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PredictionContextCache.cjs +715 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PredictionContextCache.js +715 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PredictionContextCache.mjs +695 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PredictionContextUtils.cjs +3604 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PredictionContextUtils.js +3604 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PredictionContextUtils.mjs +3584 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PredictionMode.cjs +4284 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PredictionMode.js +4284 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/PredictionMode.mjs +4264 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ProfilingATNSimulator.cjs +6467 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ProfilingATNSimulator.js +6467 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/ProfilingATNSimulator.mjs +6447 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/RangeTransition.cjs +905 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/RangeTransition.js +905 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/RangeTransition.mjs +885 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/RuleStartState.cjs +97 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/RuleStartState.js +97 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/RuleStartState.mjs +77 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/RuleStopState.cjs +95 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/RuleStopState.js +95 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/RuleStopState.mjs +75 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/RuleTransition.cjs +93 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/RuleTransition.js +93 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/RuleTransition.mjs +73 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/SemanticContext.cjs +807 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/SemanticContext.js +807 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/SemanticContext.mjs +787 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/SetTransition.cjs +905 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/SetTransition.js +905 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/SetTransition.mjs +885 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/SingletonPredictionContext.cjs +207 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/SingletonPredictionContext.js +207 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/SingletonPredictionContext.mjs +187 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/StarBlockStartState.cjs +112 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/StarBlockStartState.js +112 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/StarBlockStartState.mjs +92 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/StarLoopEntryState.cjs +117 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/StarLoopEntryState.js +117 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/StarLoopEntryState.mjs +97 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/StarLoopbackState.cjs +95 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/StarLoopbackState.js +95 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/StarLoopbackState.mjs +75 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/TokensStartState.cjs +104 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/TokensStartState.js +104 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/TokensStartState.mjs +84 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/Transition.cjs +66 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/Transition.js +66 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/Transition.mjs +48 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/WildcardTransition.cjs +84 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/WildcardTransition.js +84 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/WildcardTransition.mjs +64 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/helpers.cjs +246 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/helpers.js +246 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/helpers.mjs +226 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/index.cjs +9485 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/index.js +9485 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/atn/index.mjs +9465 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/DFA.cjs +559 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/DFA.js +559 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/DFA.mjs +539 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/DFASerializer.cjs +76 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/DFASerializer.js +76 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/DFASerializer.mjs +58 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/DFAState.cjs +136 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/DFAState.js +136 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/DFAState.mjs +116 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/DFAStateEqualityComparator.cjs +150 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/DFAStateEqualityComparator.js +150 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/DFAStateEqualityComparator.mjs +130 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/LexerDFASerializer.cjs +237 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/LexerDFASerializer.js +237 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/LexerDFASerializer.mjs +217 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/PredPrediction.cjs +31 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/PredPrediction.js +31 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/PredPrediction.mjs +13 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/index.cjs +571 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/index.js +571 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/dfa/index.mjs +551 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/index.cjs +17501 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/index.mjs +17481 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/BitSet.cjs +208 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/BitSet.js +208 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/BitSet.mjs +190 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/DefaultEqualityComparator.cjs +68 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/DefaultEqualityComparator.js +68 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/DefaultEqualityComparator.mjs +48 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/EqualityComparator.cjs +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/EqualityComparator.js +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/EqualityComparator.mjs +0 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/HashMap.cjs +545 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/HashMap.js +545 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/HashMap.mjs +525 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/HashSet.cjs +438 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/HashSet.js +438 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/HashSet.mjs +418 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/InterpreterDataReader.cjs +4420 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/InterpreterDataReader.js +4420 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/InterpreterDataReader.mjs +4400 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/Interval.cjs +133 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/Interval.js +133 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/Interval.mjs +115 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/IntervalSet.cjs +834 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/IntervalSet.js +834 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/IntervalSet.mjs +814 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/MapKeyEqualityOperator.cjs +40 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/MapKeyEqualityOperator.js +40 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/MapKeyEqualityOperator.mjs +22 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/MultiMap.cjs +55 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/MultiMap.js +55 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/MultiMap.mjs +37 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/ObjectEqualityComparator.cjs +43 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/ObjectEqualityComparator.js +43 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/ObjectEqualityComparator.mjs +25 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/OrderedHashMap.cjs +610 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/OrderedHashMap.js +610 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/OrderedHashMap.mjs +590 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/OrderedHashSet.cjs +470 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/OrderedHashSet.js +470 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/OrderedHashSet.mjs +450 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/ParseCancellationException.cjs +34 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/ParseCancellationException.js +34 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/ParseCancellationException.mjs +16 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/index.cjs +4643 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/index.js +4643 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/misc/index.mjs +4623 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/AbstractParseTreeVisitor.cjs +63 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/AbstractParseTreeVisitor.js +63 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/AbstractParseTreeVisitor.mjs +45 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/ErrorNode.cjs +211 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/ErrorNode.js +211 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/ErrorNode.mjs +191 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/ParseTree.cjs +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/ParseTree.js +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/ParseTree.mjs +0 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/ParseTreeListener.cjs +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/ParseTreeListener.js +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/ParseTreeListener.mjs +0 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/ParseTreeVisitor.cjs +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/ParseTreeVisitor.js +17 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/ParseTreeVisitor.mjs +0 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/ParseTreeWalker.cjs +267 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/ParseTreeWalker.js +267 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/ParseTreeWalker.mjs +247 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/TerminalNode.cjs +201 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/TerminalNode.js +201 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/TerminalNode.mjs +181 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/Trees.cjs +3159 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/Trees.js +3159 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/Trees.mjs +3139 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/index.cjs +16018 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/index.js +16018 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/tree/index.mjs +15998 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/utils/DoubleDict.cjs +568 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/utils/DoubleDict.js +568 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/utils/DoubleDict.mjs +548 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/utils/MurmurHash.cjs +98 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/utils/MurmurHash.js +98 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/utils/MurmurHash.mjs +80 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/utils/helpers.cjs +78 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/utils/helpers.js +78 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/utils/helpers.mjs +60 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/utils/index.cjs +625 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/utils/index.js +625 -0
- openpinescript/_engine/node_modules/antlr4ng/dist/utils/index.mjs +605 -0
- openpinescript/_engine/node_modules/antlr4ng/package.json +72 -0
- openpinescript/_engine/package.json +94 -0
- openpinescript/_runtime.py +29 -0
- openpinescript-0.1.1.dist-info/METADATA +140 -0
- openpinescript-0.1.1.dist-info/RECORD +332 -0
- openpinescript-0.1.1.dist-info/WHEEL +4 -0
- openpinescript-0.1.1.dist-info/entry_points.txt +2 -0
- openpinescript-0.1.1.dist-info/licenses/LICENSE +674 -0
|
@@ -0,0 +1,962 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/utils/helpers.ts
|
|
5
|
+
var valueToString = /* @__PURE__ */ __name((v) => {
|
|
6
|
+
return v === null ? "null" : v;
|
|
7
|
+
}, "valueToString");
|
|
8
|
+
var arrayToString = /* @__PURE__ */ __name((value) => {
|
|
9
|
+
return Array.isArray(value) ? "[" + value.map(valueToString).join(", ") + "]" : "null";
|
|
10
|
+
}, "arrayToString");
|
|
11
|
+
var equalArrays = /* @__PURE__ */ __name((a, b) => {
|
|
12
|
+
if (a === b) {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
if (a.length !== b.length) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
for (let i = 0; i < a.length; i++) {
|
|
19
|
+
const left = a[i];
|
|
20
|
+
const right = b[i];
|
|
21
|
+
if (left === right) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (!left || !left.equals(right)) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}, "equalArrays");
|
|
30
|
+
var equalNumberArrays = /* @__PURE__ */ __name((a, b) => {
|
|
31
|
+
if (a === b) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
if (a.length !== b.length) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
for (let i = 0; i < a.length; i++) {
|
|
38
|
+
if (a[i] !== b[i]) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}, "equalNumberArrays");
|
|
44
|
+
|
|
45
|
+
// src/dfa/DFAState.ts
|
|
46
|
+
var DFAState = class _DFAState {
|
|
47
|
+
static {
|
|
48
|
+
__name(this, "DFAState");
|
|
49
|
+
}
|
|
50
|
+
stateNumber = -1;
|
|
51
|
+
configs;
|
|
52
|
+
/**
|
|
53
|
+
* `edges[symbol]` points to target of symbol. Shift up by 1 so (-1) {@link Token.EOF} maps to `edges[0]`.
|
|
54
|
+
*/
|
|
55
|
+
edges = [];
|
|
56
|
+
isAcceptState = false;
|
|
57
|
+
/**
|
|
58
|
+
* If accept state, what ttype do we match or alt do we predict? This is set to {@link ATN.INVALID_ALT_NUMBER}
|
|
59
|
+
* when {@link predicates} `!= null` or {@link requiresFullContext}.
|
|
60
|
+
*/
|
|
61
|
+
prediction = -1;
|
|
62
|
+
lexerActionExecutor = null;
|
|
63
|
+
/**
|
|
64
|
+
* Indicates that this state was created during SLL prediction that discovered a conflict between the configurations
|
|
65
|
+
* in the state. Future {@link ParserATNSimulator.execATN} invocations immediately jumped doing
|
|
66
|
+
* full context prediction if this field is true.
|
|
67
|
+
*/
|
|
68
|
+
requiresFullContext = false;
|
|
69
|
+
/**
|
|
70
|
+
* During SLL parsing, this is a list of predicates associated with the ATN configurations of the DFA state.
|
|
71
|
+
* When we have predicates, {@link requiresFullContext} is `false` since full context prediction evaluates
|
|
72
|
+
* predicates on-the-fly. If this is not null, then {@link prediction} is `ATN.INVALID_ALT_NUMBER`.
|
|
73
|
+
*
|
|
74
|
+
* We only use these for non-{@link #requiresFullContext} but conflicting states. That
|
|
75
|
+
* means we know from the context (it's $ or we don't dip into outer
|
|
76
|
+
* context) that it's an ambiguity not a conflict.
|
|
77
|
+
*
|
|
78
|
+
* This list is computed by {@link ParserATNSimulator#predicateDFAState}.
|
|
79
|
+
*/
|
|
80
|
+
predicates = null;
|
|
81
|
+
constructor(configs) {
|
|
82
|
+
if (configs) {
|
|
83
|
+
this.configs = configs;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
static fromState(stateNumber) {
|
|
87
|
+
const result = new _DFAState();
|
|
88
|
+
result.stateNumber = stateNumber;
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
static fromConfigs(configs) {
|
|
92
|
+
return new _DFAState(configs);
|
|
93
|
+
}
|
|
94
|
+
static hashCode(state) {
|
|
95
|
+
return state.configs.hashCode();
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Two {@link DFAState} instances are equal if their ATN configuration sets
|
|
99
|
+
* are the same. This method is used to see if a state already exists.
|
|
100
|
+
*
|
|
101
|
+
* Because the number of alternatives and number of ATN configurations are
|
|
102
|
+
* finite, there is a finite number of DFA states that can be processed.
|
|
103
|
+
* This is necessary to show that the algorithm terminates.
|
|
104
|
+
*
|
|
105
|
+
* Cannot test the DFA state numbers here because in
|
|
106
|
+
* {@link ParserATNSimulator#addDFAState} we need to know if any other state
|
|
107
|
+
* exists that has this exact set of ATN configurations. The
|
|
108
|
+
* {@link #stateNumber} is irrelevant.
|
|
109
|
+
*
|
|
110
|
+
* @param a The first {@link DFAState}.
|
|
111
|
+
* @param b The second {@link DFAState}.
|
|
112
|
+
*
|
|
113
|
+
* @returns `true` if the two states are equal, otherwise `false`.
|
|
114
|
+
*/
|
|
115
|
+
static equals(a, b) {
|
|
116
|
+
return a.configs.equals(b.configs);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* @returns the set of all alts mentioned by all ATN configurations in this DFA state.
|
|
120
|
+
*/
|
|
121
|
+
getAltSet() {
|
|
122
|
+
const alts = /* @__PURE__ */ new Set();
|
|
123
|
+
for (const config of this.configs) {
|
|
124
|
+
alts.add(config.alt);
|
|
125
|
+
}
|
|
126
|
+
if (alts.size === 0) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
return alts;
|
|
130
|
+
}
|
|
131
|
+
toString() {
|
|
132
|
+
let buf = "";
|
|
133
|
+
buf += this.stateNumber;
|
|
134
|
+
buf += ":";
|
|
135
|
+
buf += this.configs ? this.configs.toString() : "";
|
|
136
|
+
if (this.isAcceptState) {
|
|
137
|
+
buf += "=>";
|
|
138
|
+
if (this.predicates) {
|
|
139
|
+
buf += arrayToString(this.predicates);
|
|
140
|
+
} else {
|
|
141
|
+
buf += this.prediction;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return buf.toString();
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// src/misc/ObjectEqualityComparator.ts
|
|
149
|
+
var ObjectEqualityComparator = class _ObjectEqualityComparator {
|
|
150
|
+
static {
|
|
151
|
+
__name(this, "ObjectEqualityComparator");
|
|
152
|
+
}
|
|
153
|
+
static instance = new _ObjectEqualityComparator();
|
|
154
|
+
hashCode(obj) {
|
|
155
|
+
if (obj == null) {
|
|
156
|
+
return 0;
|
|
157
|
+
}
|
|
158
|
+
return obj.hashCode();
|
|
159
|
+
}
|
|
160
|
+
equals(a, b) {
|
|
161
|
+
if (a == null) {
|
|
162
|
+
return b == null;
|
|
163
|
+
}
|
|
164
|
+
return a.equals(b);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// src/misc/DefaultEqualityComparator.ts
|
|
169
|
+
var DefaultEqualityComparator = class _DefaultEqualityComparator {
|
|
170
|
+
static {
|
|
171
|
+
__name(this, "DefaultEqualityComparator");
|
|
172
|
+
}
|
|
173
|
+
static instance = new _DefaultEqualityComparator();
|
|
174
|
+
hashCode(obj) {
|
|
175
|
+
if (obj == null) {
|
|
176
|
+
return 0;
|
|
177
|
+
}
|
|
178
|
+
return ObjectEqualityComparator.instance.hashCode(obj);
|
|
179
|
+
}
|
|
180
|
+
equals(a, b) {
|
|
181
|
+
if (a == null) {
|
|
182
|
+
return b == null;
|
|
183
|
+
}
|
|
184
|
+
if (typeof a === "string" || typeof a === "number") {
|
|
185
|
+
return a === b;
|
|
186
|
+
}
|
|
187
|
+
return ObjectEqualityComparator.instance.equals(a, b);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
// src/utils/MurmurHash.ts
|
|
192
|
+
var c1 = 3432918353;
|
|
193
|
+
var c2 = 461845907;
|
|
194
|
+
var r1 = 15;
|
|
195
|
+
var r2 = 13;
|
|
196
|
+
var m = 5;
|
|
197
|
+
var n = 3864292196;
|
|
198
|
+
var MurmurHash = class _MurmurHash {
|
|
199
|
+
static {
|
|
200
|
+
__name(this, "MurmurHash");
|
|
201
|
+
}
|
|
202
|
+
static defaultSeed = 701;
|
|
203
|
+
constructor() {
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Initialize the hash using the specified {@code seed}.
|
|
207
|
+
*
|
|
208
|
+
* @param seed the seed
|
|
209
|
+
*
|
|
210
|
+
* @returns the intermediate hash value
|
|
211
|
+
*/
|
|
212
|
+
static initialize(seed = _MurmurHash.defaultSeed) {
|
|
213
|
+
return seed;
|
|
214
|
+
}
|
|
215
|
+
static updateFromComparable(hash, value) {
|
|
216
|
+
return this.update(hash, value?.hashCode() ?? 0);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Update the intermediate hash value for the next input {@code value}.
|
|
220
|
+
*
|
|
221
|
+
* @param hash The intermediate hash value.
|
|
222
|
+
* @param value the value to add to the current hash.
|
|
223
|
+
*
|
|
224
|
+
* @returns the updated intermediate hash value
|
|
225
|
+
*/
|
|
226
|
+
static update(hash, value) {
|
|
227
|
+
value = Math.imul(value, c1);
|
|
228
|
+
value = value << r1 | value >>> 32 - r1;
|
|
229
|
+
value = Math.imul(value, c2);
|
|
230
|
+
hash = hash ^ value;
|
|
231
|
+
hash = hash << r2 | hash >>> 32 - r2;
|
|
232
|
+
hash = Math.imul(hash, m) + n;
|
|
233
|
+
return hash;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Apply the final computation steps to the intermediate value {@code hash}
|
|
237
|
+
* to form the final result of the MurmurHash 3 hash function.
|
|
238
|
+
*
|
|
239
|
+
* @param hash The intermediate hash value.
|
|
240
|
+
* @param entryCount The number of values added to the hash.
|
|
241
|
+
*
|
|
242
|
+
* @returns the final hash result
|
|
243
|
+
*/
|
|
244
|
+
static finish(hash, entryCount) {
|
|
245
|
+
hash ^= entryCount * 4;
|
|
246
|
+
hash ^= hash >>> 16;
|
|
247
|
+
hash = Math.imul(hash, 2246822507);
|
|
248
|
+
hash ^= hash >>> 13;
|
|
249
|
+
hash = Math.imul(hash, 3266489909);
|
|
250
|
+
hash ^= hash >>> 16;
|
|
251
|
+
return hash;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* An all-in-one convenience method to compute a hash for a single value.
|
|
255
|
+
*
|
|
256
|
+
* @param value The value to hash.
|
|
257
|
+
* @param seed The seed for the hash value.
|
|
258
|
+
*
|
|
259
|
+
* @returns The computed hash.
|
|
260
|
+
*/
|
|
261
|
+
static hashCode(value, seed) {
|
|
262
|
+
return _MurmurHash.finish(_MurmurHash.update(seed ?? _MurmurHash.defaultSeed, value), 1);
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
// src/misc/HashSet.ts
|
|
267
|
+
var HashSet = class _HashSet {
|
|
268
|
+
static {
|
|
269
|
+
__name(this, "HashSet");
|
|
270
|
+
}
|
|
271
|
+
static defaultLoadFactor = 0.75;
|
|
272
|
+
static initialCapacity = 16;
|
|
273
|
+
// must be power of 2
|
|
274
|
+
comparator;
|
|
275
|
+
buckets;
|
|
276
|
+
threshold;
|
|
277
|
+
/** How many elements in set */
|
|
278
|
+
itemCount = 0;
|
|
279
|
+
constructor(comparatorOrSet, initialCapacity = _HashSet.initialCapacity) {
|
|
280
|
+
if (comparatorOrSet instanceof _HashSet) {
|
|
281
|
+
this.comparator = comparatorOrSet.comparator;
|
|
282
|
+
this.buckets = comparatorOrSet.buckets.slice(0);
|
|
283
|
+
for (let i = 0; i < this.buckets.length; i++) {
|
|
284
|
+
const bucket = this.buckets[i];
|
|
285
|
+
if (bucket) {
|
|
286
|
+
this.buckets[i] = bucket.slice(0);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
this.itemCount = comparatorOrSet.itemCount;
|
|
290
|
+
this.threshold = comparatorOrSet.threshold;
|
|
291
|
+
} else {
|
|
292
|
+
this.comparator = comparatorOrSet ?? DefaultEqualityComparator.instance;
|
|
293
|
+
this.buckets = this.createBuckets(initialCapacity);
|
|
294
|
+
this.threshold = Math.floor(_HashSet.initialCapacity * _HashSet.defaultLoadFactor);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Add `o` to set if not there; return existing value if already
|
|
299
|
+
* there. This method performs the same operation as {@link #add} aside from
|
|
300
|
+
* the return value.
|
|
301
|
+
*
|
|
302
|
+
* @param o the object to add to the set.
|
|
303
|
+
*
|
|
304
|
+
* @returns An existing element that equals to `o` if already in set, otherwise `o`.
|
|
305
|
+
*/
|
|
306
|
+
getOrAdd(o) {
|
|
307
|
+
if (this.itemCount > this.threshold) {
|
|
308
|
+
this.expand();
|
|
309
|
+
}
|
|
310
|
+
const b = this.getBucket(o);
|
|
311
|
+
let bucket = this.buckets[b];
|
|
312
|
+
if (!bucket) {
|
|
313
|
+
bucket = [o];
|
|
314
|
+
this.buckets[b] = bucket;
|
|
315
|
+
++this.itemCount;
|
|
316
|
+
return o;
|
|
317
|
+
}
|
|
318
|
+
for (const existing of bucket) {
|
|
319
|
+
if (this.comparator.equals(existing, o)) {
|
|
320
|
+
return existing;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
bucket.push(o);
|
|
324
|
+
++this.itemCount;
|
|
325
|
+
return o;
|
|
326
|
+
}
|
|
327
|
+
get(o) {
|
|
328
|
+
if (o == null) {
|
|
329
|
+
return o;
|
|
330
|
+
}
|
|
331
|
+
const b = this.getBucket(o);
|
|
332
|
+
const bucket = this.buckets[b];
|
|
333
|
+
if (!bucket) {
|
|
334
|
+
return void 0;
|
|
335
|
+
}
|
|
336
|
+
for (const e of bucket) {
|
|
337
|
+
if (this.comparator.equals(e, o)) {
|
|
338
|
+
return e;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return void 0;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Removes the specified element from this set if it is present.
|
|
345
|
+
*
|
|
346
|
+
* @param o object to be removed from this set, if present.
|
|
347
|
+
*
|
|
348
|
+
* @returns `true` if the set contained the specified element.
|
|
349
|
+
*/
|
|
350
|
+
remove(o) {
|
|
351
|
+
if (o == null) {
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
354
|
+
const b = this.getBucket(o);
|
|
355
|
+
const bucket = this.buckets[b];
|
|
356
|
+
if (!bucket) {
|
|
357
|
+
return false;
|
|
358
|
+
}
|
|
359
|
+
for (let i = 0; i < bucket.length; i++) {
|
|
360
|
+
const existing = bucket[i];
|
|
361
|
+
if (this.comparator.equals(existing, o)) {
|
|
362
|
+
bucket.splice(i, 1);
|
|
363
|
+
--this.itemCount;
|
|
364
|
+
return true;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return false;
|
|
368
|
+
}
|
|
369
|
+
hashCode() {
|
|
370
|
+
let hash = MurmurHash.initialize();
|
|
371
|
+
for (const bucket of this.buckets) {
|
|
372
|
+
if (bucket == null) {
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
for (const o of bucket) {
|
|
376
|
+
if (o == null) {
|
|
377
|
+
break;
|
|
378
|
+
}
|
|
379
|
+
hash = MurmurHash.update(hash, this.comparator.hashCode(o));
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
hash = MurmurHash.finish(hash, this.size);
|
|
383
|
+
return hash;
|
|
384
|
+
}
|
|
385
|
+
equals(o) {
|
|
386
|
+
if (o === this) {
|
|
387
|
+
return true;
|
|
388
|
+
}
|
|
389
|
+
if (!(o instanceof _HashSet)) {
|
|
390
|
+
return false;
|
|
391
|
+
}
|
|
392
|
+
if (o.size !== this.size) {
|
|
393
|
+
return false;
|
|
394
|
+
}
|
|
395
|
+
return this.containsAll(o);
|
|
396
|
+
}
|
|
397
|
+
add(t) {
|
|
398
|
+
const existing = this.getOrAdd(t);
|
|
399
|
+
return existing === t;
|
|
400
|
+
}
|
|
401
|
+
contains(o) {
|
|
402
|
+
return this.containsFast(o);
|
|
403
|
+
}
|
|
404
|
+
containsFast(obj) {
|
|
405
|
+
if (obj == null) {
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
return this.get(obj) !== void 0;
|
|
409
|
+
}
|
|
410
|
+
*[Symbol.iterator]() {
|
|
411
|
+
yield* this.toArray();
|
|
412
|
+
}
|
|
413
|
+
toArray() {
|
|
414
|
+
const a = new Array(this.size);
|
|
415
|
+
let i = 0;
|
|
416
|
+
for (const bucket of this.buckets) {
|
|
417
|
+
if (bucket == null) {
|
|
418
|
+
continue;
|
|
419
|
+
}
|
|
420
|
+
for (const o of bucket) {
|
|
421
|
+
if (o == null) {
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
a[i++] = o;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return a;
|
|
428
|
+
}
|
|
429
|
+
containsAll(collection) {
|
|
430
|
+
if (collection instanceof _HashSet) {
|
|
431
|
+
for (const bucket of collection.buckets) {
|
|
432
|
+
if (bucket == null) {
|
|
433
|
+
continue;
|
|
434
|
+
}
|
|
435
|
+
for (const o of bucket) {
|
|
436
|
+
if (o == null) {
|
|
437
|
+
break;
|
|
438
|
+
}
|
|
439
|
+
if (!this.containsFast(o)) {
|
|
440
|
+
return false;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
} else {
|
|
445
|
+
for (const o of collection) {
|
|
446
|
+
if (!this.containsFast(o)) {
|
|
447
|
+
return false;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
return true;
|
|
452
|
+
}
|
|
453
|
+
addAll(c) {
|
|
454
|
+
let changed = false;
|
|
455
|
+
for (const o of c) {
|
|
456
|
+
const existing = this.getOrAdd(o);
|
|
457
|
+
if (existing !== o) {
|
|
458
|
+
changed = true;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
return changed;
|
|
462
|
+
}
|
|
463
|
+
clear() {
|
|
464
|
+
this.buckets = this.createBuckets(_HashSet.initialCapacity);
|
|
465
|
+
this.itemCount = 0;
|
|
466
|
+
this.threshold = Math.floor(_HashSet.initialCapacity * _HashSet.defaultLoadFactor);
|
|
467
|
+
}
|
|
468
|
+
toString() {
|
|
469
|
+
if (this.size === 0) {
|
|
470
|
+
return "{}";
|
|
471
|
+
}
|
|
472
|
+
let buf = "{";
|
|
473
|
+
let first = true;
|
|
474
|
+
for (const bucket of this.buckets) {
|
|
475
|
+
if (bucket == null) {
|
|
476
|
+
continue;
|
|
477
|
+
}
|
|
478
|
+
for (const o of bucket) {
|
|
479
|
+
if (o == null) {
|
|
480
|
+
break;
|
|
481
|
+
}
|
|
482
|
+
if (first) {
|
|
483
|
+
first = false;
|
|
484
|
+
} else {
|
|
485
|
+
buf += ", ";
|
|
486
|
+
}
|
|
487
|
+
buf += o.toString();
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
buf += "}";
|
|
491
|
+
return buf;
|
|
492
|
+
}
|
|
493
|
+
toTableString() {
|
|
494
|
+
let buf = "";
|
|
495
|
+
for (const bucket of this.buckets) {
|
|
496
|
+
if (bucket == null) {
|
|
497
|
+
buf += "null\n";
|
|
498
|
+
continue;
|
|
499
|
+
}
|
|
500
|
+
buf += "[";
|
|
501
|
+
let first = true;
|
|
502
|
+
for (const o of bucket) {
|
|
503
|
+
if (first) {
|
|
504
|
+
first = false;
|
|
505
|
+
} else {
|
|
506
|
+
buf += " ";
|
|
507
|
+
}
|
|
508
|
+
if (o == null) {
|
|
509
|
+
buf += "_";
|
|
510
|
+
} else {
|
|
511
|
+
buf += o.toString();
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
buf += "]\n";
|
|
515
|
+
}
|
|
516
|
+
return buf;
|
|
517
|
+
}
|
|
518
|
+
getBucket(o) {
|
|
519
|
+
const hash = this.comparator.hashCode(o);
|
|
520
|
+
const b = hash & this.buckets.length - 1;
|
|
521
|
+
return b;
|
|
522
|
+
}
|
|
523
|
+
expand() {
|
|
524
|
+
const old = this.buckets;
|
|
525
|
+
const newCapacity = this.buckets.length * 2;
|
|
526
|
+
const newTable = this.createBuckets(newCapacity);
|
|
527
|
+
this.buckets = newTable;
|
|
528
|
+
this.threshold = Math.floor(newCapacity * _HashSet.defaultLoadFactor);
|
|
529
|
+
for (const bucket of old) {
|
|
530
|
+
if (!bucket) {
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
for (const o of bucket) {
|
|
534
|
+
const b = this.getBucket(o);
|
|
535
|
+
let newBucket = this.buckets[b];
|
|
536
|
+
if (!newBucket) {
|
|
537
|
+
newBucket = [];
|
|
538
|
+
this.buckets[b] = newBucket;
|
|
539
|
+
}
|
|
540
|
+
newBucket.push(o);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
get size() {
|
|
545
|
+
return this.itemCount;
|
|
546
|
+
}
|
|
547
|
+
get isEmpty() {
|
|
548
|
+
return this.itemCount === 0;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Return an array of `T[]` with length `capacity`.
|
|
552
|
+
*
|
|
553
|
+
* @param capacity the length of the array to return
|
|
554
|
+
* @returns the newly constructed array
|
|
555
|
+
*/
|
|
556
|
+
createBuckets(capacity) {
|
|
557
|
+
return new Array(capacity);
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
// src/misc/MapKeyEqualityOperator.ts
|
|
562
|
+
var MapKeyEqualityComparator = class {
|
|
563
|
+
static {
|
|
564
|
+
__name(this, "MapKeyEqualityComparator");
|
|
565
|
+
}
|
|
566
|
+
keyComparator;
|
|
567
|
+
constructor(keyComparator) {
|
|
568
|
+
this.keyComparator = keyComparator;
|
|
569
|
+
}
|
|
570
|
+
hashCode(obj) {
|
|
571
|
+
return this.keyComparator.hashCode(obj.key);
|
|
572
|
+
}
|
|
573
|
+
equals(a, b) {
|
|
574
|
+
return this.keyComparator.equals(a.key, b.key);
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
// src/misc/HashMap.ts
|
|
579
|
+
var HashMap = class _HashMap {
|
|
580
|
+
static {
|
|
581
|
+
__name(this, "HashMap");
|
|
582
|
+
}
|
|
583
|
+
backingStore;
|
|
584
|
+
constructor(keyComparer) {
|
|
585
|
+
if (keyComparer instanceof _HashMap) {
|
|
586
|
+
this.backingStore = new HashSet(keyComparer.backingStore);
|
|
587
|
+
} else {
|
|
588
|
+
keyComparer = keyComparer ?? DefaultEqualityComparator.instance;
|
|
589
|
+
this.backingStore = new HashSet(new MapKeyEqualityComparator(keyComparer));
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
clear() {
|
|
593
|
+
this.backingStore.clear();
|
|
594
|
+
}
|
|
595
|
+
containsKey(key) {
|
|
596
|
+
return this.backingStore.contains({ key });
|
|
597
|
+
}
|
|
598
|
+
get(key) {
|
|
599
|
+
const bucket = this.backingStore.get({ key });
|
|
600
|
+
if (!bucket) {
|
|
601
|
+
return void 0;
|
|
602
|
+
}
|
|
603
|
+
return bucket.value;
|
|
604
|
+
}
|
|
605
|
+
get isEmpty() {
|
|
606
|
+
return this.backingStore.isEmpty;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Sets the value for a key in the map. If the key is not present in the map, it is added.
|
|
610
|
+
* If the key is present, the value is updated and the old value is returned.
|
|
611
|
+
*
|
|
612
|
+
* @param key The key to set.
|
|
613
|
+
* @param value The value to set.
|
|
614
|
+
*
|
|
615
|
+
* @returns The old value for the key, if present.
|
|
616
|
+
*/
|
|
617
|
+
set(key, value) {
|
|
618
|
+
const element = this.backingStore.get({ key, value });
|
|
619
|
+
let result;
|
|
620
|
+
if (!element) {
|
|
621
|
+
this.backingStore.add({ key, value });
|
|
622
|
+
} else {
|
|
623
|
+
result = element.value;
|
|
624
|
+
element.value = value;
|
|
625
|
+
}
|
|
626
|
+
return result;
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* Sets the value for a key in the map if the key is not already present. Otherwise the value is not changed and
|
|
630
|
+
* the old value is returned.
|
|
631
|
+
*
|
|
632
|
+
* @param key The key to set.
|
|
633
|
+
* @param value The value to set.
|
|
634
|
+
*
|
|
635
|
+
* @returns The current value for the key, if present.
|
|
636
|
+
*/
|
|
637
|
+
setIfAbsent(key, value) {
|
|
638
|
+
const element = this.backingStore.get({ key, value });
|
|
639
|
+
let result;
|
|
640
|
+
if (!element) {
|
|
641
|
+
this.backingStore.add({ key, value });
|
|
642
|
+
} else {
|
|
643
|
+
result = element.value;
|
|
644
|
+
}
|
|
645
|
+
return result;
|
|
646
|
+
}
|
|
647
|
+
keys() {
|
|
648
|
+
return this.backingStore.toArray().map((bucket) => {
|
|
649
|
+
return bucket.key;
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
values() {
|
|
653
|
+
return this.backingStore.toArray().map((bucket) => {
|
|
654
|
+
return bucket.value;
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
get size() {
|
|
658
|
+
return this.backingStore.size;
|
|
659
|
+
}
|
|
660
|
+
hashCode() {
|
|
661
|
+
return this.backingStore.hashCode();
|
|
662
|
+
}
|
|
663
|
+
equals(o) {
|
|
664
|
+
return this.backingStore.equals(o.backingStore);
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
// src/atn/PredictionContext.ts
|
|
669
|
+
var PredictionContext = class _PredictionContext {
|
|
670
|
+
static {
|
|
671
|
+
__name(this, "PredictionContext");
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Represents `$` in an array in full context mode, when `$`
|
|
675
|
+
* doesn't mean wildcard: `$ + x = [$,x]`. Here,
|
|
676
|
+
* `$` = {@link EMPTY_RETURN_STATE}.
|
|
677
|
+
*/
|
|
678
|
+
static EMPTY_RETURN_STATE = 2147483647;
|
|
679
|
+
static traceATNSimulator = false;
|
|
680
|
+
cachedHashCode;
|
|
681
|
+
constructor(cachedHashCode) {
|
|
682
|
+
this.cachedHashCode = cachedHashCode;
|
|
683
|
+
}
|
|
684
|
+
static calculateEmptyHashCode() {
|
|
685
|
+
let hash = MurmurHash.initialize(31);
|
|
686
|
+
hash = MurmurHash.finish(hash, 0);
|
|
687
|
+
return hash;
|
|
688
|
+
}
|
|
689
|
+
static calculateHashCodeSingle(parent, returnState) {
|
|
690
|
+
let hash = MurmurHash.initialize(31);
|
|
691
|
+
hash = MurmurHash.updateFromComparable(hash, parent);
|
|
692
|
+
hash = MurmurHash.update(hash, returnState);
|
|
693
|
+
hash = MurmurHash.finish(hash, 2);
|
|
694
|
+
return hash;
|
|
695
|
+
}
|
|
696
|
+
static calculateHashCodeList(parents, returnStates) {
|
|
697
|
+
let hash = MurmurHash.initialize(31);
|
|
698
|
+
for (const parent of parents) {
|
|
699
|
+
hash = MurmurHash.updateFromComparable(hash, parent);
|
|
700
|
+
}
|
|
701
|
+
for (const returnState of returnStates) {
|
|
702
|
+
hash = MurmurHash.update(hash, returnState);
|
|
703
|
+
}
|
|
704
|
+
hash = MurmurHash.finish(hash, 2 * parents.length);
|
|
705
|
+
return hash;
|
|
706
|
+
}
|
|
707
|
+
isEmpty() {
|
|
708
|
+
return false;
|
|
709
|
+
}
|
|
710
|
+
hasEmptyPath() {
|
|
711
|
+
return this.getReturnState(this.length - 1) === _PredictionContext.EMPTY_RETURN_STATE;
|
|
712
|
+
}
|
|
713
|
+
hashCode() {
|
|
714
|
+
return this.cachedHashCode;
|
|
715
|
+
}
|
|
716
|
+
toString(_recog) {
|
|
717
|
+
return "";
|
|
718
|
+
}
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
// src/atn/SingletonPredictionContext.ts
|
|
722
|
+
var SingletonPredictionContext = class _SingletonPredictionContext extends PredictionContext {
|
|
723
|
+
static {
|
|
724
|
+
__name(this, "SingletonPredictionContext");
|
|
725
|
+
}
|
|
726
|
+
parent;
|
|
727
|
+
returnState;
|
|
728
|
+
constructor(parent, returnState) {
|
|
729
|
+
super(
|
|
730
|
+
parent ? PredictionContext.calculateHashCodeSingle(parent, returnState) : PredictionContext.calculateEmptyHashCode()
|
|
731
|
+
);
|
|
732
|
+
this.parent = parent ?? null;
|
|
733
|
+
this.returnState = returnState;
|
|
734
|
+
}
|
|
735
|
+
getParent(_index) {
|
|
736
|
+
return this.parent;
|
|
737
|
+
}
|
|
738
|
+
getReturnState(_index) {
|
|
739
|
+
return this.returnState;
|
|
740
|
+
}
|
|
741
|
+
equals(other) {
|
|
742
|
+
if (this === other) {
|
|
743
|
+
return true;
|
|
744
|
+
}
|
|
745
|
+
if (!(other instanceof _SingletonPredictionContext)) {
|
|
746
|
+
return false;
|
|
747
|
+
}
|
|
748
|
+
if (this.hashCode() !== other.hashCode()) {
|
|
749
|
+
return false;
|
|
750
|
+
}
|
|
751
|
+
if (this.returnState !== other.returnState) {
|
|
752
|
+
return false;
|
|
753
|
+
}
|
|
754
|
+
if (this.parent == null) {
|
|
755
|
+
return other.parent == null;
|
|
756
|
+
}
|
|
757
|
+
return this.parent.equals(other.parent);
|
|
758
|
+
}
|
|
759
|
+
toString() {
|
|
760
|
+
const up = this.parent === null ? "" : this.parent.toString();
|
|
761
|
+
if (up.length === 0) {
|
|
762
|
+
if (this.returnState === PredictionContext.EMPTY_RETURN_STATE) {
|
|
763
|
+
return "$";
|
|
764
|
+
}
|
|
765
|
+
return "" + this.returnState;
|
|
766
|
+
} else {
|
|
767
|
+
return "" + this.returnState + " " + up;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
get length() {
|
|
771
|
+
return 1;
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
|
|
775
|
+
// src/atn/EmptyPredictionContext.ts
|
|
776
|
+
var EmptyPredictionContext = class _EmptyPredictionContext extends SingletonPredictionContext {
|
|
777
|
+
static {
|
|
778
|
+
__name(this, "EmptyPredictionContext");
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Represents `$` in local context prediction, which means wildcard.
|
|
782
|
+
* `*+x = *`.
|
|
783
|
+
*/
|
|
784
|
+
static instance = new _EmptyPredictionContext();
|
|
785
|
+
constructor() {
|
|
786
|
+
super(void 0, PredictionContext.EMPTY_RETURN_STATE);
|
|
787
|
+
}
|
|
788
|
+
isEmpty() {
|
|
789
|
+
return true;
|
|
790
|
+
}
|
|
791
|
+
getParent() {
|
|
792
|
+
return null;
|
|
793
|
+
}
|
|
794
|
+
getReturnState() {
|
|
795
|
+
return this.returnState;
|
|
796
|
+
}
|
|
797
|
+
equals(other) {
|
|
798
|
+
return this === other;
|
|
799
|
+
}
|
|
800
|
+
toString() {
|
|
801
|
+
return "$";
|
|
802
|
+
}
|
|
803
|
+
};
|
|
804
|
+
|
|
805
|
+
// src/atn/helpers.ts
|
|
806
|
+
var createSingletonPredictionContext = /* @__PURE__ */ __name((parent, returnState) => {
|
|
807
|
+
if (returnState === PredictionContext.EMPTY_RETURN_STATE && parent === null) {
|
|
808
|
+
return EmptyPredictionContext.instance;
|
|
809
|
+
} else {
|
|
810
|
+
return new SingletonPredictionContext(parent, returnState);
|
|
811
|
+
}
|
|
812
|
+
}, "createSingletonPredictionContext");
|
|
813
|
+
|
|
814
|
+
// src/atn/ArrayPredictionContext.ts
|
|
815
|
+
var ArrayPredictionContext = class _ArrayPredictionContext extends PredictionContext {
|
|
816
|
+
static {
|
|
817
|
+
__name(this, "ArrayPredictionContext");
|
|
818
|
+
}
|
|
819
|
+
parents = [];
|
|
820
|
+
returnStates = [];
|
|
821
|
+
constructor(parents, returnStates) {
|
|
822
|
+
super(PredictionContext.calculateHashCodeList(parents, returnStates));
|
|
823
|
+
this.parents = parents;
|
|
824
|
+
this.returnStates = returnStates;
|
|
825
|
+
return this;
|
|
826
|
+
}
|
|
827
|
+
isEmpty() {
|
|
828
|
+
return this.returnStates[0] === PredictionContext.EMPTY_RETURN_STATE;
|
|
829
|
+
}
|
|
830
|
+
get length() {
|
|
831
|
+
return this.returnStates.length;
|
|
832
|
+
}
|
|
833
|
+
getParent(index) {
|
|
834
|
+
return this.parents[index];
|
|
835
|
+
}
|
|
836
|
+
getReturnState(index) {
|
|
837
|
+
return this.returnStates[index];
|
|
838
|
+
}
|
|
839
|
+
equals(other) {
|
|
840
|
+
if (this === other) {
|
|
841
|
+
return true;
|
|
842
|
+
}
|
|
843
|
+
if (!(other instanceof _ArrayPredictionContext) || this.hashCode() !== other.hashCode()) {
|
|
844
|
+
return false;
|
|
845
|
+
}
|
|
846
|
+
return equalNumberArrays(this.returnStates, other.returnStates) && equalArrays(this.parents, other.parents);
|
|
847
|
+
}
|
|
848
|
+
toString() {
|
|
849
|
+
if (this.isEmpty()) {
|
|
850
|
+
return "[]";
|
|
851
|
+
}
|
|
852
|
+
const entries = [];
|
|
853
|
+
for (let i = 0; i < this.returnStates.length; i++) {
|
|
854
|
+
if (this.returnStates[i] === PredictionContext.EMPTY_RETURN_STATE) {
|
|
855
|
+
entries.push("$");
|
|
856
|
+
continue;
|
|
857
|
+
}
|
|
858
|
+
entries.push(this.returnStates[i].toString());
|
|
859
|
+
if (this.parents[i]) {
|
|
860
|
+
entries.push(this.parents[i].toString());
|
|
861
|
+
} else {
|
|
862
|
+
entries.push("null");
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
return `[${entries.join(", ")}]`;
|
|
866
|
+
}
|
|
867
|
+
};
|
|
868
|
+
|
|
869
|
+
// src/atn/PredictionContextUtils.ts
|
|
870
|
+
var getCachedPredictionContext = /* @__PURE__ */ __name((context, contextCache, visited) => {
|
|
871
|
+
if (context.isEmpty()) {
|
|
872
|
+
return context;
|
|
873
|
+
}
|
|
874
|
+
let existing = visited.get(context);
|
|
875
|
+
if (existing) {
|
|
876
|
+
return existing;
|
|
877
|
+
}
|
|
878
|
+
existing = contextCache.get(context);
|
|
879
|
+
if (existing) {
|
|
880
|
+
visited.set(context, existing);
|
|
881
|
+
return existing;
|
|
882
|
+
}
|
|
883
|
+
let changed = false;
|
|
884
|
+
let parents = [];
|
|
885
|
+
for (let i = 0; i < parents.length; i++) {
|
|
886
|
+
const parent = getCachedPredictionContext(context.getParent(i), contextCache, visited);
|
|
887
|
+
if (changed || parent !== context.getParent(i)) {
|
|
888
|
+
if (!changed) {
|
|
889
|
+
parents = [];
|
|
890
|
+
for (let j = 0; j < context.length; j++) {
|
|
891
|
+
parents[j] = context.getParent(j);
|
|
892
|
+
}
|
|
893
|
+
changed = true;
|
|
894
|
+
}
|
|
895
|
+
parents[i] = parent;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
if (!changed) {
|
|
899
|
+
contextCache.add(context);
|
|
900
|
+
visited.set(context, context);
|
|
901
|
+
return context;
|
|
902
|
+
}
|
|
903
|
+
let updated;
|
|
904
|
+
if (parents.length === 0) {
|
|
905
|
+
updated = EmptyPredictionContext.instance;
|
|
906
|
+
} else if (parents.length === 1) {
|
|
907
|
+
updated = createSingletonPredictionContext(parents[0] ?? void 0, context.getReturnState(0));
|
|
908
|
+
} else {
|
|
909
|
+
updated = new ArrayPredictionContext(parents, context.returnStates);
|
|
910
|
+
}
|
|
911
|
+
contextCache.add(updated);
|
|
912
|
+
visited.set(updated, updated);
|
|
913
|
+
visited.set(context, updated);
|
|
914
|
+
return updated;
|
|
915
|
+
}, "getCachedPredictionContext");
|
|
916
|
+
|
|
917
|
+
// src/atn/ATNSimulator.ts
|
|
918
|
+
var ATNSimulator = class {
|
|
919
|
+
static {
|
|
920
|
+
__name(this, "ATNSimulator");
|
|
921
|
+
}
|
|
922
|
+
/** Must distinguish between missing edge and edge we know leads nowhere */
|
|
923
|
+
static ERROR = DFAState.fromState(2147483647);
|
|
924
|
+
atn;
|
|
925
|
+
/**
|
|
926
|
+
* The context cache maps all PredictionContext objects that are ==
|
|
927
|
+
* to a single cached copy. This cache is shared across all contexts
|
|
928
|
+
* in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet
|
|
929
|
+
* to use only cached nodes/graphs in addDFAState(). We don't want to
|
|
930
|
+
* fill this during closure() since there are lots of contexts that
|
|
931
|
+
* pop up but are not used ever again. It also greatly slows down closure().
|
|
932
|
+
*
|
|
933
|
+
* This cache makes a huge difference in memory and a little bit in speed.
|
|
934
|
+
* For the Java grammar on java.*, it dropped the memory requirements
|
|
935
|
+
* at the end from 25M to 16M. We don't store any of the full context
|
|
936
|
+
* graphs in the DFA because they are limited to local context only,
|
|
937
|
+
* but apparently there's a lot of repetition there as well. We optimize
|
|
938
|
+
* the config contexts before storing the config set in the DFA states
|
|
939
|
+
* by literally rebuilding them with cached subgraphs only.
|
|
940
|
+
*
|
|
941
|
+
* I tried a cache for use during closure operations, that was
|
|
942
|
+
* whacked after each adaptivePredict(). It cost a little bit
|
|
943
|
+
* more time I think and doesn't save on the overall footprint
|
|
944
|
+
* so it's not worth the complexity.
|
|
945
|
+
*/
|
|
946
|
+
sharedContextCache;
|
|
947
|
+
constructor(atn, sharedContextCache) {
|
|
948
|
+
this.atn = atn;
|
|
949
|
+
this.sharedContextCache = sharedContextCache;
|
|
950
|
+
return this;
|
|
951
|
+
}
|
|
952
|
+
getCachedContext(context) {
|
|
953
|
+
if (!this.sharedContextCache) {
|
|
954
|
+
return context;
|
|
955
|
+
}
|
|
956
|
+
const visited = new HashMap(ObjectEqualityComparator.instance);
|
|
957
|
+
return getCachedPredictionContext(context, this.sharedContextCache, visited);
|
|
958
|
+
}
|
|
959
|
+
};
|
|
960
|
+
export {
|
|
961
|
+
ATNSimulator
|
|
962
|
+
};
|