From e8fbd1c42b28c094954004534564dd84fe6a24bb Mon Sep 17 00:00:00 2001 From: Niklas Heneka <93838730+NiklasHeneka@users.noreply.github.com> Date: Tue, 22 Aug 2023 12:42:16 +0200 Subject: [PATCH] Add JavaDoc and some minor fixes. --- .../main/java/de/jplag/llvmir/LLVMIRLanguage.java | 2 +- .../main/java/de/jplag/llvmir/LLVMIRListener.java | 10 ++++++++++ .../java/de/jplag/llvmir/LLVMIRParserAdapter.java | 4 ++++ .../main/java/de/jplag/llvmir/LLVMIRTokenType.java | 12 ++++++++---- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRLanguage.java b/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRLanguage.java index 7b9a2610d..8f0d65830 100644 --- a/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRLanguage.java +++ b/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRLanguage.java @@ -6,7 +6,7 @@ import de.jplag.antlr.AbstractAntlrLanguage; /** - * This represents the LLVMIR language as a language supported by JPlag. + * The entry point for the ANTLR parser based LLVM IR language module. */ @MetaInfServices(Language.class) public class LLVMIRLanguage extends AbstractAntlrLanguage { diff --git a/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRListener.java b/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRListener.java index 8bddcfed3..ed0efc65f 100644 --- a/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRListener.java +++ b/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRListener.java @@ -115,8 +115,18 @@ import de.jplag.antlr.AbstractAntlrListener; import de.jplag.antlr.TokenCollector; +/** + * Extracts tokens from the ANTLR parse tree. The token abstraction includes nesting tokens for functions and basic + * blocks and separate tokens for different elements. These include binary and bitwise instructions, memory operations, + * terminator instructions, conversions, global variables, type definitions, constants, and others. + */ public class LLVMIRListener extends AbstractAntlrListener { + /** + * New instance + * @param collector The token collector the token will be added to + * @param currentFile The currently processed file + */ public LLVMIRListener(TokenCollector collector, File currentFile) { super(collector, currentFile); diff --git a/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRParserAdapter.java b/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRParserAdapter.java index a28670e79..0d96e301e 100644 --- a/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRParserAdapter.java +++ b/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRParserAdapter.java @@ -4,12 +4,16 @@ import org.antlr.v4.runtime.*; +import de.jplag.AbstractParser; import de.jplag.antlr.AbstractAntlrListener; import de.jplag.antlr.AbstractAntlrParserAdapter; import de.jplag.antlr.TokenCollector; import de.jplag.llvmir.grammar.LLVMIRLexer; import de.jplag.llvmir.grammar.LLVMIRParser; +/** + * The adapter between {@link AbstractParser} and the ANTLR based parser of this language module. + */ public class LLVMIRParserAdapter extends AbstractAntlrParserAdapter { @Override protected Lexer createLexer(CharStream input) { diff --git a/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRTokenType.java b/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRTokenType.java index 23c3e082c..0935fa4cc 100644 --- a/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRTokenType.java +++ b/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRTokenType.java @@ -2,6 +2,9 @@ import de.jplag.TokenType; +/** + * LLVM IR token types extracted by this language module. + */ public enum LLVMIRTokenType implements TokenType { FILENAME("FILENAME"), @@ -85,11 +88,12 @@ public enum LLVMIRTokenType implements TokenType { private final String description; - public String getDescription() { - return description; - } - LLVMIRTokenType(String description) { this.description = description; } + + @Override + public String getDescription() { + return description; + } }