Class FileParser
java.lang.Object
io.github.syst3ms.skriptparser.file.FileParser
A class for parsing a plaintext file into a list of
FileElements representing every line.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<FileElement> parseFileLines(String fileName, List<String> lines, int expectedIndentation, int lastLine, SkriptLogger logger) Parses a List of strings into a list ofFileElements.
-
Field Details
-
LINE_PATTERN
-
-
Constructor Details
-
FileParser
public FileParser()
-
-
Method Details
-
parseFileLines
public static List<FileElement> parseFileLines(String fileName, List<String> lines, int expectedIndentation, int lastLine, SkriptLogger logger) Parses a List of strings into a list ofFileElements. This createsFileElementandFileSectionobjects from the lines, effectively structuring the lines into a tree. This removes comments from each line, and discards any blank lines afterwards.- Parameters:
fileName- the name of the file the lines belong tolines- the list of lines to parseexpectedIndentation- the indentation level the first line is expected to be atlastLine- a parameter that keeps track of the line count throughout recursive calls of this method when parsing sectionslogger- the logger- Returns:
- a list of
FileElements
-