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 Tool Source Code
ANTLR is a powerful parser generator for multiple programming languages including Java.
ANTLR contains 2 major modules:
ANTLR Tool 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/tool/AttributeDict.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.tool; import org.antlr.v4.runtime.Token; import org.antlr.v4.tool.ast.GrammarAST; import java.util.Collections; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.Set; /** Track the attributes within retval, arg lists etc... * <p> * Each rule has potentially 3 scopes: return values, * parameters, and an implicitly-named scope (i.e., a scope defined in a rule). * Implicitly-defined scopes are named after the rule; rules and scopes then * must live in the same name space--no collisions allowed. */ public class AttributeDict { public String name; public GrammarAST ast; public DictType type; /** All {@link Token} scopes (token labels) share the same fixed scope of * of predefined attributes. I keep this out of the {@link Token} * interface to avoid a runtime type leakage. */ public static final AttributeDict predefinedTokenDict = new AttributeDict(DictType.TOKEN); static { predefinedTokenDict.add(new Attribute("text")); predefinedTokenDict.add(new Attribute("type")); predefinedTokenDict.add(new Attribute("line")); predefinedTokenDict.add(new Attribute("index")); predefinedTokenDict.add(new Attribute("pos")); predefinedTokenDict.add(new Attribute("channel")); predefinedTokenDict.add(new Attribute("int")); } public enum DictType { ARG, RET, LOCAL, TOKEN, PREDEFINED_RULE, PREDEFINED_LEXER_RULE, } /** The list of {@link Attribute} objects. */ public final LinkedHashMap<String, Attribute> attributes = new LinkedHashMap<String, Attribute>(); public AttributeDict() {} public AttributeDict(DictType type) { this.type = type; } public Attribute add(Attribute a) { a.dict = this; return attributes.put(a.name, a); } public Attribute get(String name) { return attributes.get(name); } public String getName() { return name; } public int size() { return attributes.size(); } /** Return the set of keys that collide from * {@code this} and {@code other}. */ public Set<String> intersection(AttributeDict other) { if ( other==null || other.size()==0 || size()==0 ) { return Collections.emptySet(); } Set<String> result = new HashSet<String>(attributes.keySet()); result.retainAll(other.attributes.keySet()); return result; } @Override public String toString() { return getName()+":"+attributes; } }
⏎ org/antlr/v4/tool/AttributeDict.java
Or download all of them as a single archive file:
File name: antlr-tool-4.10.1-sources.jar File size: 347718 bytes Release date: 2022-04-15 Download
2022-04-24, 32073👍, 0💬
Popular Posts:
JDK 11 jdk.internal.JVM Stat.jmod is the JMOD file for JDK 11 Internal Jvmstat module. JDK 11 Intern...
What Is commons-io-2.11.jar? commons-io-2.11.jar is the JAR file for Commons IO 2.5, which is a libr...
JDK 11 jdk.crypto.ec.jmod is the JMOD file for JDK 11 Crypto EC module. JDK 11 Crypto EC module comp...
How to download and install ojdbc14.jar for Oracle 10g R2? ojdbc14.jar for Oracle 10g R2 is a Java 1...
What is ojdbc.jar - JDBC Driver for Oracle? ojdbc.jar is a JDBC driver from Oracle that provides dat...