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/codegen/model/decl/StructDecl.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.codegen.model.decl; import org.antlr.v4.codegen.OutputModelFactory; import org.antlr.v4.codegen.model.DispatchMethod; import org.antlr.v4.codegen.model.ListenerDispatchMethod; import org.antlr.v4.codegen.model.ModelElement; import org.antlr.v4.codegen.model.OutputModelObject; import org.antlr.v4.codegen.model.VisitorDispatchMethod; import org.antlr.v4.runtime.misc.OrderedHashSet; import org.antlr.v4.tool.Attribute; import org.antlr.v4.tool.Rule; import java.util.ArrayList; import java.util.Collection; import java.util.List; /** This object models the structure holding all of the parameters, * return values, local variables, and labels associated with a rule. */ public class StructDecl extends Decl { public String derivedFromName; // rule name or label name public boolean provideCopyFrom; @ModelElement public OrderedHashSet<Decl> attrs = new OrderedHashSet<Decl>(); @ModelElement public OrderedHashSet<Decl> getters = new OrderedHashSet<Decl>(); @ModelElement public Collection<AttributeDecl> ctorAttrs; @ModelElement public List<? super DispatchMethod> dispatchMethods; @ModelElement public List<OutputModelObject> interfaces; @ModelElement public List<OutputModelObject> extensionMembers; // Track these separately; Go target needs to generate getters/setters // Do not make them templates; we only need the Decl object not the ST // built from it. Avoids adding args to StructDecl template public OrderedHashSet<Decl> tokenDecls = new OrderedHashSet<Decl>(); public OrderedHashSet<Decl> tokenTypeDecls = new OrderedHashSet<Decl>(); public OrderedHashSet<Decl> tokenListDecls = new OrderedHashSet<Decl>(); public OrderedHashSet<Decl> ruleContextDecls = new OrderedHashSet<Decl>(); public OrderedHashSet<Decl> ruleContextListDecls = new OrderedHashSet<Decl>(); public OrderedHashSet<Decl> attributeDecls = new OrderedHashSet<Decl>(); public StructDecl(OutputModelFactory factory, Rule r) { this(factory, r, null); } protected StructDecl(OutputModelFactory factory, Rule r, String name) { super(factory, name == null ? factory.getGenerator().getTarget().getRuleFunctionContextStructName(r) : name); addDispatchMethods(r); derivedFromName = r.name; provideCopyFrom = r.hasAltSpecificContexts(); } public void addDispatchMethods(Rule r) { dispatchMethods = new ArrayList<DispatchMethod>(); if ( !r.hasAltSpecificContexts() ) { // no enter/exit for this ruleContext if rule has labels if ( factory.getGrammar().tool.gen_listener ) { dispatchMethods.add(new ListenerDispatchMethod(factory, true)); dispatchMethods.add(new ListenerDispatchMethod(factory, false)); } if ( factory.getGrammar().tool.gen_visitor ) { dispatchMethods.add(new VisitorDispatchMethod(factory)); } } } public void addDecl(Decl d) { d.ctx = this; if ( d instanceof ContextGetterDecl ) getters.add(d); else attrs.add(d); // add to specific "lists" if ( d instanceof TokenTypeDecl ) { tokenTypeDecls.add(d); } else if ( d instanceof TokenListDecl ) { tokenListDecls.add(d); } else if ( d instanceof TokenDecl ) { tokenDecls.add(d); } else if ( d instanceof RuleContextListDecl ) { ruleContextListDecls.add(d); } else if ( d instanceof RuleContextDecl ) { ruleContextDecls.add(d); } else if ( d instanceof AttributeDecl ) { attributeDecls.add(d); } } public void addDecl(Attribute a) { addDecl(new AttributeDecl(factory, a)); } public void addDecls(Collection<Attribute> attrList) { for (Attribute a : attrList) addDecl(a); } public void implementInterface(OutputModelObject value) { if (interfaces == null) { interfaces = new ArrayList<OutputModelObject>(); } interfaces.add(value); } public void addExtensionMember(OutputModelObject member) { if (extensionMembers == null) { extensionMembers = new ArrayList<OutputModelObject>(); } extensionMembers.add(member); } public boolean isEmpty() { return attrs.isEmpty(); } }
⏎ org/antlr/v4/codegen/model/decl/StructDecl.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, 26795👍, 0💬
Popular Posts:
JDK 11 java.management.jmod is the JMOD file for JDK 11 Management module. JDK 11 Management module ...
JDK 11 java.management.jmod is the JMOD file for JDK 11 Management module. JDK 11 Management module ...
Jaxen, Release 1.1.1, is an open source XPath library written in Java. It is adaptable to many diffe...
How to download and install JDK (Java Development Kit) 7? If you want to write Java applications, yo...
The Apache FontBox library is an open source Java tool to obtain low level information from font fil...