Ok, so my goal is to get the text between the brackets and turn it into an object and take the text that isn't in between brackets and turn it into a different type of object
Here's some code:
|
Code:
|
public Grammar parseFile(File file)
throws IOException
{
Grammar g = new Grammar();
Scanner scanner = new Scanner(file);
Pattern pattern = Pattern.compile("["); // This is the trouble
scanner.useDelimiter(pattern);
startVariable = scanner.next();
startVariable = startVariable.substring(1, startVariable.length() - 2);
scanner.useDelimiter("{");
while(scanner.hasNext())
{
g.addRule(parseRule(scanner.next()));
}
return g;
} |
I'm trying to take all of the information in the file and turn them into objects (using other classes and such)