package edu.asu.plp.compile.parser;

import java.util.List;

import edu.asu.plp.Token;
import edu.asu.plp.compile.parser.tree.ParseNode;

public class Parser
{
	private List<Token> tokens;
	
	public Parser(List<Token> tokens)
	{
		this.tokens = tokens;
	}
	
	private void parsePackage()
	{
		// TODO
	}
	
	private void parseImports()
	{
		// TODO
	}
	
	private void parseClass()
	{
		
	}
	
	private ParseNode parseMethod()
	{
		
		return null;
	}
	
	public static void main(String[] args)
	{
		
	}
	
}

@@ -83,58 +83,8 @@
 ken;
-%0Aimport edu.asu.plp.compile.parser.tree.ParseNode;
 %0A%0Apu
@@ -132,16 +132,45 @@
 tokens;%0A
+%09private String tokenString;%0A
 %09%0A%09publi
@@ -225,16 +225,625 @@
 tokens;%0A
+%09%09this.tokenString = stringify(tokens);%0A%09%7D%0A%09%0A%09private String stringify(List%3CToken%3E tokens)%0A%09%7B%0A%09%09StringBuilder stringBuilder = new StringBuilder();%0A%09%09%0A%09%09Token first = tokens.get(0);%0A%09%09stringBuilder.append(stringify(first));%0A%09%09%0A%09%09for (int index = 1; index %3C tokens.size(); index++)%0A%09%09%7B%0A%09%09%09Token token = tokens.get(index);%0A%09%09%09stringBuilder.append(%22 %22);%0A%09%09%09stringBuilder.append(stringify(token));%0A%09%09%7D%0A%09%09%0A%09%09return stringBuilder.toString();%0A%09%7D%0A%09%0A%09private String stringify(Token token)%0A%09%7B%0A%09%09// FIXME: this algorithm breaks if the token value contains spaces%0A%09%09return token.getType().name() + %22-%22 + token.getValue();%0A
 %09%7D%0A%09%0A%09pr
@@ -984,17 +984,12 @@
 ate 
-ParseNode
+void
  par
@@ -1008,23 +1008,503 @@
 %7B%0A%09%09
-%0A%09%09return null;
+String declarationRegex = %22(TYPE-%5C%5CS*) (REFERNCE-%5C%5CS*) (CONTROL-;)%22;%0A%09%09// TODO: support parenthesis scopes (e.g. var = a + (b * c) - (b + a))%0A%09%09String assignmentRegex = %22(REFERNCE-%5C%5CS*) (OPERATOR_BINARY-=) %22%0A%09%09%09%09+ %22(%22%0A%09%09%09%09%09+ %22((REFERNCE-%5C%5CS*)%7C(LITERAL_%5C%5CS*))%22%0A%09%09%09%09%09+ %22( (OPERATOR_BINARY-%5B%5E%5C%5Cs=%5D*) ((REFERNCE-%5C%5CS*)%7C(LITERAL_%5C%5CS*)))*%22%0A%09%09%09%09+ %22)%22 + %22(CONTROL-;)%22;%0A%09%09String declareAndAssignRegex = %22(TYPE-%5C%5CS*) )%22 + assignmentRegex;%0A%09%09String methodRegex = %22(REFERNCE-%5C%5CS*) (CONTROL-%5C%5C()%22%0A%09%09%09%09+ %22%22;%0A%09%09
 %0A%09%7D%0A

Revert "Perge"