├── .gitignore
├── LICENSE
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── a4455jkjh
│ │ └── textview
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ ├── a.txt
│ │ └── monospace.ttf
│ ├── java
│ │ ├── com
│ │ │ └── a4455jkjh
│ │ │ │ ├── textview
│ │ │ │ ├── App.java
│ │ │ │ └── MainActivity.java
│ │ │ │ └── view
│ │ │ │ ├── EditText.java
│ │ │ │ ├── EditorSettings.java
│ │ │ │ ├── Highlighting.java
│ │ │ │ ├── Span.java
│ │ │ │ ├── TextStyle.java
│ │ │ │ ├── TextView.java
│ │ │ │ ├── UndoManager.java
│ │ │ │ └── highlighting
│ │ │ │ ├── SmaliHighlighting.java
│ │ │ │ └── smali
│ │ │ │ └── SmaliLexer.java
│ │ └── org
│ │ │ └── antlr
│ │ │ └── v4
│ │ │ └── runtime
│ │ │ ├── ANTLRErrorListener.java
│ │ │ ├── ANTLRErrorStrategy.java
│ │ │ ├── ANTLRFileStream.java
│ │ │ ├── ANTLRInputStream.java
│ │ │ ├── BailErrorStrategy.java
│ │ │ ├── BaseErrorListener.java
│ │ │ ├── BufferedTokenStream.java
│ │ │ ├── CharStream.java
│ │ │ ├── CharStreams.java
│ │ │ ├── CodePointBuffer.java
│ │ │ ├── CodePointCharStream.java
│ │ │ ├── CommonToken.java
│ │ │ ├── CommonTokenFactory.java
│ │ │ ├── CommonTokenStream.java
│ │ │ ├── ConsoleErrorListener.java
│ │ │ ├── DefaultErrorStrategy.java
│ │ │ ├── DiagnosticErrorListener.java
│ │ │ ├── FailedPredicateException.java
│ │ │ ├── InputMismatchException.java
│ │ │ ├── IntStream.java
│ │ │ ├── InterpreterRuleContext.java
│ │ │ ├── Lexer.java
│ │ │ ├── LexerInterpreter.java
│ │ │ ├── LexerNoViableAltException.java
│ │ │ ├── ListTokenSource.java
│ │ │ ├── NoViableAltException.java
│ │ │ ├── Parser.java
│ │ │ ├── ParserInterpreter.java
│ │ │ ├── ParserRuleContext.java
│ │ │ ├── ProxyErrorListener.java
│ │ │ ├── RecognitionException.java
│ │ │ ├── Recognizer.java
│ │ │ ├── RuleContext.java
│ │ │ ├── RuleContextWithAltNum.java
│ │ │ ├── RuntimeMetaData.java
│ │ │ ├── Scanner.java
│ │ │ ├── ScannerImpl.java
│ │ │ ├── Token.java
│ │ │ ├── TokenFactory.java
│ │ │ ├── TokenSource.java
│ │ │ ├── TokenStream.java
│ │ │ ├── TokenStreamRewriter.java
│ │ │ ├── UnbufferedCharStream.java
│ │ │ ├── UnbufferedTokenStream.java
│ │ │ ├── Vocabulary.java
│ │ │ ├── VocabularyImpl.java
│ │ │ ├── WritableToken.java
│ │ │ ├── atn
│ │ │ ├── ATN.java
│ │ │ ├── ATNConfig.java
│ │ │ ├── ATNConfigSet.java
│ │ │ ├── ATNDeserializationOptions.java
│ │ │ ├── ATNDeserializer.java
│ │ │ ├── ATNSerializer.java
│ │ │ ├── ATNSimulator.java
│ │ │ ├── ATNState.java
│ │ │ ├── ATNType.java
│ │ │ ├── AbstractPredicateTransition.java
│ │ │ ├── ActionTransition.java
│ │ │ ├── AmbiguityInfo.java
│ │ │ ├── ArrayPredictionContext.java
│ │ │ ├── AtomTransition.java
│ │ │ ├── BasicBlockStartState.java
│ │ │ ├── BasicState.java
│ │ │ ├── BlockEndState.java
│ │ │ ├── BlockStartState.java
│ │ │ ├── CodePointTransitions.java
│ │ │ ├── ContextSensitivityInfo.java
│ │ │ ├── DecisionEventInfo.java
│ │ │ ├── DecisionInfo.java
│ │ │ ├── DecisionState.java
│ │ │ ├── EmptyPredictionContext.java
│ │ │ ├── EpsilonTransition.java
│ │ │ ├── ErrorInfo.java
│ │ │ ├── LL1Analyzer.java
│ │ │ ├── LexerATNConfig.java
│ │ │ ├── LexerATNSimulator.java
│ │ │ ├── LexerAction.java
│ │ │ ├── LexerActionExecutor.java
│ │ │ ├── LexerActionType.java
│ │ │ ├── LexerChannelAction.java
│ │ │ ├── LexerCustomAction.java
│ │ │ ├── LexerIndexedCustomAction.java
│ │ │ ├── LexerModeAction.java
│ │ │ ├── LexerMoreAction.java
│ │ │ ├── LexerPopModeAction.java
│ │ │ ├── LexerPushModeAction.java
│ │ │ ├── LexerSkipAction.java
│ │ │ ├── LexerTypeAction.java
│ │ │ ├── LookaheadEventInfo.java
│ │ │ ├── LoopEndState.java
│ │ │ ├── NotSetTransition.java
│ │ │ ├── OrderedATNConfigSet.java
│ │ │ ├── ParseInfo.java
│ │ │ ├── ParserATNSimulator.java
│ │ │ ├── PlusBlockStartState.java
│ │ │ ├── PlusLoopbackState.java
│ │ │ ├── PrecedencePredicateTransition.java
│ │ │ ├── PredicateEvalInfo.java
│ │ │ ├── PredicateTransition.java
│ │ │ ├── PredictionContext.java
│ │ │ ├── PredictionContextCache.java
│ │ │ ├── PredictionMode.java
│ │ │ ├── ProfilingATNSimulator.java
│ │ │ ├── RangeTransition.java
│ │ │ ├── RuleStartState.java
│ │ │ ├── RuleStopState.java
│ │ │ ├── RuleTransition.java
│ │ │ ├── SemanticContext.java
│ │ │ ├── SetTransition.java
│ │ │ ├── SingletonPredictionContext.java
│ │ │ ├── StarBlockStartState.java
│ │ │ ├── StarLoopEntryState.java
│ │ │ ├── StarLoopbackState.java
│ │ │ ├── TokensStartState.java
│ │ │ ├── Transition.java
│ │ │ └── WildcardTransition.java
│ │ │ ├── dfa
│ │ │ ├── DFA.java
│ │ │ ├── DFASerializer.java
│ │ │ ├── DFAState.java
│ │ │ └── LexerDFASerializer.java
│ │ │ ├── misc
│ │ │ ├── AbstractEqualityComparator.java
│ │ │ ├── Array2DHashSet.java
│ │ │ ├── DoubleKeyMap.java
│ │ │ ├── EqualityComparator.java
│ │ │ ├── FlexibleHashMap.java
│ │ │ ├── IntSet.java
│ │ │ ├── IntegerList.java
│ │ │ ├── IntegerStack.java
│ │ │ ├── InterpreterDataReader.java
│ │ │ ├── Interval.java
│ │ │ ├── IntervalSet.java
│ │ │ ├── LogManager.java
│ │ │ ├── MultiMap.java
│ │ │ ├── MurmurHash.java
│ │ │ ├── NotNull.java
│ │ │ ├── ObjectEqualityComparator.java
│ │ │ ├── OrderedHashSet.java
│ │ │ ├── Pair.java
│ │ │ ├── ParseCancellationException.java
│ │ │ ├── Predicate.java
│ │ │ ├── TestRig.java
│ │ │ ├── Triple.java
│ │ │ └── Utils.java
│ │ │ └── tree
│ │ │ ├── AbstractParseTreeVisitor.java
│ │ │ ├── ErrorNode.java
│ │ │ ├── ErrorNodeImpl.java
│ │ │ ├── IterativeParseTreeWalker.java
│ │ │ ├── ParseTree.java
│ │ │ ├── ParseTreeListener.java
│ │ │ ├── ParseTreeProperty.java
│ │ │ ├── ParseTreeVisitor.java
│ │ │ ├── ParseTreeWalker.java
│ │ │ ├── RuleNode.java
│ │ │ ├── SyntaxTree.java
│ │ │ ├── TerminalNode.java
│ │ │ ├── TerminalNodeImpl.java
│ │ │ ├── Tree.java
│ │ │ ├── Trees.java
│ │ │ ├── pattern
│ │ │ ├── Chunk.java
│ │ │ ├── ParseTreeMatch.java
│ │ │ ├── ParseTreePattern.java
│ │ │ ├── ParseTreePatternMatcher.java
│ │ │ ├── RuleTagToken.java
│ │ │ ├── TagChunk.java
│ │ │ ├── TextChunk.java
│ │ │ └── TokenTagToken.java
│ │ │ └── xpath
│ │ │ ├── XPath.java
│ │ │ ├── XPathElement.java
│ │ │ ├── XPathLexer.java
│ │ │ ├── XPathLexerErrorListener.java
│ │ │ ├── XPathRuleAnywhereElement.java
│ │ │ ├── XPathRuleElement.java
│ │ │ ├── XPathTokenAnywhereElement.java
│ │ │ ├── XPathTokenElement.java
│ │ │ ├── XPathWildcardAnywhereElement.java
│ │ │ └── XPathWildcardElement.java
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── menu
│ │ ├── editor_context.xml
│ │ └── main.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── values-v21
│ │ └── styles.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── a4455jkjh
│ └── textview
│ └── ExampleUnitTest.java
├── build.gradle
├── dom
├── .gitignore
├── build.gradle
├── consumer-rules.pro
├── libs
│ └── ecj.jar
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── org
│ │ └── eclipse
│ │ └── jdt
│ │ └── core
│ │ └── dom
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── org
│ │ │ └── eclipse
│ │ │ ├── core
│ │ │ ├── commands
│ │ │ │ ├── ExecutionException.java
│ │ │ │ ├── common
│ │ │ │ │ └── CommandException.java
│ │ │ │ ├── operations
│ │ │ │ │ ├── AbstractOperation.java
│ │ │ │ │ ├── DefaultOperationHistory.java
│ │ │ │ │ ├── IAdvancedUndoableOperation.java
│ │ │ │ │ ├── ICompositeOperation.java
│ │ │ │ │ ├── IContextReplacingOperation.java
│ │ │ │ │ ├── IOperationApprover.java
│ │ │ │ │ ├── IOperationApprover2.java
│ │ │ │ │ ├── IOperationHistory.java
│ │ │ │ │ ├── IOperationHistoryListener.java
│ │ │ │ │ ├── IUndoContext.java
│ │ │ │ │ ├── IUndoableOperation.java
│ │ │ │ │ ├── ObjectUndoContext.java
│ │ │ │ │ ├── OperationHistoryEvent.java
│ │ │ │ │ ├── OperationHistoryFactory.java
│ │ │ │ │ ├── OperationStatus.java
│ │ │ │ │ └── UndoContext.java
│ │ │ │ └── util
│ │ │ │ │ └── Tracing.java
│ │ │ ├── internal
│ │ │ │ ├── commands
│ │ │ │ │ └── operations
│ │ │ │ │ │ └── GlobalUndoContext.java
│ │ │ │ └── runtime
│ │ │ │ │ ├── LocalizationUtils.java
│ │ │ │ │ └── PrintStackUtil.java
│ │ │ └── runtime
│ │ │ │ ├── Assert.java
│ │ │ │ ├── AssertionFailedException.java
│ │ │ │ ├── CoreException.java
│ │ │ │ ├── IAdaptable.java
│ │ │ │ ├── IProgressMonitor.java
│ │ │ │ ├── ISafeRunnable.java
│ │ │ │ ├── IStatus.java
│ │ │ │ ├── ListenerList.java
│ │ │ │ ├── OperationCanceledException.java
│ │ │ │ ├── SafeRunner.java
│ │ │ │ └── Status.java
│ │ │ ├── jdt
│ │ │ ├── core
│ │ │ │ ├── JavaCore.java
│ │ │ │ └── dom
│ │ │ │ │ ├── AST.java
│ │ │ │ │ ├── ASTConverter.java
│ │ │ │ │ ├── ASTMatcher.java
│ │ │ │ │ ├── ASTNode.java
│ │ │ │ │ ├── ASTParser.java
│ │ │ │ │ ├── ASTRecoveryPropagator.java
│ │ │ │ │ ├── ASTSyntaxErrorPropagator.java
│ │ │ │ │ ├── ASTVisitor.java
│ │ │ │ │ ├── AbstractTypeDeclaration.java
│ │ │ │ │ ├── AnnotatableType.java
│ │ │ │ │ ├── Annotation.java
│ │ │ │ │ ├── AnnotationTypeDeclaration.java
│ │ │ │ │ ├── AnnotationTypeMemberDeclaration.java
│ │ │ │ │ ├── AnonymousClassDeclaration.java
│ │ │ │ │ ├── ArrayAccess.java
│ │ │ │ │ ├── ArrayCreation.java
│ │ │ │ │ ├── ArrayInitializer.java
│ │ │ │ │ ├── ArrayType.java
│ │ │ │ │ ├── AssertStatement.java
│ │ │ │ │ ├── Assignment.java
│ │ │ │ │ ├── Block.java
│ │ │ │ │ ├── BlockComment.java
│ │ │ │ │ ├── BodyDeclaration.java
│ │ │ │ │ ├── BooleanLiteral.java
│ │ │ │ │ ├── BreakStatement.java
│ │ │ │ │ ├── CastExpression.java
│ │ │ │ │ ├── CatchClause.java
│ │ │ │ │ ├── CharacterLiteral.java
│ │ │ │ │ ├── ChildListPropertyDescriptor.java
│ │ │ │ │ ├── ChildPropertyDescriptor.java
│ │ │ │ │ ├── ClassInstanceCreation.java
│ │ │ │ │ ├── Comment.java
│ │ │ │ │ ├── CompilationUnit.java
│ │ │ │ │ ├── CompilationUnitResolver.java
│ │ │ │ │ ├── ConditionalExpression.java
│ │ │ │ │ ├── ConstructorInvocation.java
│ │ │ │ │ ├── ContinueStatement.java
│ │ │ │ │ ├── CreationReference.java
│ │ │ │ │ ├── DefaultASTVisitor.java
│ │ │ │ │ ├── DefaultCommentMapper.java
│ │ │ │ │ ├── Dimension.java
│ │ │ │ │ ├── DoStatement.java
│ │ │ │ │ ├── DocCommentParser.java
│ │ │ │ │ ├── EmptyStatement.java
│ │ │ │ │ ├── EnhancedForStatement.java
│ │ │ │ │ ├── EnumConstantDeclaration.java
│ │ │ │ │ ├── EnumDeclaration.java
│ │ │ │ │ ├── Expression.java
│ │ │ │ │ ├── ExpressionMethodReference.java
│ │ │ │ │ ├── ExpressionStatement.java
│ │ │ │ │ ├── FieldAccess.java
│ │ │ │ │ ├── FieldDeclaration.java
│ │ │ │ │ ├── ForStatement.java
│ │ │ │ │ ├── IDocElement.java
│ │ │ │ │ ├── IExtendedModifier.java
│ │ │ │ │ ├── IfStatement.java
│ │ │ │ │ ├── ImportDeclaration.java
│ │ │ │ │ ├── InfixExpression.java
│ │ │ │ │ ├── Initializer.java
│ │ │ │ │ ├── InstanceofExpression.java
│ │ │ │ │ ├── IntersectionType.java
│ │ │ │ │ ├── Javadoc.java
│ │ │ │ │ ├── LabeledStatement.java
│ │ │ │ │ ├── LambdaExpression.java
│ │ │ │ │ ├── LineComment.java
│ │ │ │ │ ├── MarkerAnnotation.java
│ │ │ │ │ ├── MemberRef.java
│ │ │ │ │ ├── MemberValuePair.java
│ │ │ │ │ ├── Message.java
│ │ │ │ │ ├── MethodDeclaration.java
│ │ │ │ │ ├── MethodInvocation.java
│ │ │ │ │ ├── MethodRef.java
│ │ │ │ │ ├── MethodRefParameter.java
│ │ │ │ │ ├── MethodReference.java
│ │ │ │ │ ├── Modifier.java
│ │ │ │ │ ├── Name.java
│ │ │ │ │ ├── NameQualifiedType.java
│ │ │ │ │ ├── NodeEventHandler.java
│ │ │ │ │ ├── NormalAnnotation.java
│ │ │ │ │ ├── NullLiteral.java
│ │ │ │ │ ├── NumberLiteral.java
│ │ │ │ │ ├── PackageDeclaration.java
│ │ │ │ │ ├── ParameterizedType.java
│ │ │ │ │ ├── ParenthesizedExpression.java
│ │ │ │ │ ├── PostfixExpression.java
│ │ │ │ │ ├── PrefixExpression.java
│ │ │ │ │ ├── PrimitiveType.java
│ │ │ │ │ ├── QualifiedName.java
│ │ │ │ │ ├── QualifiedType.java
│ │ │ │ │ ├── ReturnStatement.java
│ │ │ │ │ ├── SimpleName.java
│ │ │ │ │ ├── SimplePropertyDescriptor.java
│ │ │ │ │ ├── SimpleType.java
│ │ │ │ │ ├── SingleMemberAnnotation.java
│ │ │ │ │ ├── SingleVariableDeclaration.java
│ │ │ │ │ ├── Statement.java
│ │ │ │ │ ├── StringLiteral.java
│ │ │ │ │ ├── StructuralPropertyDescriptor.java
│ │ │ │ │ ├── SuperConstructorInvocation.java
│ │ │ │ │ ├── SuperFieldAccess.java
│ │ │ │ │ ├── SuperMethodInvocation.java
│ │ │ │ │ ├── SuperMethodReference.java
│ │ │ │ │ ├── SwitchCase.java
│ │ │ │ │ ├── SwitchStatement.java
│ │ │ │ │ ├── SynchronizedStatement.java
│ │ │ │ │ ├── TagElement.java
│ │ │ │ │ ├── TextElement.java
│ │ │ │ │ ├── ThisExpression.java
│ │ │ │ │ ├── ThrowStatement.java
│ │ │ │ │ ├── TryStatement.java
│ │ │ │ │ ├── Type.java
│ │ │ │ │ ├── TypeDeclaration.java
│ │ │ │ │ ├── TypeDeclarationStatement.java
│ │ │ │ │ ├── TypeLiteral.java
│ │ │ │ │ ├── TypeMethodReference.java
│ │ │ │ │ ├── TypeParameter.java
│ │ │ │ │ ├── UnionType.java
│ │ │ │ │ ├── VariableDeclaration.java
│ │ │ │ │ ├── VariableDeclarationExpression.java
│ │ │ │ │ ├── VariableDeclarationFragment.java
│ │ │ │ │ ├── VariableDeclarationStatement.java
│ │ │ │ │ ├── WhileStatement.java
│ │ │ │ │ └── WildcardType.java
│ │ │ └── internal
│ │ │ │ └── core
│ │ │ │ ├── BasicCompilationUnit.java
│ │ │ │ └── util
│ │ │ │ ├── CodeSnippetParsingUtil.java
│ │ │ │ ├── CommentRecorderParser.java
│ │ │ │ └── RecordedParsingInformation.java
│ │ │ ├── jface
│ │ │ └── text
│ │ │ │ ├── AbstractDocument.java
│ │ │ │ ├── AbstractLineTracker.java
│ │ │ │ ├── BadLocationException.java
│ │ │ │ ├── BadPartitioningException.java
│ │ │ │ ├── BadPositionCategoryException.java
│ │ │ │ ├── ConfigurableLineTracker.java
│ │ │ │ ├── CopyOnWriteTextStore.java
│ │ │ │ ├── DefaultLineTracker.java
│ │ │ │ ├── DefaultPositionUpdater.java
│ │ │ │ ├── Document.java
│ │ │ │ ├── DocumentAdapter.java
│ │ │ │ ├── DocumentClone.java
│ │ │ │ ├── DocumentEvent.java
│ │ │ │ ├── DocumentPartitioningChangedEvent.java
│ │ │ │ ├── DocumentRewriteSession.java
│ │ │ │ ├── DocumentRewriteSessionEvent.java
│ │ │ │ ├── DocumentRewriteSessionType.java
│ │ │ │ ├── FindReplaceDocumentAdapter.java
│ │ │ │ ├── GapTextStore.java
│ │ │ │ ├── IDocument.java
│ │ │ │ ├── IDocumentExtension.java
│ │ │ │ ├── IDocumentExtension2.java
│ │ │ │ ├── IDocumentExtension3.java
│ │ │ │ ├── IDocumentExtension4.java
│ │ │ │ ├── IDocumentListener.java
│ │ │ │ ├── IDocumentPartitioner.java
│ │ │ │ ├── IDocumentPartitionerExtension.java
│ │ │ │ ├── IDocumentPartitionerExtension2.java
│ │ │ │ ├── IDocumentPartitionerExtension3.java
│ │ │ │ ├── IDocumentPartitioningListener.java
│ │ │ │ ├── IDocumentPartitioningListenerExtension.java
│ │ │ │ ├── IDocumentPartitioningListenerExtension2.java
│ │ │ │ ├── IDocumentRewriteSessionListener.java
│ │ │ │ ├── ILineTracker.java
│ │ │ │ ├── ILineTrackerExtension.java
│ │ │ │ ├── IPositionUpdater.java
│ │ │ │ ├── IRegion.java
│ │ │ │ ├── IRepairableDocument.java
│ │ │ │ ├── IRepairableDocumentExtension.java
│ │ │ │ ├── ITextStore.java
│ │ │ │ ├── ITypedRegion.java
│ │ │ │ ├── Line.java
│ │ │ │ ├── ListLineTracker.java
│ │ │ │ ├── Position.java
│ │ │ │ ├── Region.java
│ │ │ │ ├── TextChangeListener.java
│ │ │ │ ├── TextChangingEvent.java
│ │ │ │ ├── TextMessages.java
│ │ │ │ ├── TextMessages.properties
│ │ │ │ ├── TextUtilities.java
│ │ │ │ ├── TreeLineTracker.java
│ │ │ │ └── TypedRegion.java
│ │ │ └── text
│ │ │ ├── edits
│ │ │ ├── CopySourceEdit.java
│ │ │ ├── CopyTargetEdit.java
│ │ │ ├── CopyingRangeMarker.java
│ │ │ ├── DeleteEdit.java
│ │ │ ├── EditDocument.java
│ │ │ ├── ISourceModifier.java
│ │ │ ├── InsertEdit.java
│ │ │ ├── MalformedTreeException.java
│ │ │ ├── Messages.properties
│ │ │ ├── MoveSourceEdit.java
│ │ │ ├── MoveTargetEdit.java
│ │ │ ├── MultiTextEdit.java
│ │ │ ├── RangeMarker.java
│ │ │ ├── ReplaceEdit.java
│ │ │ ├── TextEdit.java
│ │ │ ├── TextEditCopier.java
│ │ │ ├── TextEditMessages.java
│ │ │ ├── TextEditProcessor.java
│ │ │ ├── TextEditVisitor.java
│ │ │ ├── UndoCollector.java
│ │ │ └── UndoEdit.java
│ │ │ └── undo
│ │ │ ├── DocumentUndoEvent.java
│ │ │ ├── DocumentUndoManager.java
│ │ │ ├── DocumentUndoManagerRegistry.java
│ │ │ ├── IDocumentUndoListener.java
│ │ │ ├── IDocumentUndoManager.java
│ │ │ ├── UndoMessages.java
│ │ │ └── UndoMessages.properties
│ └── res
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── org
│ └── eclipse
│ └── jdt
│ └── core
│ └── dom
│ └── ExampleUnitTest.java
├── formatter
├── .gitignore
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── org
│ │ └── eclipse
│ │ └── jdt
│ │ └── core
│ │ └── formatter
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── org
│ │ │ └── eclipse
│ │ │ └── jdt
│ │ │ ├── core
│ │ │ └── formatter
│ │ │ │ ├── CodeFormatter.java
│ │ │ │ ├── DefaultCodeFormatterConstants.java
│ │ │ │ ├── IndentManipulation.java
│ │ │ │ ├── messages.properties
│ │ │ │ └── package.html
│ │ │ └── internal
│ │ │ └── formatter
│ │ │ ├── CommentsPreparator.java
│ │ │ ├── DefaultCodeFormatter.java
│ │ │ ├── DefaultCodeFormatterOptions.java
│ │ │ ├── LineBreaksPreparator.java
│ │ │ ├── SpacePreparator.java
│ │ │ ├── TextEditsBuilder.java
│ │ │ ├── Token.java
│ │ │ ├── TokenManager.java
│ │ │ ├── TokenTraverser.java
│ │ │ └── linewrap
│ │ │ ├── CommentWrapExecutor.java
│ │ │ ├── FieldAligner.java
│ │ │ ├── WrapExecutor.java
│ │ │ └── WrapPreparator.java
│ └── res
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── org
│ └── eclipse
│ └── jdt
│ └── core
│ └── formatter
│ └── ExampleUnitTest.java
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TextView
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 29
5 | buildToolsVersion "29.0.2"
6 | defaultConfig {
7 | applicationId "com.a4455jkjh.textview"
8 | minSdkVersion 15
9 | targetSdkVersion 29
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | implementation fileTree(dir: 'libs', include: ['*.jar'])
24 | implementation project(':formatter')
25 | }
26 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/a4455jkjh/textview/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.a4455jkjh.textview;
2 |
3 | import android.content.Context;
4 | import androidx.test.platform.app.InstrumentationRegistry;
5 | import androidx.test.ext.junit.runners.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
23 |
24 | assertEquals("com.a4455jkjh.textview", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
22 | * This implementation prints messages to {@link System#err} containing the 23 | * values of {@code line}, {@code charPositionInLine}, and {@code msg} using 24 | * the following format.
25 | * 26 | *27 | * line line:charPositionInLine msg 28 | *29 | */ 30 | @Override 31 | public void syntaxError(Recognizer, ?> recognizer, 32 | Object offendingSymbol, 33 | int line, 34 | int charPositionInLine, 35 | String msg, 36 | RecognitionException e) 37 | { 38 | System.err.println("line " + line + ":" + charPositionInLine + " " + msg); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/InputMismatchException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | package org.antlr.v4.runtime; 7 | 8 | /** This signifies any kind of mismatched input exceptions such as 9 | * when the current input does not match the expected token. 10 | */ 11 | public class InputMismatchException extends RecognitionException { 12 | public InputMismatchException(Parser recognizer) { 13 | super(recognizer, recognizer.getInputStream(), recognizer._ctx); 14 | this.setOffendingToken(recognizer.getCurrentToken()); 15 | } 16 | 17 | public InputMismatchException(Parser recognizer, int state, ParserRuleContext ctx) { 18 | super(recognizer, recognizer.getInputStream(), ctx); 19 | this.setOffendingState(state); 20 | this.setOffendingToken(recognizer.getCurrentToken()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/InterpreterRuleContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | package org.antlr.v4.runtime; 7 | 8 | /** 9 | * This class extends {@link ParserRuleContext} by allowing the value of 10 | * {@link #getRuleIndex} to be explicitly set for the context. 11 | * 12 | *
13 | * {@link ParserRuleContext} does not include field storage for the rule index 14 | * since the context classes created by the code generator override the 15 | * {@link #getRuleIndex} method to return the correct value for that context. 16 | * Since the parser interpreter does not use the context classes generated for a 17 | * parser, this class (with slightly more memory overhead per node) is used to 18 | * provide equivalent functionality.
19 | */ 20 | public class InterpreterRuleContext extends ParserRuleContext { 21 | /** This is the backing field for {@link #getRuleIndex}. */ 22 | protected int ruleIndex = -1; 23 | 24 | public InterpreterRuleContext() { } 25 | 26 | /** 27 | * Constructs a new {@link InterpreterRuleContext} with the specified 28 | * parent, invoking state, and rule index. 29 | * 30 | * @param parent The parent context. 31 | * @param invokingStateNumber The invoking state number. 32 | * @param ruleIndex The rule index for the current context. 33 | */ 34 | public InterpreterRuleContext(ParserRuleContext parent, 35 | int invokingStateNumber, 36 | int ruleIndex) 37 | { 38 | super(parent, invokingStateNumber); 39 | this.ruleIndex = ruleIndex; 40 | } 41 | 42 | @Override 43 | public int getRuleIndex() { 44 | return ruleIndex; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/LexerNoViableAltException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime; 8 | 9 | import org.antlr.v4.runtime.atn.ATNConfigSet; 10 | import org.antlr.v4.runtime.misc.Interval; 11 | import org.antlr.v4.runtime.misc.Utils; 12 | 13 | import java.util.Locale; 14 | 15 | public class LexerNoViableAltException extends RecognitionException { 16 | /** Matching attempted at what input index? */ 17 | private final int startIndex; 18 | 19 | /** Which configurations did we try at input.index() that couldn't match input.LA(1)? */ 20 | private final ATNConfigSet deadEndConfigs; 21 | 22 | public LexerNoViableAltException(Lexer lexer, 23 | CharStream input, 24 | int startIndex, 25 | ATNConfigSet deadEndConfigs) { 26 | super(lexer, input, null); 27 | this.startIndex = startIndex; 28 | this.deadEndConfigs = deadEndConfigs; 29 | } 30 | 31 | public int getStartIndex() { 32 | return startIndex; 33 | } 34 | 35 | 36 | public ATNConfigSet getDeadEndConfigs() { 37 | return deadEndConfigs; 38 | } 39 | 40 | @Override 41 | public CharStream getInputStream() { 42 | return (CharStream)super.getInputStream(); 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | String symbol = ""; 48 | if (startIndex >= 0 && startIndex < getInputStream().size()) { 49 | symbol = getInputStream().getText(Interval.of(startIndex,startIndex)); 50 | symbol = Utils.escapeWhitespace(symbol, false); 51 | } 52 | 53 | return String.format(Locale.getDefault(), "%s('%s')", LexerNoViableAltException.class.getSimpleName(), symbol); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/NoViableAltException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | package org.antlr.v4.runtime; 7 | 8 | import org.antlr.v4.runtime.atn.ATNConfigSet; 9 | 10 | /** Indicates that the parser could not decide which of two or more paths 11 | * to take based upon the remaining input. It tracks the starting token 12 | * of the offending input and also knows where the parser was 13 | * in the various paths when the error. Reported by reportNoViableAlternative() 14 | */ 15 | public class NoViableAltException extends RecognitionException { 16 | /** Which configurations did we try at input.index() that couldn't match input.LT(1)? */ 17 | 18 | private final ATNConfigSet deadEndConfigs; 19 | 20 | /** The token object at the start index; the input stream might 21 | * not be buffering tokens so get a reference to it. (At the 22 | * time the error occurred, of course the stream needs to keep a 23 | * buffer all of the tokens but later we might not have access to those.) 24 | */ 25 | 26 | private final Token startToken; 27 | 28 | public NoViableAltException(Parser recognizer) { // LL(1) error 29 | this(recognizer, 30 | recognizer.getInputStream(), 31 | recognizer.getCurrentToken(), 32 | recognizer.getCurrentToken(), 33 | null, 34 | recognizer._ctx); 35 | } 36 | 37 | public NoViableAltException(Parser recognizer, 38 | TokenStream input, 39 | Token startToken, 40 | Token offendingToken, 41 | ATNConfigSet deadEndConfigs, 42 | ParserRuleContext ctx) 43 | { 44 | super(recognizer, input, ctx); 45 | this.deadEndConfigs = deadEndConfigs; 46 | this.startToken = startToken; 47 | this.setOffendingToken(offendingToken); 48 | } 49 | 50 | 51 | public Token getStartToken() { 52 | return startToken; 53 | } 54 | 55 | 56 | public ATNConfigSet getDeadEndConfigs() { 57 | return deadEndConfigs; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/RuleContextWithAltNum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime; 8 | 9 | import org.antlr.v4.runtime.atn.ATN; 10 | 11 | /** A handy class for use with 12 | * 13 | * options {contextSuperClass=org.antlr.v4.runtime.RuleContextWithAltNum;} 14 | * 15 | * that provides a backing field / impl for the outer alternative number 16 | * matched for an internal parse tree node. 17 | * 18 | * I'm only putting into Java runtime as I'm certain I'm the only one that 19 | * will really every use this. 20 | */ 21 | public class RuleContextWithAltNum extends ParserRuleContext { 22 | public int altNum; 23 | public RuleContextWithAltNum() { altNum = ATN.INVALID_ALT_NUMBER; } 24 | 25 | public RuleContextWithAltNum(ParserRuleContext parent, int invokingStateNumber) { 26 | super(parent, invokingStateNumber); 27 | } 28 | @Override public int getAltNumber() { return altNum; } 29 | @Override public void setAltNumber(int altNum) { this.altNum = altNum; } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/Scanner.java: -------------------------------------------------------------------------------- 1 | package org.antlr.v4.runtime; 2 | 3 | public interface Scanner { 4 | /** 5 | * Return a {@link Token} object from your input stream (usually a 6 | * {@link CharStream}). Do not fail/return upon lexing error; keep chewing 7 | * on the characters until you get a good one; errors are not passed through 8 | * to the parser. 9 | */ 10 | public Token nextToken(); 11 | 12 | /** 13 | * Set the {@link TokenFactory} this token source should use for creating 14 | * {@link Token} objects from the input. 15 | * 16 | * @param factory The {@link TokenFactory} to use for creating tokens. 17 | */ 18 | public void setTokenFactory(TokenFactory> factory); 19 | 20 | /** 21 | * Gets the {@link TokenFactory} this token source is currently using for 22 | * creating {@link Token} objects from the input. 23 | * 24 | * @return The {@link TokenFactory} currently used by this token source. 25 | */ 26 | public TokenFactory> getTokenFactory(); 27 | 28 | /** 29 | * Gets the name of the underlying input source. This method returns a 30 | * non-null, non-empty string. If such a name is not known, this method 31 | * returns {@link IntStream#UNKNOWN_SOURCE_NAME}. 32 | */ 33 | public String getSourceName(); 34 | 35 | /** 36 | * Get the line number for the current position in the input stream. The 37 | * first line in the input is line 1. 38 | * 39 | * @return The line number for the current position in the input stream, or 40 | * 0 if the current token source does not track line numbers. 41 | */ 42 | public int getLine(); 43 | 44 | /** 45 | * Get the index into the current line for the current position in the input 46 | * stream. The first character on a line has position 0. 47 | * 48 | * @return The line number for the current position in the input stream, or 49 | * -1 if the current token source does not track character positions. 50 | */ 51 | public int getCharPositionInLine(); 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/TokenFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime; 8 | 9 | import org.antlr.v4.runtime.misc.Pair; 10 | 11 | /** The default mechanism for creating tokens. It's used by default in Lexer and 12 | * the error handling strategy (to create missing tokens). Notifying the parser 13 | * of a new factory means that it notifies its token source and error strategy. 14 | */ 15 | public interface TokenFactoryErrors from the lexer are never passed to the parser. Either you want to keep 15 | * going or you do not upon token recognition error. If you do not want to 16 | * continue lexing then you do not want to continue parsing. Just throw an 17 | * exception not under {@link RecognitionException} and Java will naturally toss 18 | * you all the way out of the recognizers. If you want to continue lexing then 19 | * you should not throw an exception to the parser--it has already requested a 20 | * token. Keep lexing until you get a valid one. Just report errors and keep 21 | * going, looking for a valid token.
22 | */ 23 | public interface TokenSource extends Scanner{ 24 | 25 | /** 26 | * Get the {@link CharStream} from which this token source is currently 27 | * providing tokens. 28 | * 29 | * @return The {@link CharStream} associated with the current position in 30 | * the input, or {@code null} if no input stream is available for the token 31 | * source. 32 | */ 33 | public CharStream getInputStream(); 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/WritableToken.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime; 8 | 9 | public interface WritableToken extends Token { 10 | public void setText(String text); 11 | 12 | public void setType(int ttype); 13 | 14 | public void setLine(int line); 15 | 16 | public void setCharPositionInLine(int pos); 17 | 18 | public void setChannel(int channel); 19 | 20 | public void setTokenIndex(int index); 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/ATNDeserializationOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | /** 10 | * 11 | * @author Sam Harwell 12 | */ 13 | public class ATNDeserializationOptions { 14 | private static final ATNDeserializationOptions defaultOptions; 15 | static { 16 | defaultOptions = new ATNDeserializationOptions(); 17 | defaultOptions.makeReadOnly(); 18 | } 19 | 20 | private boolean readOnly; 21 | private boolean verifyATN; 22 | private boolean generateRuleBypassTransitions; 23 | 24 | public ATNDeserializationOptions() { 25 | this.verifyATN = true; 26 | this.generateRuleBypassTransitions = false; 27 | } 28 | 29 | public ATNDeserializationOptions(ATNDeserializationOptions options) { 30 | this.verifyATN = options.verifyATN; 31 | this.generateRuleBypassTransitions = options.generateRuleBypassTransitions; 32 | } 33 | 34 | 35 | public static ATNDeserializationOptions getDefaultOptions() { 36 | return defaultOptions; 37 | } 38 | 39 | public final boolean isReadOnly() { 40 | return readOnly; 41 | } 42 | 43 | public final void makeReadOnly() { 44 | readOnly = true; 45 | } 46 | 47 | public final boolean isVerifyATN() { 48 | return verifyATN; 49 | } 50 | 51 | public final void setVerifyATN(boolean verifyATN) { 52 | throwIfReadOnly(); 53 | this.verifyATN = verifyATN; 54 | } 55 | 56 | public final boolean isGenerateRuleBypassTransitions() { 57 | return generateRuleBypassTransitions; 58 | } 59 | 60 | public final void setGenerateRuleBypassTransitions(boolean generateRuleBypassTransitions) { 61 | throwIfReadOnly(); 62 | this.generateRuleBypassTransitions = generateRuleBypassTransitions; 63 | } 64 | 65 | protected void throwIfReadOnly() { 66 | if (isReadOnly()) { 67 | throw new IllegalStateException("The object is read only."); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/ATNType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | /** 10 | * Represents the type of recognizer an ATN applies to. 11 | * 12 | * @author Sam Harwell 13 | */ 14 | public enum ATNType { 15 | 16 | /** 17 | * A lexer grammar. 18 | */ 19 | LEXER, 20 | 21 | /** 22 | * A parser grammar. 23 | */ 24 | PARSER, 25 | 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/AbstractPredicateTransition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | /** 10 | * 11 | * @author Sam Harwell 12 | */ 13 | public abstract class AbstractPredicateTransition extends Transition { 14 | 15 | public AbstractPredicateTransition(ATNState target) { 16 | super(target); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/ActionTransition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | public final class ActionTransition extends Transition { 10 | public final int ruleIndex; 11 | public final int actionIndex; 12 | public final boolean isCtxDependent; // e.g., $i ref in action 13 | 14 | public ActionTransition(ATNState target, int ruleIndex) { 15 | this(target, ruleIndex, -1, false); 16 | } 17 | 18 | public ActionTransition(ATNState target, int ruleIndex, int actionIndex, boolean isCtxDependent) { 19 | super(target); 20 | this.ruleIndex = ruleIndex; 21 | this.actionIndex = actionIndex; 22 | this.isCtxDependent = isCtxDependent; 23 | } 24 | 25 | @Override 26 | public int getSerializationType() { 27 | return ACTION; 28 | } 29 | 30 | @Override 31 | public boolean isEpsilon() { 32 | return true; // we are to be ignored by analysis 'cept for predicates 33 | } 34 | 35 | @Override 36 | public boolean matches(int symbol, int minVocabSymbol, int maxVocabSymbol) { 37 | return false; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return "action_"+ruleIndex+":"+actionIndex; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/AtomTransition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | import org.antlr.v4.runtime.misc.IntervalSet; 10 | 11 | /** TODO: make all transitions sets? no, should remove set edges */ 12 | public final class AtomTransition extends Transition { 13 | /** The token type or character value; or, signifies special label. */ 14 | public final int label; 15 | 16 | public AtomTransition(ATNState target, int label) { 17 | super(target); 18 | this.label = label; 19 | } 20 | 21 | @Override 22 | public int getSerializationType() { 23 | return ATOM; 24 | } 25 | 26 | @Override 27 | 28 | public IntervalSet label() { return IntervalSet.of(label); } 29 | 30 | @Override 31 | public boolean matches(int symbol, int minVocabSymbol, int maxVocabSymbol) { 32 | return label == symbol; 33 | } 34 | 35 | @Override 36 | public String toString() { 37 | return String.valueOf(label); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/BasicBlockStartState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | /** 10 | * 11 | * @author Sam Harwell 12 | */ 13 | public final class BasicBlockStartState extends BlockStartState { 14 | @Override 15 | public int getStateType() { 16 | return BLOCK_START; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/BasicState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | /** 10 | * 11 | * @author Sam Harwell 12 | */ 13 | public final class BasicState extends ATNState { 14 | 15 | @Override 16 | public int getStateType() { 17 | return BASIC; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/BlockEndState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | /** Terminal node of a simple {@code (a|b|c)} block. */ 10 | public final class BlockEndState extends ATNState { 11 | public BlockStartState startState; 12 | 13 | @Override 14 | public int getStateType() { 15 | return BLOCK_END; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/BlockStartState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | /** The start of a regular {@code (...)} block. */ 10 | public abstract class BlockStartState extends DecisionState { 11 | public BlockEndState endState; 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/CodePointTransitions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | import org.antlr.v4.runtime.misc.IntervalSet; 10 | 11 | /** 12 | * Utility class to create {@link AtomTransition}, {@link RangeTransition}, 13 | * and {@link SetTransition} appropriately based on the range of the input. 14 | * 15 | * To keep the serialized ATN size small, we only inline atom and 16 | * range transitions for Unicode code points <= U+FFFF. 17 | * 18 | * Whenever we encounter a Unicode code point > U+FFFF, we represent that 19 | * as a set transition (even if it is logically an atom or a range). 20 | */ 21 | public abstract class CodePointTransitions { 22 | /** 23 | * If {@code codePoint} is <= U+FFFF, returns a new {@link AtomTransition}. 24 | * Otherwise, returns a new {@link SetTransition}. 25 | */ 26 | public static Transition createWithCodePoint(ATNState target, int codePoint) { 27 | if (Character.isSupplementaryCodePoint(codePoint)) { 28 | return new SetTransition(target, IntervalSet.of(codePoint)); 29 | } 30 | else { 31 | return new AtomTransition(target, codePoint); 32 | } 33 | } 34 | 35 | /** 36 | * If {@code codePointFrom} and {@code codePointTo} are both 37 | * <= U+FFFF, returns a new {@link RangeTransition}. 38 | * Otherwise, returns a new {@link SetTransition}. 39 | */ 40 | public static Transition createWithCodePointRange( 41 | ATNState target, 42 | int codePointFrom, 43 | int codePointTo) { 44 | if (Character.isSupplementaryCodePoint(codePointFrom) || 45 | Character.isSupplementaryCodePoint(codePointTo)) { 46 | return new SetTransition(target, IntervalSet.of(codePointFrom, codePointTo)); 47 | } 48 | else { 49 | return new RangeTransition(target, codePointFrom, codePointTo); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/ContextSensitivityInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | import org.antlr.v4.runtime.ANTLRErrorListener; 10 | import org.antlr.v4.runtime.TokenStream; 11 | 12 | /** 13 | * This class represents profiling event information for a context sensitivity. 14 | * Context sensitivities are decisions where a particular input resulted in an 15 | * SLL conflict, but LL prediction produced a single unique alternative. 16 | * 17 | *18 | * In some cases, the unique alternative identified by LL prediction is not 19 | * equal to the minimum represented alternative in the conflicting SLL 20 | * configuration set. Grammars and inputs which result in this scenario are 21 | * unable to use {@link PredictionMode#SLL}, which in turn means they cannot use 22 | * the two-stage parsing strategy to improve parsing performance for that 23 | * input.
24 | * 25 | * @see ParserATNSimulator#reportContextSensitivity 26 | * @see ANTLRErrorListener#reportContextSensitivity 27 | * 28 | * @since 4.3 29 | */ 30 | public class ContextSensitivityInfo extends DecisionEventInfo { 31 | /** 32 | * Constructs a new instance of the {@link ContextSensitivityInfo} class 33 | * with the specified detailed context sensitivity information. 34 | * 35 | * @param decision The decision number 36 | * @param configs The final configuration set containing the unique 37 | * alternative identified by full-context prediction 38 | * @param input The input token stream 39 | * @param startIndex The start index for the current prediction 40 | * @param stopIndex The index at which the context sensitivity was 41 | * identified during full-context prediction 42 | */ 43 | public ContextSensitivityInfo(int decision, 44 | ATNConfigSet configs, 45 | TokenStream input, int startIndex, int stopIndex) 46 | { 47 | super( decision, configs, input, startIndex, stopIndex, true); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/DecisionState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | public abstract class DecisionState extends ATNState { 10 | public int decision = -1; 11 | public boolean nonGreedy; 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/EmptyPredictionContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | public class EmptyPredictionContext extends SingletonPredictionContext { 10 | public EmptyPredictionContext() { 11 | super(null, EMPTY_RETURN_STATE); 12 | } 13 | 14 | @Override 15 | public boolean isEmpty() { return true; } 16 | 17 | @Override 18 | public int size() { 19 | return 1; 20 | } 21 | 22 | @Override 23 | public PredictionContext getParent(int index) { 24 | return null; 25 | } 26 | 27 | @Override 28 | public int getReturnState(int index) { 29 | return returnState; 30 | } 31 | 32 | @Override 33 | public boolean equals(Object o) { 34 | return this == o; 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return "$"; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/EpsilonTransition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | public final class EpsilonTransition extends Transition { 10 | 11 | private final int outermostPrecedenceReturn; 12 | 13 | public EpsilonTransition(ATNState target) { 14 | this(target, -1); 15 | } 16 | 17 | public EpsilonTransition(ATNState target, int outermostPrecedenceReturn) { 18 | super(target); 19 | this.outermostPrecedenceReturn = outermostPrecedenceReturn; 20 | } 21 | 22 | /** 23 | * @return the rule index of a precedence rule for which this transition is 24 | * returning from, where the precedence value is 0; otherwise, -1. 25 | * 26 | * @see ATNConfig#isPrecedenceFilterSuppressed() 27 | * @see ParserATNSimulator#applyPrecedenceFilter(ATNConfigSet) 28 | * @since 4.4.1 29 | */ 30 | public int outermostPrecedenceReturn() { 31 | return outermostPrecedenceReturn; 32 | } 33 | 34 | @Override 35 | public int getSerializationType() { 36 | return EPSILON; 37 | } 38 | 39 | @Override 40 | public boolean isEpsilon() { return true; } 41 | 42 | @Override 43 | public boolean matches(int symbol, int minVocabSymbol, int maxVocabSymbol) { 44 | return false; 45 | } 46 | 47 | @Override 48 | 49 | public String toString() { 50 | return "epsilon"; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/ErrorInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | import org.antlr.v4.runtime.ANTLRErrorListener; 10 | import org.antlr.v4.runtime.Parser; 11 | import org.antlr.v4.runtime.RecognitionException; 12 | import org.antlr.v4.runtime.Token; 13 | import org.antlr.v4.runtime.TokenStream; 14 | 15 | /** 16 | * This class represents profiling event information for a syntax error 17 | * identified during prediction. Syntax errors occur when the prediction 18 | * algorithm is unable to identify an alternative which would lead to a 19 | * successful parse. 20 | * 21 | * @see Parser#notifyErrorListeners(Token, String, RecognitionException) 22 | * @see ANTLRErrorListener#syntaxError 23 | * 24 | * @since 4.3 25 | */ 26 | public class ErrorInfo extends DecisionEventInfo { 27 | /** 28 | * Constructs a new instance of the {@link ErrorInfo} class with the 29 | * specified detailed syntax error information. 30 | * 31 | * @param decision The decision number 32 | * @param configs The final configuration set reached during prediction 33 | * prior to reaching the {@link ATNSimulator#ERROR} state 34 | * @param input The input token stream 35 | * @param startIndex The start index for the current prediction 36 | * @param stopIndex The index at which the syntax error was identified 37 | * @param fullCtx {@code true} if the syntax error was identified during LL 38 | * prediction; otherwise, {@code false} if the syntax error was identified 39 | * during SLL prediction 40 | */ 41 | public ErrorInfo(int decision, 42 | ATNConfigSet configs, 43 | TokenStream input, int startIndex, int stopIndex, 44 | boolean fullCtx) 45 | { 46 | super(decision, configs, input, startIndex, stopIndex, fullCtx); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/LexerAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | import org.antlr.v4.runtime.CharStream; 10 | import org.antlr.v4.runtime.Lexer; 11 | 12 | /** 13 | * Represents a single action which can be executed following the successful 14 | * match of a lexer rule. Lexer actions are used for both embedded action syntax 15 | * and ANTLR 4's new lexer command syntax. 16 | * 17 | * @author Sam Harwell 18 | * @since 4.2 19 | */ 20 | public interface LexerAction { 21 | /** 22 | * Gets the serialization type of the lexer action. 23 | * 24 | * @return The serialization type of the lexer action. 25 | */ 26 | LexerActionType getActionType(); 27 | 28 | /** 29 | * Gets whether the lexer action is position-dependent. Position-dependent 30 | * actions may have different semantics depending on the {@link CharStream} 31 | * index at the time the action is executed. 32 | * 33 | *Many lexer commands, including {@code type}, {@code skip}, and 34 | * {@code more}, do not check the input index during their execution. 35 | * Actions like this are position-independent, and may be stored more 36 | * efficiently as part of the {@link LexerATNConfig#lexerActionExecutor}.
37 | * 38 | * @return {@code true} if the lexer action semantics can be affected by the 39 | * position of the input {@link CharStream} at the time it is executed; 40 | * otherwise, {@code false}. 41 | */ 42 | boolean isPositionDependent(); 43 | 44 | /** 45 | * Execute the lexer action in the context of the specified {@link Lexer}. 46 | * 47 | *For position-dependent actions, the input stream must already be 48 | * positioned correctly prior to calling this method.
49 | * 50 | * @param lexer The lexer instance. 51 | */ 52 | void execute(Lexer lexer); 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/LexerActionType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | /** 10 | * Represents the serialization type of a {@link LexerAction}. 11 | * 12 | * @author Sam Harwell 13 | * @since 4.2 14 | */ 15 | public enum LexerActionType { 16 | /** 17 | * The type of a {@link LexerChannelAction} action. 18 | */ 19 | CHANNEL, 20 | /** 21 | * The type of a {@link LexerCustomAction} action. 22 | */ 23 | CUSTOM, 24 | /** 25 | * The type of a {@link LexerModeAction} action. 26 | */ 27 | MODE, 28 | /** 29 | * The type of a {@link LexerMoreAction} action. 30 | */ 31 | MORE, 32 | /** 33 | * The type of a {@link LexerPopModeAction} action. 34 | */ 35 | POP_MODE, 36 | /** 37 | * The type of a {@link LexerPushModeAction} action. 38 | */ 39 | PUSH_MODE, 40 | /** 41 | * The type of a {@link LexerSkipAction} action. 42 | */ 43 | SKIP, 44 | /** 45 | * The type of a {@link LexerTypeAction} action. 46 | */ 47 | TYPE, 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/LexerMoreAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | import org.antlr.v4.runtime.Lexer; 10 | import org.antlr.v4.runtime.misc.MurmurHash; 11 | 12 | /** 13 | * Implements the {@code more} lexer action by calling {@link Lexer#more}. 14 | * 15 | *The {@code more} command does not have any parameters, so this action is 16 | * implemented as a singleton instance exposed by {@link #INSTANCE}.
17 | * 18 | * @author Sam Harwell 19 | * @since 4.2 20 | */ 21 | public final class LexerMoreAction implements LexerAction { 22 | /** 23 | * Provides a singleton instance of this parameterless lexer action. 24 | */ 25 | public static final LexerMoreAction INSTANCE = new LexerMoreAction(); 26 | 27 | /** 28 | * Constructs the singleton instance of the lexer {@code more} command. 29 | */ 30 | private LexerMoreAction() { 31 | } 32 | 33 | /** 34 | * {@inheritDoc} 35 | * @return This method returns {@link LexerActionType#MORE}. 36 | */ 37 | @Override 38 | public LexerActionType getActionType() { 39 | return LexerActionType.MORE; 40 | } 41 | 42 | /** 43 | * {@inheritDoc} 44 | * @return This method returns {@code false}. 45 | */ 46 | @Override 47 | public boolean isPositionDependent() { 48 | return false; 49 | } 50 | 51 | /** 52 | * {@inheritDoc} 53 | * 54 | *This action is implemented by calling {@link Lexer#more}.
55 | */ 56 | @Override 57 | public void execute(Lexer lexer) { 58 | lexer.more(); 59 | } 60 | 61 | @Override 62 | public int hashCode() { 63 | int hash = MurmurHash.initialize(); 64 | hash = MurmurHash.update(hash, getActionType().ordinal()); 65 | return MurmurHash.finish(hash, 1); 66 | } 67 | 68 | @Override 69 | @SuppressWarnings("EqualsWhichDoesntCheckParameterClass") 70 | public boolean equals(Object obj) { 71 | return obj == this; 72 | } 73 | 74 | @Override 75 | public String toString() { 76 | return "more"; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/LexerPopModeAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | import org.antlr.v4.runtime.Lexer; 10 | import org.antlr.v4.runtime.misc.MurmurHash; 11 | 12 | /** 13 | * Implements the {@code popMode} lexer action by calling {@link Lexer#popMode}. 14 | * 15 | *The {@code popMode} command does not have any parameters, so this action is 16 | * implemented as a singleton instance exposed by {@link #INSTANCE}.
17 | * 18 | * @author Sam Harwell 19 | * @since 4.2 20 | */ 21 | public final class LexerPopModeAction implements LexerAction { 22 | /** 23 | * Provides a singleton instance of this parameterless lexer action. 24 | */ 25 | public static final LexerPopModeAction INSTANCE = new LexerPopModeAction(); 26 | 27 | /** 28 | * Constructs the singleton instance of the lexer {@code popMode} command. 29 | */ 30 | private LexerPopModeAction() { 31 | } 32 | 33 | /** 34 | * {@inheritDoc} 35 | * @return This method returns {@link LexerActionType#POP_MODE}. 36 | */ 37 | @Override 38 | public LexerActionType getActionType() { 39 | return LexerActionType.POP_MODE; 40 | } 41 | 42 | /** 43 | * {@inheritDoc} 44 | * @return This method returns {@code false}. 45 | */ 46 | @Override 47 | public boolean isPositionDependent() { 48 | return false; 49 | } 50 | 51 | /** 52 | * {@inheritDoc} 53 | * 54 | *This action is implemented by calling {@link Lexer#popMode}.
55 | */ 56 | @Override 57 | public void execute(Lexer lexer) { 58 | lexer.popMode(); 59 | } 60 | 61 | @Override 62 | public int hashCode() { 63 | int hash = MurmurHash.initialize(); 64 | hash = MurmurHash.update(hash, getActionType().ordinal()); 65 | return MurmurHash.finish(hash, 1); 66 | } 67 | 68 | @Override 69 | @SuppressWarnings("EqualsWhichDoesntCheckParameterClass") 70 | public boolean equals(Object obj) { 71 | return obj == this; 72 | } 73 | 74 | @Override 75 | public String toString() { 76 | return "popMode"; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/LexerSkipAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | import org.antlr.v4.runtime.Lexer; 10 | import org.antlr.v4.runtime.misc.MurmurHash; 11 | 12 | /** 13 | * Implements the {@code skip} lexer action by calling {@link Lexer#skip}. 14 | * 15 | *The {@code skip} command does not have any parameters, so this action is 16 | * implemented as a singleton instance exposed by {@link #INSTANCE}.
17 | * 18 | * @author Sam Harwell 19 | * @since 4.2 20 | */ 21 | public final class LexerSkipAction implements LexerAction { 22 | /** 23 | * Provides a singleton instance of this parameterless lexer action. 24 | */ 25 | public static final LexerSkipAction INSTANCE = new LexerSkipAction(); 26 | 27 | /** 28 | * Constructs the singleton instance of the lexer {@code skip} command. 29 | */ 30 | private LexerSkipAction() { 31 | } 32 | 33 | /** 34 | * {@inheritDoc} 35 | * @return This method returns {@link LexerActionType#SKIP}. 36 | */ 37 | @Override 38 | public LexerActionType getActionType() { 39 | return LexerActionType.SKIP; 40 | } 41 | 42 | /** 43 | * {@inheritDoc} 44 | * @return This method returns {@code false}. 45 | */ 46 | @Override 47 | public boolean isPositionDependent() { 48 | return false; 49 | } 50 | 51 | /** 52 | * {@inheritDoc} 53 | * 54 | *This action is implemented by calling {@link Lexer#skip}.
55 | */ 56 | @Override 57 | public void execute(Lexer lexer) { 58 | lexer.skip(); 59 | } 60 | 61 | @Override 62 | public int hashCode() { 63 | int hash = MurmurHash.initialize(); 64 | hash = MurmurHash.update(hash, getActionType().ordinal()); 65 | return MurmurHash.finish(hash, 1); 66 | } 67 | 68 | @Override 69 | @SuppressWarnings("EqualsWhichDoesntCheckParameterClass") 70 | public boolean equals(Object obj) { 71 | return obj == this; 72 | } 73 | 74 | @Override 75 | public String toString() { 76 | return "skip"; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/LookaheadEventInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | import org.antlr.v4.runtime.TokenStream; 10 | 11 | /** 12 | * This class represents profiling event information for tracking the lookahead 13 | * depth required in order to make a prediction. 14 | * 15 | * @since 4.3 16 | */ 17 | public class LookaheadEventInfo extends DecisionEventInfo { 18 | /** The alternative chosen by adaptivePredict(), not necessarily 19 | * the outermost alt shown for a rule; left-recursive rules have 20 | * user-level alts that differ from the rewritten rule with a (...) block 21 | * and a (..)* loop. 22 | */ 23 | public int predictedAlt; 24 | 25 | /** 26 | * Constructs a new instance of the {@link LookaheadEventInfo} class with 27 | * the specified detailed lookahead information. 28 | * 29 | * @param decision The decision number 30 | * @param configs The final configuration set containing the necessary 31 | * information to determine the result of a prediction, or {@code null} if 32 | * the final configuration set is not available 33 | * @param input The input token stream 34 | * @param startIndex The start index for the current prediction 35 | * @param stopIndex The index at which the prediction was finally made 36 | * @param fullCtx {@code true} if the current lookahead is part of an LL 37 | * prediction; otherwise, {@code false} if the current lookahead is part of 38 | * an SLL prediction 39 | */ 40 | public LookaheadEventInfo(int decision, 41 | ATNConfigSet configs, 42 | int predictedAlt, 43 | TokenStream input, int startIndex, int stopIndex, 44 | boolean fullCtx) 45 | { 46 | super(decision, configs, input, startIndex, stopIndex, fullCtx); 47 | this.predictedAlt = predictedAlt; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/LoopEndState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | /** Mark the end of a * or + loop. */ 10 | public final class LoopEndState extends ATNState { 11 | public ATNState loopBackState; 12 | 13 | @Override 14 | public int getStateType() { 15 | return LOOP_END; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/NotSetTransition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | import org.antlr.v4.runtime.misc.IntervalSet; 10 | 11 | public final class NotSetTransition extends SetTransition { 12 | public NotSetTransition(ATNState target, IntervalSet set) { 13 | super(target, set); 14 | } 15 | 16 | @Override 17 | public int getSerializationType() { 18 | return NOT_SET; 19 | } 20 | 21 | @Override 22 | public boolean matches(int symbol, int minVocabSymbol, int maxVocabSymbol) { 23 | return symbol >= minVocabSymbol 24 | && symbol <= maxVocabSymbol 25 | && !super.matches(symbol, minVocabSymbol, maxVocabSymbol); 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return '~'+super.toString(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/OrderedATNConfigSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | import org.antlr.v4.runtime.misc.ObjectEqualityComparator; 10 | 11 | /** 12 | * 13 | * @author Sam Harwell 14 | */ 15 | public class OrderedATNConfigSet extends ATNConfigSet { 16 | 17 | public OrderedATNConfigSet() { 18 | this.configLookup = new LexerConfigHashSet(); 19 | } 20 | 21 | public static class LexerConfigHashSet extends AbstractConfigHashSet { 22 | public LexerConfigHashSet() { 23 | super(ObjectEqualityComparator.INSTANCE); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/PlusBlockStartState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | /** Start of {@code (A|B|...)+} loop. Technically a decision state, but 10 | * we don't use for code generation; somebody might need it, so I'm defining 11 | * it for completeness. In reality, the {@link PlusLoopbackState} node is the 12 | * real decision-making note for {@code A+}. 13 | */ 14 | public final class PlusBlockStartState extends BlockStartState { 15 | public PlusLoopbackState loopBackState; 16 | 17 | @Override 18 | public int getStateType() { 19 | return PLUS_BLOCK_START; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/PlusLoopbackState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | /** Decision state for {@code A+} and {@code (A|B)+}. It has two transitions: 10 | * one to the loop back to start of the block and one to exit. 11 | */ 12 | public final class PlusLoopbackState extends DecisionState { 13 | 14 | @Override 15 | public int getStateType() { 16 | return PLUS_LOOP_BACK; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/PrecedencePredicateTransition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | /** 10 | * 11 | * @author Sam Harwell 12 | */ 13 | public final class PrecedencePredicateTransition extends AbstractPredicateTransition { 14 | public final int precedence; 15 | 16 | public PrecedencePredicateTransition(ATNState target, int precedence) { 17 | super(target); 18 | this.precedence = precedence; 19 | } 20 | 21 | @Override 22 | public int getSerializationType() { 23 | return PRECEDENCE; 24 | } 25 | 26 | @Override 27 | public boolean isEpsilon() { 28 | return true; 29 | } 30 | 31 | @Override 32 | public boolean matches(int symbol, int minVocabSymbol, int maxVocabSymbol) { 33 | return false; 34 | } 35 | 36 | public SemanticContext.PrecedencePredicate getPredicate() { 37 | return new SemanticContext.PrecedencePredicate(precedence); 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return precedence + " >= _p"; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/PredicateTransition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | /** TODO: this is old comment: 10 | * A tree of semantic predicates from the grammar AST if label==SEMPRED. 11 | * In the ATN, labels will always be exactly one predicate, but the DFA 12 | * may have to combine a bunch of them as it collects predicates from 13 | * multiple ATN configurations into a single DFA state. 14 | */ 15 | public final class PredicateTransition extends AbstractPredicateTransition { 16 | public final int ruleIndex; 17 | public final int predIndex; 18 | public final boolean isCtxDependent; // e.g., $i ref in pred 19 | 20 | public PredicateTransition(ATNState target, int ruleIndex, int predIndex, boolean isCtxDependent) { 21 | super(target); 22 | this.ruleIndex = ruleIndex; 23 | this.predIndex = predIndex; 24 | this.isCtxDependent = isCtxDependent; 25 | } 26 | 27 | @Override 28 | public int getSerializationType() { 29 | return PREDICATE; 30 | } 31 | 32 | @Override 33 | public boolean isEpsilon() { return true; } 34 | 35 | @Override 36 | public boolean matches(int symbol, int minVocabSymbol, int maxVocabSymbol) { 37 | return false; 38 | } 39 | 40 | public SemanticContext.Predicate getPredicate() { 41 | return new SemanticContext.Predicate(ruleIndex, predIndex, isCtxDependent); 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return "pred_"+ruleIndex+":"+predIndex; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/PredictionContextCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | 12 | /** Used to cache {@link PredictionContext} objects. Its used for the shared 13 | * context cash associated with contexts in DFA states. This cache 14 | * can be used for both lexers and parsers. 15 | */ 16 | public class PredictionContextCache { 17 | protected final MapThis is a computed property that is calculated during ATN deserialization 20 | * and stored for use in {@link ParserATNSimulator} and 21 | * {@link ParserInterpreter}.
22 | * 23 | * @see DFA#isPrecedenceDfa() 24 | */ 25 | public boolean isPrecedenceDecision; 26 | 27 | @Override 28 | public int getStateType() { 29 | return STAR_LOOP_ENTRY; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/StarLoopbackState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | public final class StarLoopbackState extends ATNState { 10 | public final StarLoopEntryState getLoopEntryState() { 11 | return (StarLoopEntryState)transition(0).target; 12 | } 13 | 14 | @Override 15 | public int getStateType() { 16 | return STAR_LOOP_BACK; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/TokensStartState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | /** The Tokens rule start state linking to each lexer rule start state */ 10 | public final class TokensStartState extends DecisionState { 11 | 12 | @Override 13 | public int getStateType() { 14 | return TOKEN_START; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/atn/WildcardTransition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.atn; 8 | 9 | public final class WildcardTransition extends Transition { 10 | public WildcardTransition(ATNState target) { super(target); } 11 | 12 | @Override 13 | public int getSerializationType() { 14 | return WILDCARD; 15 | } 16 | 17 | @Override 18 | public boolean matches(int symbol, int minVocabSymbol, int maxVocabSymbol) { 19 | return symbol >= minVocabSymbol && symbol <= maxVocabSymbol; 20 | } 21 | 22 | @Override 23 | public String toString() { 24 | return "."; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/dfa/LexerDFASerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | 7 | package org.antlr.v4.runtime.dfa; 8 | 9 | import org.antlr.v4.runtime.VocabularyImpl; 10 | 11 | public class LexerDFASerializer extends DFASerializer { 12 | public LexerDFASerializer(DFA dfa) { 13 | super(dfa, VocabularyImpl.EMPTY_VOCABULARY); 14 | } 15 | 16 | @Override 17 | 18 | protected String getEdgeLabel(int i) { 19 | return new StringBuilder("'") 20 | .appendCodePoint(i) 21 | .append("'") 22 | .toString(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/org/antlr/v4/runtime/misc/AbstractEqualityComparator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 3 | * Use of this file is governed by the BSD 3-clause license that 4 | * can be found in the LICENSE.txt file in the project root. 5 | */ 6 | package org.antlr.v4.runtime.misc; 7 | 8 | /** 9 | * This abstract base class is provided so performance-critical applications can 10 | * use virtual- instead of interface-dispatch when calling comparator methods. 11 | * 12 | * @author Sam Harwell 13 | */ 14 | public abstract class AbstractEqualityComparator