Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
ANTLR Runtime Source Code
ANTLR is a powerful parser generator for multiple programming languages including Java.
ANTLR contains 2 major modules:
ANTLR Runtime Source Code files are provided in the distribution packge (antlr4-4.10.1.zip). You can download them at ANTLR Website.
You can also browse the source code below:
✍: FYIcenter
⏎ org/antlr/v4/runtime/atn/LexerIndexedCustomAction.java
/* * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. * Use of this file is governed by the BSD 3-clause license that * can be found in the LICENSE.txt file in the project root. */ package org.antlr.v4.runtime.atn; import org.antlr.v4.runtime.CharStream; import org.antlr.v4.runtime.Lexer; import org.antlr.v4.runtime.misc.MurmurHash; /** * This implementation of {@link LexerAction} is used for tracking input offsets * for position-dependent actions within a {@link LexerActionExecutor}. * * <p>This action is not serialized as part of the ATN, and is only required for * position-dependent lexer actions which appear at a location other than the * end of a rule. For more information about DFA optimizations employed for * lexer actions, see {@link LexerActionExecutor#append} and * {@link LexerActionExecutor#fixOffsetBeforeMatch}.</p> * * @author Sam Harwell * @since 4.2 */ public final class LexerIndexedCustomAction implements LexerAction { private final int offset; private final LexerAction action; /** * Constructs a new indexed custom action by associating a character offset * with a {@link LexerAction}. * * <p>Note: This class is only required for lexer actions for which * {@link LexerAction#isPositionDependent} returns {@code true}.</p> * * @param offset The offset into the input {@link CharStream}, relative to * the token start index, at which the specified lexer action should be * executed. * @param action The lexer action to execute at a particular offset in the * input {@link CharStream}. */ public LexerIndexedCustomAction(int offset, LexerAction action) { this.offset = offset; this.action = action; } /** * Gets the location in the input {@link CharStream} at which the lexer * action should be executed. The value is interpreted as an offset relative * to the token start index. * * @return The location in the input {@link CharStream} at which the lexer * action should be executed. */ public int getOffset() { return offset; } /** * Gets the lexer action to execute. * * @return A {@link LexerAction} object which executes the lexer action. */ public LexerAction getAction() { return action; } /** * {@inheritDoc} * * @return This method returns the result of calling {@link #getActionType} * on the {@link LexerAction} returned by {@link #getAction}. */ @Override public LexerActionType getActionType() { return action.getActionType(); } /** * {@inheritDoc} * @return This method returns {@code true}. */ @Override public boolean isPositionDependent() { return true; } /** * {@inheritDoc} * * <p>This method calls {@link #execute} on the result of {@link #getAction} * using the provided {@code lexer}.</p> */ @Override public void execute(Lexer lexer) { // assume the input stream position was properly set by the calling code action.execute(lexer); } @Override public int hashCode() { int hash = MurmurHash.initialize(); hash = MurmurHash.update(hash, offset); hash = MurmurHash.update(hash, action); return MurmurHash.finish(hash, 2); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } else if (!(obj instanceof LexerIndexedCustomAction)) { return false; } LexerIndexedCustomAction other = (LexerIndexedCustomAction)obj; return offset == other.offset && action.equals(other.action); } }
⏎ org/antlr/v4/runtime/atn/LexerIndexedCustomAction.java
Or download all of them as a single archive file:
File name: antlr-runtime-4.10.1-sources.jar File size: 308953 bytes Release date: 2022-04-15 Download
⇐ What Is ANTLR Parser Generator
2018-10-21, 31709👍, 0💬
Popular Posts:
JDK 8 jconsole.jar is the JAR file for JDK 8 JConsole, which is a graphical monitoring tool to monit...
JDK 11 java.security.jgss.jmod is the JMOD file for JDK 11 Security JGSS (Java Generic Security Serv...
The Java Naming and Directory Interface (JNDI) is part of the Java platform, providing applications ...
XML Serializer, Release 2.7.1, allows you to write out XML, HTML etc. as a stream of characters from...
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java"....