Class StandardStringifier
- java.lang.Object
-
- uk.ac.warwick.dcs.sherlock.module.model.base.preprocessing.StandardStringifier
-
- All Implemented Interfaces:
ITokenStringifier
public class StandardStringifier extends java.lang.Object implements ITokenStringifier
-
-
Constructor Summary
Constructors Constructor Description StandardStringifier()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static int
checkLineFinished(java.util.List<IndexedString> output, java.lang.StringBuilder active, int lineCount, org.antlr.v4.runtime.Token t)
Method to check if a line has been finished, if it has it adds the line to the output and moves onto the nextstatic int
preserveCommentLines(java.util.List<IndexedString> output, java.lang.StringBuilder active, int lineCount, org.antlr.v4.runtime.Token t)
Method to split a comment out into its component lines if it spans more than one line to preserve the sourcefile line structurejava.util.List<IndexedString>
processTokens(java.util.List<? extends org.antlr.v4.runtime.Token> tokens, org.antlr.v4.runtime.Vocabulary vocab)
Stringifies a file in the form of a list of tokens
-
-
-
Method Detail
-
processTokens
public java.util.List<IndexedString> processTokens(java.util.List<? extends org.antlr.v4.runtime.Token> tokens, org.antlr.v4.runtime.Vocabulary vocab)
Stringifies a file in the form of a list of tokens- Specified by:
processTokens
in interfaceITokenStringifier
- Parameters:
tokens
- the file as a list of tokensvocab
- the lexer vocab- Returns:
- indexed lines of the file, stringified
-
checkLineFinished
public static int checkLineFinished(java.util.List<IndexedString> output, java.lang.StringBuilder active, int lineCount, org.antlr.v4.runtime.Token t)
Method to check if a line has been finished, if it has it adds the line to the output and moves onto the next- Parameters:
output
- list of output stringsactive
- current stringlineCount
- current lineCountt
- next token- Returns:
- new lineCount
-
preserveCommentLines
public static int preserveCommentLines(java.util.List<IndexedString> output, java.lang.StringBuilder active, int lineCount, org.antlr.v4.runtime.Token t)
Method to split a comment out into its component lines if it spans more than one line to preserve the sourcefile line structure- Parameters:
output
- list of output stringsactive
- current stringlineCount
- current lineCountt
- token containing comment- Returns:
- new lineCount
-
-