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/misc/LogManager.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.misc; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; public class LogManager { protected static class Record { long timestamp; StackTraceElement location; String component; String msg; public Record() { timestamp = System.currentTimeMillis(); location = new Throwable().getStackTrace()[0]; } @Override public String toString() { StringBuilder buf = new StringBuilder(); buf.append(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date(timestamp))); buf.append(" "); buf.append(component); buf.append(" "); buf.append(location.getFileName()); buf.append(":"); buf.append(location.getLineNumber()); buf.append(" "); buf.append(msg); return buf.toString(); } } protected List<Record> records; public void log(String component, String msg) { Record r = new Record(); r.component = component; r.msg = msg; if ( records==null ) { records = new ArrayList<Record>(); } records.add(r); } public void log(String msg) { log(null, msg); } public void save(String filename) throws IOException { FileWriter fw = new FileWriter(filename); BufferedWriter bw = new BufferedWriter(fw); try { bw.write(toString()); } finally { bw.close(); } } public String save() throws IOException { //String dir = System.getProperty("java.io.tmpdir"); String dir = "."; String defaultFilename = dir + "/antlr-" + new SimpleDateFormat("yyyy-MM-dd-HH.mm.ss").format(new Date()) + ".log"; save(defaultFilename); return defaultFilename; } @Override public String toString() { if ( records==null ) return ""; String nl = System.getProperty("line.separator"); StringBuilder buf = new StringBuilder(); for (Record r : records) { buf.append(r); buf.append(nl); } return buf.toString(); } public static void main(String[] args) throws IOException { LogManager mgr = new LogManager(); mgr.log("atn", "test msg"); mgr.log("dfa", "test msg 2"); System.out.println(mgr); mgr.save(); } }
⏎ org/antlr/v4/runtime/misc/LogManager.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, 31437👍, 0💬
Popular Posts:
JRE 8 rt.jar is the JAR file for JRE 8 RT (Runtime) libraries. JRE (Java Runtime) 8 is the runtime e...
kernel.jar is a component in iText Java library to provide low-level functionalities. iText Java lib...
How to perform XML Schema validation with dom\Writer.java provided in the Apache Xerces package? You...
What Is javaws.jar in JRE (Java Runtime Environment) 8? javaws.jar in JRE (Java Runtime Environment)...
JDK 11 jdk.jdeps.jmod is the JMOD file for JDK 11 JDeps tool, which can be invoked by the "jdeps" co...