View Single Post
  #6 (permalink)  
Old 12-02-2008, 05:37 AM
wntdaliv wntdaliv is offline
Member
 
Join Date: Dec 2008
Posts: 6
Rep Power: 0
wntdaliv is on a distinguished road
Default
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)
Reply With Quote