Commits

PioneerAxon committed 93d45fb

Fix coding style issues Phase: 1

  • Participants
  • Parent commits 7ada46e

Comments (0)

Files changed (8)

 #include <assert.h>
 #include <string.h>
 
-#include <lexer.h>
-#include <parserfunc.h>
+#include "lexer.h"
+#include "parserfunc.h"
 #include "mp-equation.h"
 
 static gint
-l_check_if_function (LexerState* state)
+l_check_if_function(LexerState* state)
 {
-	gchar* name = pl_get_marked_substring (state->prelexer);
-	if (!state->parent->function_is_defined) {
-		free (name);
+	gchar* name = pl_get_marked_substring(state->prelexer);
+	if(!state->parent->function_is_defined)
+	{
+		free(name);
 		return 0;
 	}
-	if ((*(state->parent->function_is_defined)) (state->parent, name)) {
-		free (name);
+	if ((*(state->parent->function_is_defined))(state->parent, name))
+	{
+		free(name);
 		return 1;
 	}
-	else {
-		free (name);
+	else
+	{
+		free(name);
 		return 0;
 	}
 }
 
 static gint
-l_check_if_number (LexerState* state)
+l_check_if_number(LexerState* state)
 {
 	MPNumber tmp;
 	int count = 0;
-	gchar* text = pl_get_marked_substring (state->prelexer);
-	if (mp_set_from_string (text, state->parent->options->base, &tmp) == 0) {
-		free (text);
+	gchar* text = pl_get_marked_substring(state->prelexer);
+	if(mp_set_from_string(text, state->parent->options->base, &tmp) == 0)
+	{
+		free(text);
 		return 1;
 	}
-	else {
+	else
+	{
 		/* Try to rollback several characters to see, if that yeilds any number. */
-		while (strlen (text) > 0) {
-			if (mp_set_from_string (text, state->parent->options->base, &tmp) == 0) {
-				free (text);
+		while(strlen (text) > 0)
+		{
+			if(mp_set_from_string(text, state->parent->options->base, &tmp) == 0)
+			{
+				free(text);
 				return 1;
 			}
-			free (text);
+			free(text);
 			count++;
-			pl_roll_back (state->prelexer);
-			text = pl_get_marked_substring (state->prelexer);
+			pl_roll_back(state->prelexer);
+			text = pl_get_marked_substring(state->prelexer);
 		}
 		/* Undo all rollbacks. */
-		while (count--) pl_get_next_token (state->prelexer);
-		free (text);
+		while(count--) 
+			pl_get_next_token (state->prelexer);
+		free(text);
 		return 0;
 	}
 }
 static LexerToken*
 l_insert_token(LexerState* state, const LexerTokenType type)
 {
-	state->tokens = (LexerToken *) realloc (state->tokens, (state->token_count + 1) * sizeof (LexerToken));
-	assert (state->tokens != NULL);
-	state->tokens [state->token_count].string = pl_get_marked_substring (state->prelexer);
-	state->tokens [state->token_count].start_index = state->prelexer->mark_index;
-	state->tokens [state->token_count].end_index = state->prelexer->next_index;
-	state->tokens [state->token_count].token_type = type;
+	state->tokens = (LexerToken *) realloc(state->tokens, (state->token_count + 1) * sizeof(LexerToken));
+	assert(state->tokens != NULL);
+	state->tokens[state->token_count].string = pl_get_marked_substring(state->prelexer);
+	state->tokens[state->token_count].start_index = state->prelexer->mark_index;
+	state->tokens[state->token_count].end_index = state->prelexer->next_index;
+	state->tokens[state->token_count].token_type = type;
 	state->token_count++;
-	return &state->tokens [state->token_count - 1];
+	return &state->tokens[state->token_count - 1];
 }
 
 /* Generates next token from pre-lexer stream and call l_insert_token() to insert it at the end. */
 	PreLexerState* state = lstate->prelexer;
 	LexerTokenType type;
 	gchar* tmp;
-	pl_set_marker (state);
+	pl_set_marker(state);
 	/* Ignore all blank spaces. :) */
-	while ((type = pl_get_next_token (state)) == PL_SKIP)
+	while((type = pl_get_next_token(state)) == PL_SKIP)
 		/* Set marker. Beginning of new token. */
-		pl_set_marker (state);
-	if (type == T_AND
-	 || type == T_OR
-	 || type == T_XOR
-	 || type == T_NOT
-	 || type == T_ADD
-	 || type == T_SUBTRACT
-	 || type == T_MULTIPLY
-	 || type == T_DIVIDE
-	 || type == T_L_FLOOR
-	 || type == T_R_FLOOR
-	 || type == T_L_CEILING
-	 || type == T_R_CEILING
-	 || type == T_ROOT
-	 || type == T_ROOT_3
-	 || type == T_ROOT_4
-	 || type == T_ASSIGN
-	 || type == T_L_R_BRACKET
-	 || type == T_R_R_BRACKET
-	 || type == T_L_S_BRACKET
-	 || type == T_R_S_BRACKET
-	 || type == T_L_C_BRACKET
-	 || type == T_R_C_BRACKET
-	 || type == T_ABS
-	 || type == T_POWER
-	 || type == T_FACTORIAL
-	 || type == T_PERCENTAGE) {
-		return l_insert_token (lstate, type);
+		pl_set_marker(state);
+	if(type == T_AND
+	 ||type == T_OR
+	 ||type == T_XOR
+	 ||type == T_NOT
+	 ||type == T_ADD
+	 ||type == T_SUBTRACT
+	 ||type == T_MULTIPLY
+	 ||type == T_DIVIDE
+	 ||type == T_L_FLOOR
+	 ||type == T_R_FLOOR
+	 ||type == T_L_CEILING
+	 ||type == T_R_CEILING
+	 ||type == T_ROOT
+	 ||type == T_ROOT_3
+	 ||type == T_ROOT_4
+	 ||type == T_ASSIGN
+	 ||type == T_L_R_BRACKET
+	 ||type == T_R_R_BRACKET
+	 ||type == T_L_S_BRACKET
+	 ||type == T_R_S_BRACKET
+	 ||type == T_L_C_BRACKET
+	 ||type == T_R_C_BRACKET
+	 ||type == T_ABS
+	 ||type == T_POWER
+	 ||type == T_FACTORIAL
+	 ||type == T_PERCENTAGE)
+	{
+		return l_insert_token(lstate, type);
 	}
 	/* [PL_SUPER_MINUS][PL_SUPER_DIGIT]+ */
-	if (type == PL_SUPER_MINUS) {
-		if ((type = pl_get_next_token (state)) != PL_SUPER_DIGIT) {
+	if(type == PL_SUPER_MINUS)
+	{
+		if((type = pl_get_next_token(state)) != PL_SUPER_DIGIT)
+		{
 			/* ERROR: expected PL_SUP_DIGIT */
-			set_error (lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring (state));
-			free (tmp);
-			return l_insert_token (lstate, T_UNKNOWN);
+			set_error(lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring (state));
+			free(tmp);
+			return l_insert_token(lstate, T_UNKNOWN);
 		}
-		while (pl_get_next_token (state) == PL_SUPER_DIGIT);
-		pl_roll_back (state);
-		return l_insert_token (lstate, T_NSUP_NUMBER);
+		/* Get all PL_SUPER_DIGITs. */
+		while (pl_get_next_token(state) == PL_SUPER_DIGIT);
+		pl_roll_back(state);
+		return l_insert_token(lstate, T_NSUP_NUMBER);
 	}
 	/* [PL_SUPER_DIGIT]+ */
-	if (type == PL_SUPER_DIGIT) {
-		while (pl_get_next_token (state) == PL_SUPER_DIGIT);
-		pl_roll_back (state);
-		return l_insert_token (lstate, T_SUP_NUMBER);
+	if(type == PL_SUPER_DIGIT)
+	{
+		while(pl_get_next_token(state) == PL_SUPER_DIGIT);
+		pl_roll_back(state);
+		return l_insert_token(lstate, T_SUP_NUMBER);
 	}
 	/* [PL_SUB_DIGIT]+ */
-	if (type == PL_SUB_DIGIT) {
-		while (pl_get_next_token (state) == PL_SUB_DIGIT);
-		pl_roll_back (state);
-		return l_insert_token (lstate, T_SUB_NUMBER);
+	if(type == PL_SUB_DIGIT)
+	{
+		while(pl_get_next_token(state) == PL_SUB_DIGIT);
+		pl_roll_back(state);
+		return l_insert_token(lstate, T_SUB_NUMBER);
 	}
 	/* [PL_FRACTION] */
-	if (type == PL_FRACTION) {
-		return l_insert_token (lstate, T_NUMBER);
+	if(type == PL_FRACTION)
+	{
+		return l_insert_token(lstate, T_NUMBER);
 	}
-	if (type == PL_DIGIT) {
-		while ((type = pl_get_next_token (state)) == PL_DIGIT);
-		if (type == PL_FRACTION) {
-			return l_insert_token (lstate, T_NUMBER);
+	if(type == PL_DIGIT)
+	{
+		while((type = pl_get_next_token(state)) == PL_DIGIT);
+		if(type == PL_FRACTION)
+		{
+			return l_insert_token(lstate, T_NUMBER);
 		}
-		else if (type == PL_SUB_DIGIT) {
-			while (pl_get_next_token (state) == PL_SUB_DIGIT);
-			pl_roll_back (state);
-			return l_insert_token (lstate, T_NUMBER);
+		else if(type == PL_SUB_DIGIT)
+		{
+			while(pl_get_next_token(state) == PL_SUB_DIGIT);
+			pl_roll_back(state);
+			return l_insert_token(lstate, T_NUMBER);
 		}
-		else if (type == PL_DEGREE) {
-			type = pl_get_next_token (state);
-			if (type == PL_DIGIT) {
-				while ((type = pl_get_next_token (state)) == PL_DIGIT);
-				if (type == PL_DECIMAL) {
+		else if(type == PL_DEGREE)
+		{
+			type = pl_get_next_token(state);
+			if(type == PL_DIGIT)
+			{
+				while((type = pl_get_next_token(state)) == PL_DIGIT);
+				if(type == PL_DECIMAL)
+				{
 					goto ANGLE_NUM_DM_STATE;
 				}
-				else if (type == PL_MINUTE) {
-					type = pl_get_next_token (state);
-					if (type == PL_DIGIT) {
-						while ((type = pl_get_next_token (state)) == PL_DIGIT);
-						if (type == PL_DECIMAL) {
+				else if(type == PL_MINUTE)
+				{
+					type = pl_get_next_token(state);
+					if(type == PL_DIGIT)
+					{
+						while((type = pl_get_next_token(state)) == PL_DIGIT);
+						if(type == PL_DECIMAL)
+						{
 							goto ANGLE_NUM_DMS_STATE;
 						}
-						else if (type == PL_SECOND) {
-							return l_insert_token (lstate, T_NUMBER);
+						else if(type == PL_SECOND)
+						{
+							return l_insert_token(lstate, T_NUMBER);
 						}
-						else {
+						else
+						{
 							/* ERROR: expected PL_SECOND */
-							set_error (lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring (state));
-							free (tmp);
-							return l_insert_token (lstate, T_UNKNOWN);
+							set_error(lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring (state));
+							free(tmp);
+							return l_insert_token(lstate, T_UNKNOWN);
 						}
 					}
-					else if (type == PL_DECIMAL) {
+					else if(type == PL_DECIMAL)
+					{
 ANGLE_NUM_DMS_STATE:
-						if ((type = pl_get_next_token (state)) != PL_DIGIT) {
+						if((type = pl_get_next_token (state)) != PL_DIGIT)
+						{
 							/* ERROR: expected PL_DIGIT */
-							set_error (lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring (state));
-							free (tmp);
-							return l_insert_token (lstate, T_UNKNOWN);
+							set_error(lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring(state));
+							free(tmp);
+							return l_insert_token(lstate, T_UNKNOWN);
 						}
-						while ((type = pl_get_next_token (state)) == PL_DIGIT);
-						if (type == PL_SECOND) {
-							return l_insert_token (lstate, T_NUMBER);
+						while((type = pl_get_next_token(state)) == PL_DIGIT);
+						if(type == PL_SECOND)
+						{
+							return l_insert_token(lstate, T_NUMBER);
 						}
-						else {
+						else
+						{
 							/* ERROR: expected PL_SECOND */
-							set_error (lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring (state));
-							free (tmp);
-							return l_insert_token (lstate, T_UNKNOWN);
+							set_error(lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring(state));
+							free(tmp);
+							return l_insert_token(lstate, T_UNKNOWN);
 						}
 					}
-					else {
-						pl_roll_back (state);
-						return l_insert_token (lstate, T_NUMBER);
+					else
+					{
+						pl_roll_back(state);
+						return l_insert_token(lstate, T_NUMBER);
 					}
 				}
-				else {
+				else
+				{
 					/* ERROR: expected PL_MINUTE | PL_DIGIT */
-					set_error (lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring (state));
-					free (tmp);
-					return l_insert_token (lstate, T_UNKNOWN);
+					set_error(lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring(state));
+					free(tmp);
+					return l_insert_token(lstate, T_UNKNOWN);
 				}
 			}
-			else if (type == PL_DECIMAL) {
+			else if(type == PL_DECIMAL)
+			{
 ANGLE_NUM_DM_STATE:
-				if ((type = pl_get_next_token (state)) != PL_DIGIT) {
+				if((type = pl_get_next_token(state)) != PL_DIGIT)
+				{
 					/* ERROR: expected PL_DIGIT */
-					set_error (lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring (state));
-					free (tmp);
-					return l_insert_token (lstate, T_UNKNOWN);
+					set_error(lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring(state));
+					free(tmp);
+					return l_insert_token(lstate, T_UNKNOWN);
 				}
-				while ((type = pl_get_next_token (state)) == PL_DIGIT);
-				if (type == PL_MINUTE) {
-					return l_insert_token (lstate, T_NUMBER);
+				while((type = pl_get_next_token(state)) == PL_DIGIT);
+				if(type == PL_MINUTE)
+				{
+					return l_insert_token(lstate, T_NUMBER);
 				}
-				else {
+				else
+				{
 					/* ERROR: expected PL_MINUTE */
-					set_error (lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring (state));
-					free (tmp);
-					return l_insert_token (lstate, T_UNKNOWN);
+					set_error(lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring(state));
+					free(tmp);
+					return l_insert_token(lstate, T_UNKNOWN);
 				}
 			}
-			else {
-				return l_insert_token (lstate, T_NUMBER);
+			else
+			{
+				return l_insert_token(lstate, T_NUMBER);
 			}
 		}
-		else if (type == PL_DECIMAL) {
+		else if(type == PL_DECIMAL)
+		{
 			goto DECIMAL_STATE;
 		}
-		else if (type == PL_HEX) {
+		else if(type == PL_HEX)
+		{
 			goto HEX_DEC_STATE;
 		}
-		else {
-			pl_roll_back (state);
-			return l_insert_token (lstate, T_NUMBER);
+		else
+		{
+			pl_roll_back(state);
+			return l_insert_token(lstate, T_NUMBER);
 		}
 	}
-	if (type == PL_DECIMAL) {
+	if(type == PL_DECIMAL)
+	{
 DECIMAL_STATE:
-		type = pl_get_next_token (state);
-		if (type == PL_DIGIT) {
-			while ((type = pl_get_next_token (state)) == PL_DIGIT);
-			if (type == PL_DEGREE) {
-				return l_insert_token (lstate, T_NUMBER);
+		type = pl_get_next_token(state);
+		if(type == PL_DIGIT)
+		{
+			while((type = pl_get_next_token(state)) == PL_DIGIT);
+			if(type == PL_DEGREE)
+			{
+				return l_insert_token(lstate, T_NUMBER);
 			}
-			else if (type == PL_HEX) {
+			else if(type == PL_HEX)
+			{
 				goto DECIMAL_HEX_STATE;
 			}
-			else if (type == PL_SUB_DIGIT) {
-				while (pl_get_next_token (state) == PL_SUB_DIGIT);
-				pl_roll_back (state);
-				return l_insert_token (lstate, T_NUMBER);
+			else if(type == PL_SUB_DIGIT)
+			{
+				while(pl_get_next_token(state) == PL_SUB_DIGIT);
+				pl_roll_back(state);
+				return l_insert_token(lstate, T_NUMBER);
 			}
-			else {
-				pl_roll_back (state);
-				return l_insert_token (lstate, T_NUMBER);
+			else
+			{
+				pl_roll_back(state);
+				return l_insert_token(lstate, T_NUMBER);
 			}
 		}
-		else if (type == PL_HEX) {
+		else if(type == PL_HEX)
+		{
 			goto DECIMAL_HEX_STATE;
 		}
-		else {
+		else
+		{
 			/* ERROR: expected PL_DIGIT | PL_HEX */
-			set_error (lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring (state));
-			free (tmp);
-			return l_insert_token (lstate, T_UNKNOWN);
+			set_error(lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring(state));
+			free(tmp);
+			return l_insert_token(lstate, T_UNKNOWN);
 		}
 	}
-	if (type == PL_HEX) {
-		while ((type = pl_get_next_token (state)) == PL_HEX);
-		if (type == PL_DIGIT) {
+	if(type == PL_HEX)
+	{
+		while((type = pl_get_next_token(state)) == PL_HEX);
+		if(type == PL_DIGIT)
+		{
 HEX_DEC_STATE:
-			while (1) {
-				type = pl_get_next_token (state);
-				if (type == PL_DIGIT || type == PL_HEX) {
+			while(1)
+			{
+				type = pl_get_next_token(state);
+				if(type == PL_DIGIT || type == PL_HEX)
+				{
 					continue;
 				}
-				else if (type == PL_DECIMAL) {
+				else if(type == PL_DECIMAL)
+				{
 					goto DECIMAL_HEX_STATE;
 				}
-				else if (type == PL_SUB_DIGIT) {
-					while (pl_get_next_token (state) == PL_SUB_DIGIT);
-					pl_roll_back (state);
-					return l_insert_token (lstate, T_NUMBER);
+				else if(type == PL_SUB_DIGIT)
+				{
+					while(pl_get_next_token(state) == PL_SUB_DIGIT);
+					pl_roll_back(state);
+					return l_insert_token(lstate, T_NUMBER);
 				}
-				else {
-					if (l_check_if_number (lstate))
-						return l_insert_token (lstate, T_NUMBER);
+				else
+				{
+					if(l_check_if_number(lstate))
+						return l_insert_token(lstate, T_NUMBER);
 					/* ERROR: expected PL_DECIMAL | PL_DIGIT | PL_HEX */
-					set_error (lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring (state));
-					free (tmp);
-					return l_insert_token (lstate, T_UNKNOWN);
+					set_error(lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring(state));
+					free(tmp);
+					return l_insert_token(lstate, T_UNKNOWN);
 				}
 			}
-			
 		}
-		else if (type == PL_DECIMAL) {
+		else if(type == PL_DECIMAL)
+		{
 DECIMAL_HEX_STATE:
-			type = pl_get_next_token (state);
-			if (!(type == PL_DIGIT || type == PL_HEX)) {
+			type = pl_get_next_token(state);
+			if(!(type == PL_DIGIT || type == PL_HEX))
+			{
 				/* ERROR: expected PL_DIGIT | PL_HEX */
-				set_error (lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring (state));
-				free (tmp);
-				return l_insert_token (lstate, T_UNKNOWN);
+				set_error(lstate->parent, PARSER_ERR_MP, tmp = pl_get_marked_substring(state));
+				free(tmp);
+				return l_insert_token(lstate, T_UNKNOWN);
 			}
-			while (1) {
-				type = pl_get_next_token (state);
-				if (type == PL_DIGIT || type == PL_HEX) {
+			while(1)
+			{
+				type = pl_get_next_token(state);
+				if(type == PL_DIGIT || type == PL_HEX)
+				{
 					continue;
 				}
-				else if (type == PL_SUB_DIGIT) {
-					while (pl_get_next_token (state) == PL_SUB_DIGIT);
-					pl_roll_back (state);
-					return l_insert_token (lstate, T_NUMBER);
+				else if(type == PL_SUB_DIGIT)
+				{
+					while(pl_get_next_token(state) == PL_SUB_DIGIT);
+					pl_roll_back(state);
+					return l_insert_token(lstate, T_NUMBER);
 				}
-				else {
-					pl_roll_back (state);
-					return l_insert_token (lstate, T_NUMBER);
+				else
+				{
+					pl_roll_back(state);
+					return l_insert_token(lstate, T_NUMBER);
 				}
 			}
 		}
-		else if (type == PL_SUB_DIGIT) {
-			while (pl_get_next_token (state) == PL_SUB_DIGIT);
-			pl_roll_back (state);
-			if (l_check_if_number (lstate)) {
+		else if(type == PL_SUB_DIGIT)
+		{
+			while(pl_get_next_token(state) == PL_SUB_DIGIT);
+			pl_roll_back(state);
+			if(l_check_if_number(lstate))
+			{
 				/* NUMBER */
-				return l_insert_token (lstate, T_NUMBER);
+				return l_insert_token(lstate, T_NUMBER);
 			}
-			else {
+			else
+			{
 				/* VARIABLE */
-				if (l_check_if_function (lstate)) {
-					return l_insert_token (lstate, T_FUNCTION);
+				if(l_check_if_function(lstate))
+				{
+					return l_insert_token(lstate, T_FUNCTION);
 				}
-				else {
-					return l_insert_token (lstate, T_VARIABLE);
+				else
+				{
+					return l_insert_token(lstate, T_VARIABLE);
 				}
 			}
 		}
-		else if (type == PL_LETTER) {
+		else if(type == PL_LETTER)
+		{
 			goto LETTER_STATE;
 		}
-		else {
-			pl_roll_back (state);
-			if (l_check_if_number (lstate)) {
+		else
+		{
+			pl_roll_back(state);
+			if(l_check_if_number(lstate))
+			{
 				/* NUMBER */
-				return l_insert_token (lstate, T_NUMBER);
+				return l_insert_token(lstate, T_NUMBER);
 			}
-			else {
+			else
+			{
 				/* VARIABLE */
-				if (l_check_if_function (lstate)) {
-					return l_insert_token (lstate, T_FUNCTION);
+				if(l_check_if_function(lstate))
+				{
+					return l_insert_token(lstate, T_FUNCTION);
 				}
-				else {
-					return l_insert_token (lstate, T_VARIABLE);
+				else
+				{
+					return l_insert_token(lstate, T_VARIABLE);
 				}
 			}
 		}
 	}
-	if (type == PL_LETTER) {
+	if(type == PL_LETTER)
+	{
 LETTER_STATE:
-		while (1) {
-			type = pl_get_next_token (state);
-			if (type == PL_LETTER || type == PL_HEX) {
+		while(1)
+		{
+			type = pl_get_next_token(state);
+			if(type == PL_LETTER || type == PL_HEX)
+			{
 				continue;
 			}
-			else if (type == PL_SUB_DIGIT) {
-				while (pl_get_next_token (state) == PL_SUB_DIGIT);
-				pl_roll_back (state);
-				tmp = g_ascii_strdown ( pl_get_marked_substring (state), -1);
-				if (g_strcmp0 (tmp, "mod") == 0) {
-					return l_insert_token (lstate, T_MOD);
-				}
-				if (g_strcmp0 (tmp, "and") == 0) {
-					return l_insert_token (lstate, T_AND);
-				}
-				if (g_strcmp0 (tmp, "or") == 0) {
-					return l_insert_token (lstate, T_OR);
-				}
-				if (g_strcmp0 (tmp, "xor") == 0) {
-					return l_insert_token (lstate, T_XOR);
-				}
-				if (g_strcmp0 (tmp, "not") == 0) {
-					return l_insert_token (lstate, T_NOT);
-				}
-				if (g_strcmp0 (tmp, "in") == 0) {
-					return l_insert_token (lstate, T_IN);
-				}
-				if (l_check_if_function (lstate)) {
-					return l_insert_token (lstate, T_FUNCTION);
-				}
-				else {
-					return l_insert_token (lstate, T_VARIABLE);
+			else if(type == PL_SUB_DIGIT)
+			{
+				while(pl_get_next_token(state) == PL_SUB_DIGIT);
+				pl_roll_back(state);
+				tmp = g_ascii_strdown(pl_get_marked_substring(state), -1);
+				if(g_strcmp0(tmp, "mod") == 0)
+				{
+					return l_insert_token(lstate, T_MOD);
+				}
+				if(g_strcmp0(tmp, "and") == 0)
+				{
+					return l_insert_token(lstate, T_AND);
+				}
+				if(g_strcmp0(tmp, "or") == 0)
+				{
+					return l_insert_token(lstate, T_OR);
+				}
+				if(g_strcmp0(tmp, "xor") == 0)
+				{
+					return l_insert_token(lstate, T_XOR);
+				}
+				if(g_strcmp0(tmp, "not") == 0)
+				{
+					return l_insert_token(lstate, T_NOT);
+				}
+				if(g_strcmp0(tmp, "in") == 0)
+				{
+					return l_insert_token(lstate, T_IN);
+				}
+				if(l_check_if_function(lstate))
+				{
+					return l_insert_token(lstate, T_FUNCTION);
+				}
+				else
+				{
+					return l_insert_token(lstate, T_VARIABLE);
 				}
 			}
-			else {
-				pl_roll_back (state);
-				tmp = g_ascii_strdown ( pl_get_marked_substring (state), -1);
-				if (g_strcmp0 (tmp, "mod") == 0) {
-					return l_insert_token (lstate, T_MOD);
-				}
-				if (g_strcmp0 (tmp, "and") == 0) {
-					return l_insert_token (lstate, T_AND);
-				}
-				if (g_strcmp0 (tmp, "or") == 0) {
-					return l_insert_token (lstate, T_OR);
-				}
-				if (g_strcmp0 (tmp, "xor") == 0) {
-					return l_insert_token (lstate, T_XOR);
-				}
-				if (g_strcmp0 (tmp, "not") == 0) {
-					return l_insert_token (lstate, T_NOT);
-				}
-				if (g_strcmp0 (tmp, "in") == 0) {
-					return l_insert_token (lstate, T_IN);
-				}
-				if (l_check_if_function (lstate)) {
-					return l_insert_token (lstate, T_FUNCTION);
-				}
-				else {
-					return l_insert_token (lstate, T_VARIABLE);
+			else
+			{
+				pl_roll_back(state);
+				tmp = g_ascii_strdown(pl_get_marked_substring(state), -1);
+				if(g_strcmp0(tmp, "mod") == 0)
+				{
+					return l_insert_token(lstate, T_MOD);
+				}
+				if(g_strcmp0(tmp, "and") == 0)
+				{
+					return l_insert_token(lstate, T_AND);
+				}
+				if(g_strcmp0(tmp, "or") == 0)
+				{
+					return l_insert_token(lstate, T_OR);
+				}
+				if(g_strcmp0(tmp, "xor") == 0)
+				{
+					return l_insert_token(lstate, T_XOR);
+				}
+				if(g_strcmp0(tmp, "not") == 0)
+				{
+					return l_insert_token(lstate, T_NOT);
+				}
+				if(g_strcmp0(tmp, "in") == 0)
+				{
+					return l_insert_token(lstate, T_IN);
+				}
+				if(l_check_if_function(lstate))
+				{
+					return l_insert_token(lstate, T_FUNCTION);
+				}
+				else
+				{
+					return l_insert_token(lstate, T_VARIABLE);
 				}
 			}
 		}
 	}
-	if (type == PL_EOS) {
-		return l_insert_token (lstate, PL_EOS);
+	if(type == PL_EOS)
+	{
+		return l_insert_token(lstate, PL_EOS);
 	}
 	/* ERROR: Unexpected token.. X( */
-	set_error (lstate->parent, PARSER_ERR_INVALID, tmp = pl_get_marked_substring (state));
-	free (tmp);
-	return l_insert_token (lstate, T_UNKNOWN);
+	set_error(lstate->parent, PARSER_ERR_INVALID, tmp = pl_get_marked_substring(state));
+	free(tmp);
+	return l_insert_token(lstate, T_UNKNOWN);
 }
 
 /* Call l_insert_next_token() as many times as needed to completely tokenize the string. */
 l_insert_all_tokens(LexerState* state)
 {
 	LexerToken* token;
-	while (1) {
-		token = l_insert_next_token (state);
-		assert (token != NULL);
-		if (token->token_type == PL_EOS) {
+	while(1)
+	{
+		token = l_insert_next_token(state);
+		assert(token != NULL);
+		if(token->token_type == PL_EOS)
+		{
 			break;
 		}
 	}
 l_create_lexer(const gchar* input, struct parser_state* parent)
 {
 	LexerState* ret;
-	ret = (LexerState *) malloc (sizeof (LexerState));
-	assert (ret != NULL);
-	ret->prelexer = pl_create_scanner (input);
+	ret = (LexerState *) malloc(sizeof(LexerState));
+	assert(ret != NULL);
+	ret->prelexer = pl_create_scanner(input);
 	ret->tokens = NULL;
 	ret->token_count = 0;
 	ret->next_token = 0;
 l_destroy_lexer(LexerState* state)
 {
 	int l;
-	pl_destroy_scanner (state->prelexer);
-	for (l = 0; l < state->token_count; l++) {
-		free (state->tokens [l].string);
+	pl_destroy_scanner(state->prelexer);
+	for(l = 0; l < state->token_count; l++)
+	{
+		free(state->tokens[l].string);
 	}
-	free (state->tokens);
-	free (state);
+	free(state->tokens);
+	free(state);
 }
 
 /* Get next token interface. Will be called by parser to get pointer to next token in token stream. */
 l_get_next_token(LexerState* state)
 {
 	/* Return PL_EOS token after token stream reaches to its end. */
-	if (state->next_token >= state->token_count)
-		return &state->tokens [state->token_count - 1];
-	return &state->tokens [state->next_token++];
+	if(state->next_token >= state->token_count)
+		return &state->tokens[state->token_count - 1];
+	return &state->tokens[state->next_token++];
 }
 
 /* Roll back one lexer token. */
 void
 l_roll_back(LexerState* state)
 {
-	if (state->next_token > 0)
+	if(state->next_token > 0)
 		state->next_token--;
 }
 #ifndef LEXER_H
 #define LEXER_H
 
-#include <prelexer.h>
+#include "prelexer.h"
 
 /* Structure to hold single token. */
-typedef struct {
+typedef struct
+{
 	gchar* string;			/* Poniter to local copy of token string. */
 	guint start_index;		/* Start index in original stream. */
 	guint end_index;		/* End index in original stream. */
 } LexerToken;
 
 /* Structure to hold lexer state and all the tokens. */
-typedef struct {
+typedef struct
+{
 	PreLexerState *prelexer;	/* Pre-lexer state. Pre-lexer is part of lexer. */
 	LexerToken *tokens;		/* Pointer to the dynamic array of LexerTokens. */
 	guint token_count;		/* Count of tokens in array. */
 } LexerState;
 
 /* Create a new LexerState object and fill the dynamic array with tokens. */
-LexerState *l_create_lexer (const gchar *, struct parser_state *);
+LexerState *l_create_lexer(const gchar *, struct parser_state *);
 
 /* Destroy LexerState object and free up space. */
-void l_destroy_lexer (LexerState *);
+void l_destroy_lexer(LexerState *);
 
 /* Tokanize complete string. */
-void l_insert_all_tokens (LexerState *);
+void l_insert_all_tokens(LexerState *);
 
 /* Return next, to be sent, token. */
-LexerToken *l_get_next_token (LexerState *);
+LexerToken *l_get_next_token(LexerState *);
 
 /* Roll back one token. */
-void l_roll_back (LexerState *);
+void l_roll_back(LexerState *);
 
 #endif /* LEXER_H */
-#include<stdlib.h>
-#include<stdio.h>
-#include<assert.h>
-#include<string.h>
-
-#include<parser.h>
-#include<parserfunc.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include <string.h>
 
+#include "parser.h"
+#include "parserfunc.h"
 #include "mp-equation.h"
 
 /* Converts LexerTokenType to Precedence value. */
 static guint
-p_get_precedence (LexerTokenType type)
+p_get_precedence(LexerTokenType type)
 {
 	/* WARNING: This function doesn't work for Unary Plus and Unary Minus. Use their precedence directly while inserting them in tree. */
-	if (type == T_ADD
-	 || type == T_SUBTRACT)
+	if(type == T_ADD
+	 ||type == T_SUBTRACT)
 		return P_AddSubtract;
-	if (type == T_MULTIPLY)
+	if(type == T_MULTIPLY)
 		return P_Multiply;
-	if (type == T_MOD)
+	if(type == T_MOD)
 		return P_Mod;
-	if (type == T_DIVIDE)
+	if(type == T_DIVIDE)
 		return P_Divide;
-	if (type == T_NOT)
+	if(type == T_NOT)
 		return P_Not;
-	if (type == T_ROOT
-	 || type == T_ROOT_3
-	 || type == T_ROOT_4)
+	if(type == T_ROOT
+	 ||type == T_ROOT_3
+	 ||type == T_ROOT_4)
 		return P_Root;
-	if (type == T_FUNCTION)
+	if(type == T_FUNCTION)
 		return P_Function;
-	if (type == T_AND
-	 || type == T_OR
-	 || type == T_XOR)
+	if(type == T_AND
+	 ||type == T_OR
+	 ||type == T_XOR)
 		return P_Boolean;
-	if (type == T_PERCENTAGE)
+	if(type == T_PERCENTAGE)
 		return P_Percentage;
-	if (type == T_POWER)
+	if(type == T_POWER)
 		return P_Power;
-	if (type == T_FACTORIAL)
+	if(type == T_FACTORIAL)
 		return P_Factorial;
-	if (type == T_NUMBER
-	 || type == T_VARIABLE)
+	if(type == T_NUMBER
+	 ||type == T_VARIABLE)
 		return P_NumberVariable;
 	return P_Unknown;
 }
 
 /* Return associativity of specific token type from precedence. */
 static Associativity
-p_get_associativity_p (Precedence type)
+p_get_associativity_p(Precedence type)
 {
-	if (type == P_Boolean
-	 || type == P_Divide
-	 || type == P_Mod
-	 || type == P_Multiply
-	 || type == P_AddSubtract)
+	if(type == P_Boolean
+	 ||type == P_Divide
+	 ||type == P_Mod
+	 ||type == P_Multiply
+	 ||type == P_AddSubtract)
 		return LEFT_ASSOCIATIVE;
-	if (type == P_Power)
+	if(type == P_Power)
 		return RIGHT_ASSOCIATIVE;
 	/* For all remaining / non-associative operators, return Left Associativity. */
 	return LEFT_ASSOCIATIVE;
 
 /* Return associativity of specific token by converting it to precedence first. */
 static Associativity
-p_get_associativity (LexerToken* token)
+p_get_associativity(LexerToken* token)
 {
-	return p_get_associativity_p (p_get_precedence (token->token_type));
+	return p_get_associativity_p(p_get_precedence(token->token_type));
 }
 
 /* Generate precedence for a node from precedence value. Includes depth_level. */
 static guint
-p_make_precedence_p (ParserState* state, Precedence p)
+p_make_precedence_p(ParserState* state, Precedence p)
 {
 	return (p + (state->depth_level * P_Depth));
 }
 
 /* Generate precedence for a node from lexer token type. Includes depth_level. */
 static guint
-p_make_precedence_t (ParserState* state, LexerTokenType type)
+p_make_precedence_t(ParserState* state, LexerTokenType type)
 {
-	return (p_get_precedence (type) + (state->depth_level * P_Depth));
+	return (p_get_precedence(type) + (state->depth_level * P_Depth));
 }
 
 /* Allocate and create a new node. */
 static ParseNode*
-p_create_node (ParserState* state, LexerToken* token, guint precedence, Associativity associativity, void* value, void* (*function) (ParseNode*))
+p_create_node(ParserState* state, LexerToken* token, guint precedence, Associativity associativity, void* value, void* (*function)(ParseNode*))
 {
 	ParseNode* new;
-	new = (ParseNode*) malloc (sizeof (ParseNode));
-	assert (new != NULL);
+	new = (ParseNode*) malloc(sizeof(ParseNode));
+	assert(new != NULL);
 	new->parent = NULL;
 	new->left = NULL;
 	new->right = NULL;
 
 /* Compares two nodes to decide, which will be parent and which willbe child. */
 static gint
-p_cmp_nodes (ParseNode* left, ParseNode* right)
+p_cmp_nodes(ParseNode* left, ParseNode* right)
 {
 	/* Return values.
 	   1 = right goes up (near root) in parse tree.
 	   0 = left  goes up (near root) in parse tree.
 	*/
-	if (left == NULL)
+	if(left == NULL)
 		return 0;
-	if (left->precedence > right->precedence) {
+	if(left->precedence > right->precedence)
+	{
 		return 1;
 	}
-	else if (left->precedence < right->precedence) {
+	else if(left->precedence < right->precedence)
+	{
 		return 0;
 	}
-	else {
-		if (right->associativity == RIGHT_ASSOCIATIVE) {
+	else
+	{
+		if(right->associativity == RIGHT_ASSOCIATIVE)
+		{
 			return 0;
 		}
-		else {
+		else
+		{
 			return 1;
 		}
 	}
 
 /* Unified interface (unary and binary nodes) to insert node into parse tree. */
 static void
-p_insert_into_tree_all (ParserState* state, ParseNode* node, guint unary_function)
+p_insert_into_tree_all(ParserState* state, ParseNode* node, guint unary_function)
 {
-	if (state->root == NULL) {
+	if(state->root == NULL)
+	{
 		state->root = node;
 		state->right_most = state->root;
 		return;
 	}
 	ParseNode* tmp = state->right_most;
-	while (p_cmp_nodes (tmp, node))
+	while(p_cmp_nodes(tmp, node))
 		tmp = tmp->parent;
-	if (unary_function) {
+	if(unary_function)
+	{
 		/* If tmp is null, that means, we have to insert new node at root. */
-		if (tmp == NULL) {
+		if(tmp == NULL)
+		{
 			node->right = state->root;
 			node->right->parent = node;
 
 			state->root = node;
 		}
-		else {
+		else
+		{
 			node->right = tmp->right;
-			if (node->right)
+			if(node->right)
 				node->right->parent = node;
 
 			tmp->right = node;
-			if (tmp->right)
+			if(tmp->right)
 				tmp->right->parent = tmp;
 
 		}
 		state->right_most = node;
-		while (state->right_most->right != NULL)
+		while(state->right_most->right != NULL)
 			state->right_most = state->right_most->right;
 	}
-	else {
+	else
+	{
 		/* If tmp is null, that means, we have to insert new node at root. */
-		if (tmp == NULL) {
+		if(tmp == NULL)
+		{
 			node->left = state->root;
 			node->left->parent = node;
 
 			state->root = node;
 		}
-		else {
+		else
+		{
 			node->left = tmp->right;
-			if (node->left)
+			if(node->left)
 				node->left->parent = node;
 
 			tmp->right = node;
-			if (tmp->right)
+			if(tmp->right)
 				tmp->right->parent = tmp;
 
 		}
 
 /* Insert binary node into the parse tree. */
 static void
-p_insert_into_tree (ParserState* state, ParseNode* node)
+p_insert_into_tree(ParserState* state, ParseNode* node)
 {
-	p_insert_into_tree_all (state, node, 0);
+	p_insert_into_tree_all(state, node, 0);
 }
 
 /* Insert unary node into the parse tree. */
 static void
-p_insert_into_tree_unary (ParserState* state, ParseNode* node)
+p_insert_into_tree_unary(ParserState* state, ParseNode* node)
 {
-	p_insert_into_tree_all (state, node, 1);
+	p_insert_into_tree_all(state, node, 1);
 }
 
 /* Recursive call to free every node of parse-tree. */
 static void
-p_destroy_all_nodes (ParseNode* node)
+p_destroy_all_nodes(ParseNode* node)
 {
-	if (node == NULL)
+	if(node == NULL)
 		return;
-	p_destroy_all_nodes (node->left);
-	p_destroy_all_nodes (node->right);
+	p_destroy_all_nodes(node->left);
+	p_destroy_all_nodes(node->right);
 	/* Don't call free for tokens, as they are allocated and freed in lexer. */
 	/* WARNING: If node->value is freed elsewhere, please assign it NULL before calling p_destroy_all_nodes(). */
-	if (node->value)
-		free (node->value);
-	free (node);
+	if(node->value)
+		free(node->value);
+	free(node);
 }
 
 /* Create parser state. */
 ParserState*
-p_create_parser (const gchar* input, MPEquationOptions* options)
+p_create_parser(const gchar* input, MPEquationOptions* options)
 {
 	ParserState* state;
-	state = (ParserState*) malloc (sizeof (ParserState));
-	assert (state != NULL);
-	state->lexer = l_create_lexer (input, state);
+	state = (ParserState*) malloc(sizeof(ParserState));
+	assert(state != NULL);
+	state->lexer = l_create_lexer(input, state);
 	state->root = NULL;
 	state->depth_level = 0;
 	state->right_most = NULL;
 	return state;
 }
 
-/* Prints debugging information on terminal to check if parse tree is constructed properly or not. */
-static void
-p_display (ParseNode* node)
-{
-	/* If node is allocated, print it's information. */
-	if (node) {
-		printf("p:%10p l:%10p r:%10p t:%10p p:%2d a:%2d v:%10p e:%10p\n",node->parent, node->left, node->right, node->token, node->precedence, node->associativity, node->value, node->evaluate );
-		/* If node is not leaf node, call p_display() to print both child information. */
-		if (node->left || node->right) {
-			p_display (node->left);
-			p_display (node->right);
-		}
-	}
-	else
-		printf (".\n");
-}
-
 static guint statement (ParserState*);
 /* Start parsing input string. And call evaluate on success. */
 guint
-p_parse (ParserState* state)
+p_parse(ParserState* state)
 {
 	guint ret;
 	LexerToken* token;
 	MPNumber* ans;
-	l_insert_all_tokens (state->lexer);
-	ret = statement (state);
-	token = l_get_next_token (state->lexer);
-	if (token->token_type == T_ASSIGN) {
-		token = l_get_next_token (state->lexer);
-		if (token->token_type != PL_EOS) {
+	l_insert_all_tokens(state->lexer);
+	ret = statement(state);
+	token = l_get_next_token(state->lexer);
+	if(token->token_type == T_ASSIGN)
+	{
+		token = l_get_next_token(state->lexer);
+		if(token->token_type != PL_EOS)
+		{
 		/* Full string is not parsed. */
-			if (!state->error)
-				set_error (state, PARSER_ERR_INVALID, token->string);
+			if(!state->error)
+				set_error(state, PARSER_ERR_INVALID, token->string);
 			return PARSER_ERR_INVALID;
 		}
 	}
-	if (token->token_type != PL_EOS) {
+	if(token->token_type != PL_EOS)
+	{
 		/* Full string is not parsed. */
-		if (!state->error)
-			set_error (state, PARSER_ERR_INVALID, token->string);
+		if(!state->error)
+			set_error(state, PARSER_ERR_INVALID, token->string);
 		return PARSER_ERR_INVALID;
 	}
-	if (ret == 0)
+	if(ret == 0)
 		/* Input can't be parsed with grammar. */
 		return PARSER_ERR_INVALID;
-	ans = (MPNumber *) (*(state->root->evaluate)) (state->root);
-	if (ans) {
-		mp_set_from_mp (ans, &state->ret);
-		free (ans);
+	ans = (MPNumber *) (*(state->root->evaluate))(state->root);
+	if(ans)
+	{
+		mp_set_from_mp(ans, &state->ret);
+		free(ans);
 		return PARSER_ERR_NONE;
 	}
 	return PARSER_ERR_INVALID;
 
 /* Destroy parser state. */
 void
-p_destroy_parser (ParserState* state)
+p_destroy_parser(ParserState* state)
 {
 	/* If state has a parse tree, destroy it first. */
-	if (state->root) {
-		p_destroy_all_nodes (state->root);
+	if(state->root)
+	{
+		p_destroy_all_nodes(state->root);
 	}
-	l_destroy_lexer (state->lexer);
-	free (state);
+	l_destroy_lexer(state->lexer);
+	free(state);
 }
 
 /* LL (*) parser. Lookahead count depends on tokens. Handle with care. :P */
 
-static guint expression (ParserState* state);
-static guint expression_1 (ParserState* state);
-static guint expression_2 (ParserState* state);
-static guint term (ParserState* state);
-static guint unit (ParserState* state);
-static guint variable (ParserState* state);
-static guint term (ParserState* state);
-static guint term_2 (ParserState* state);
+static guint expression(ParserState* state);
+static guint expression_1(ParserState* state);
+static guint expression_2(ParserState* state);
+static guint unit(ParserState* state);
+static guint variable(ParserState* state);
+static guint term(ParserState* state);
+static guint term_2(ParserState* state);
 
 /* Helping function to p_check_variable. */
 static gchar*
-utf8_next_char (const gchar* c)
+utf8_next_char(const gchar* c)
 {
     c++;
-    while ((*c & 0xC0) == 0x80)
+    while((*c & 0xC0) == 0x80)
         c++;
     return (gchar *)c;
 }
 
 /* Check if string "name" is a valid variable for given ParserState. It is the same code, used to get the value of variable in parserfunc.c. */
 static gint
-p_check_variable (ParserState* state, gchar* name)
+p_check_variable(ParserState* state, gchar* name)
 {
 	gint result = 0;
 
 	gchar *buffer;
 	MPNumber temp;
 
-	if (!(state->get_variable)) {
+	if(!(state->get_variable))
+	{
 		return 0;
 	}
 
 	/* If defined, then get the variable */
-	if ((*(state->get_variable)) (state, name, &temp)) {
+	if((*(state->get_variable))(state, name, &temp))
+	{
 		return 1;
 	}
 
 	/* If has more than one character then assume a multiplication of variables */
-	if (utf8_next_char (name)[0] != '\0') {
+	if(utf8_next_char(name)[0] != '\0')
+	{
 		result = 1;
-		buffer = (gchar*) malloc (sizeof (gchar) * strlen (name));
-		for (c = name; *c != '\0'; c = next) {
+		buffer = (gchar*) malloc(sizeof(gchar) * strlen(name));
+		for(c = name; *c != '\0'; c = next)
+		{
 			next = utf8_next_char(c);
 			snprintf(buffer, next - c + 1, "%s", c);
-			if (!(*(state->get_variable)) (state, buffer, &temp)) {
+			if(!(*(state->get_variable))(state, buffer, &temp))
+			{
 				result = 0;
 				break;
 			}
 		}
 		free(buffer);
 	}
-	if (!result) {
+	if(!result)
+	{
 		return 0;
 	}
 	return 1;
 }
 
 static guint
-statement (ParserState* state)
+statement(ParserState* state)
 {
 	LexerToken* token;
 	LexerToken* token_old;
 	ParseNode* node;
-	token = l_get_next_token (state->lexer);
-	if (token->token_type == T_VARIABLE) {
+	token = l_get_next_token(state->lexer);
+	if(token->token_type == T_VARIABLE)
+	{
 		token_old = token;
-		token = l_get_next_token (state->lexer);
-		if (token->token_type == T_ASSIGN) {
+		token = l_get_next_token(state->lexer);
+		if(token->token_type == T_ASSIGN)
+		{
 			/* VARIABLE = expression. */
-			node = p_create_node (state, token_old, p_make_precedence_p (state, P_NumberVariable), p_get_associativity (token_old), NULL, pf_none);
-			p_insert_into_tree (state, node);
 
-			node = p_create_node (state, token, 0, p_get_associativity (token), NULL, pf_set_var);
-			p_insert_into_tree (state, node);
+			node = p_create_node(state, token_old, p_make_precedence_p(state, P_NumberVariable), p_get_associativity(token_old), NULL, pf_none);
+			p_insert_into_tree(state, node);
+
+			node = p_create_node(state, token, 0, p_get_associativity(token), NULL, pf_set_var);
+			p_insert_into_tree(state, node);
 
-			if (!expression (state))
+			if(!expression(state))
 				return 0;
 			return 1;
 		}
-		else if (token->token_type == T_IN) {
+		else if(token->token_type == T_IN)
+		{
 			/* UNIT in UNIT. */
-			l_roll_back (state->lexer);
-			l_roll_back (state->lexer);
-			if (!unit (state))
+			l_roll_back(state->lexer);
+			l_roll_back(state->lexer);
+			if(!unit(state))
 				return 0;
-			l_get_next_token (state->lexer);
+			l_get_next_token(state->lexer);
 
-			node = p_create_node (state, token, 0, p_get_associativity (token), NULL, pf_convert_1);
-			p_insert_into_tree (state, node);
+			node = p_create_node(state, token, 0, p_get_associativity(token), NULL, pf_convert_1);
+			p_insert_into_tree(state, node);
 
-			if (!unit (state))
+			if(!unit(state))
 				return 0;
 			return 1;
 		}
-		else if (token->token_type == T_SUP_NUMBER) {
-			token = l_get_next_token (state->lexer);
-			if (token->token_type == T_IN) {
+		else if(token->token_type == T_SUP_NUMBER)
+		{
+			token = l_get_next_token(state->lexer);
+			if(token->token_type == T_IN)
+			{
 				/* UNIT in UNIT */
-				l_roll_back (state->lexer);
-				l_roll_back (state->lexer);
-				l_roll_back (state->lexer);
-				if (!unit (state))
+				l_roll_back(state->lexer);
+				l_roll_back(state->lexer);
+				l_roll_back(state->lexer);
+				if(!unit(state))
 					return 0;
-				l_get_next_token (state->lexer);
+				l_get_next_token(state->lexer);
 
-				node = p_create_node (state, token, 0, p_get_associativity (token), NULL, pf_convert_1);
-				p_insert_into_tree (state, node);
+				node = p_create_node(state, token, 0, p_get_associativity(token), NULL, pf_convert_1);
+				p_insert_into_tree(state, node);
 
-				if (!unit (state))
+				if(!unit(state))
 					return 0;
 				return 1;
 			}
-			else {
-				l_roll_back (state->lexer);
-				l_roll_back (state->lexer);
-				l_roll_back (state->lexer);
-				if (!expression (state))
+			else
+			{
+				l_roll_back(state->lexer);
+				l_roll_back(state->lexer);
+				l_roll_back(state->lexer);
+				if(!expression(state))
 					return 0;
 				return 1;
 			}
 		}
-		else {
-			l_roll_back (state->lexer);
-			l_roll_back (state->lexer);
-			if (!expression (state))
+		else
+		{
+			l_roll_back(state->lexer);
+			l_roll_back(state->lexer);
+			if(!expression(state))
 				return 0;
 			return 1;
 		}
 	}
-	else if (token->token_type == T_NUMBER) {
+	else if(token->token_type == T_NUMBER)
+	{
 		token_old = token;
-		token = l_get_next_token (state->lexer);
-		if (token->token_type == T_VARIABLE) {
-			token = l_get_next_token (state->lexer);
-			if (token->token_type == T_IN) {
+		token = l_get_next_token(state->lexer);
+		if(token->token_type == T_VARIABLE)
+		{
+			token = l_get_next_token(state->lexer);
+			if(token->token_type == T_IN)
+			{
 				/* NUMBER UNIT in UNIT */
-				l_roll_back (state->lexer);
-				l_roll_back (state->lexer);
+				l_roll_back(state->lexer);
+				l_roll_back(state->lexer);
 
-				node = p_create_node (state, token_old, p_make_precedence_t (state, token_old->token_type), p_get_associativity (token), NULL, pf_constant);
-				p_insert_into_tree (state, node);
+				node = p_create_node(state, token_old, p_make_precedence_t(state, token_old->token_type), p_get_associativity(token), NULL, pf_constant);
+				p_insert_into_tree(state, node);
 
-				if (!unit (state))
+				if(!unit(state))
 					return 0;
-				token = l_get_next_token (state->lexer);
+				token = l_get_next_token(state->lexer);
 
-				node = p_create_node (state, token, 0, p_get_associativity (token), NULL, pf_convert_number);
-				p_insert_into_tree (state, node);
+				node = p_create_node(state, token, 0, p_get_associativity(token), NULL, pf_convert_number);
+				p_insert_into_tree(state, node);
 
-				if (!unit (state))
+				if(!unit(state))
 					return 0;
 				return 1;
 			}
-			else if (token->token_type == T_SUP_NUMBER) {
-				token = l_get_next_token (state->lexer);
-				if (token->token_type == T_IN) {
+			else if(token->token_type == T_SUP_NUMBER)
+			{
+				token = l_get_next_token(state->lexer);
+				if(token->token_type == T_IN)
+				{
 					/* NUMBER UNIT in UNIT */
-					l_roll_back (state->lexer);
-					l_roll_back (state->lexer);
-					l_roll_back (state->lexer);
+					l_roll_back(state->lexer);
+					l_roll_back(state->lexer);
+					l_roll_back(state->lexer);
 
-					node = p_create_node (state, token_old, p_make_precedence_t (state, token_old->token_type), p_get_associativity (token), NULL, pf_constant);
-					p_insert_into_tree (state, node);
+					node = p_create_node(state, token_old, p_make_precedence_t(state, token_old->token_type), p_get_associativity(token), NULL, pf_constant);
+					p_insert_into_tree(state, node);
 
-					if (!unit (state))
+					if(!unit(state))
 						return 0;
-					token = l_get_next_token (state->lexer);
+					token = l_get_next_token(state->lexer);
 
-					node = p_create_node (state, token, 0, p_get_associativity (token), NULL, pf_convert_number);
-					p_insert_into_tree (state, node);
+					node = p_create_node(state, token, 0, p_get_associativity(token), NULL, pf_convert_number);
+					p_insert_into_tree(state, node);
 
-					if (!unit (state))
+					if(!unit(state))
 						return 0;
 					return 1;
 				}
-				else {
-					l_roll_back (state->lexer);
-					l_roll_back (state->lexer);
-					l_roll_back (state->lexer);
-					l_roll_back (state->lexer);
-					if (!expression (state))
+				else
+				{
+					l_roll_back(state->lexer);
+					l_roll_back(state->lexer);
+					l_roll_back(state->lexer);
+					l_roll_back(state->lexer);
+					if(!expression(state))
 						return 0;
 					return 1;
 				}
 			}
-			else {
-				l_roll_back (state->lexer);
-				l_roll_back (state->lexer);
-				l_roll_back (state->lexer);
-				if (!expression (state))
+			else
+			{
+				l_roll_back(state->lexer);
+				l_roll_back(state->lexer);
+				l_roll_back(state->lexer);
+				if(!expression(state))
 					return 0;
 				return 1;
 			}
 		}
-		else {
-			l_roll_back (state->lexer);
-			l_roll_back (state->lexer);
-			if (!expression (state))
+		else
+		{
+			l_roll_back(state->lexer);
+			l_roll_back(state->lexer);
+			if(!expression(state))
 				return 0;
 			return 1;
 		}
 	}
-	else {
-		l_roll_back (state->lexer);
-		if (!expression (state))
+	else
+	{
+		l_roll_back(state->lexer);
+		if(!expression(state))
 			return 0;
 		return 1;
 	}
 }
 
 static guint
-unit (ParserState* state)
+unit(ParserState* state)
 {
 	LexerToken* token;
 	LexerToken* token_old;
 	ParseNode* node;
-	token = l_get_next_token (state->lexer);
-	if (token->token_type == T_VARIABLE) {
+	token = l_get_next_token(state->lexer);
+	if(token->token_type == T_VARIABLE)
+	{
 		token_old = token;
-		token = l_get_next_token (state->lexer);
-		if (token->token_type == T_SUP_NUMBER) {
+		token = l_get_next_token(state->lexer);
+		if(token->token_type == T_SUP_NUMBER)
+		{
 			/* VARIABLE POWER */
 
-			node = p_create_node (state, token_old, p_make_precedence_t (state, token_old->token_type), p_get_associativity (token_old), pf_make_unit (token_old->string, token->string), pf_none);
-			p_insert_into_tree (state, node);
+			node = p_create_node(state, token_old, p_make_precedence_t(state, token_old->token_type), p_get_associativity(token_old), pf_make_unit(token_old->string, token->string), pf_none);
+			p_insert_into_tree(state, node);
 
 			return 1;
 		}
-		else {
-			l_roll_back (state->lexer);
+		else
+		{
+			l_roll_back(state->lexer);
 			/* VARIABLE */
 
-			node = p_create_node (state, token_old, p_make_precedence_t (state, token_old->token_type), p_get_associativity (token_old), NULL, pf_none);
-			p_insert_into_tree (state, node);
+			node = p_create_node(state, token_old, p_make_precedence_t(state, token_old->token_type), p_get_associativity(token_old), NULL, pf_none);
+			p_insert_into_tree(state, node);
 
 			return 1;
 		}
 	}
-	else {
-		l_roll_back (state->lexer);
-		//TODO: ERROR
+	else
+	{
+		l_roll_back(state->lexer);
 		return 0;
 	}
 }
 
 static guint
-expression (ParserState* state)
+expression(ParserState* state)
 {
-	if (!expression_1 (state))
+	if(!expression_1(state))
 		return 0;
-	if (!expression_2 (state))
+	if(!expression_2(state))
 		return 0;
 	return 1;
 }
 
 static guint
-expression_1 (ParserState* state)
+expression_1(ParserState* state)
 {
 	LexerToken* token;
 	ParseNode* node;
-	token = l_get_next_token (state->lexer);
-	if (token->token_type == PL_EOS
-	 || token->token_type == T_ASSIGN) {
-		l_roll_back (state->lexer);
+	token = l_get_next_token(state->lexer);
+	if(token->token_type == PL_EOS
+	 ||token->token_type == T_ASSIGN)
+	{
+		l_roll_back(state->lexer);
 		return 0;
 	}
-	if (token->token_type == T_L_R_BRACKET) {
+	if(token->token_type == T_L_R_BRACKET)
+	{
 		state->depth_level++;
-		if (!expression (state))
+		if(!expression(state))
 			return 0;
-		token = l_get_next_token (state->lexer);
-		if (token->token_type == T_R_R_BRACKET) {
+		token = l_get_next_token(state->lexer);
+		if(token->token_type == T_R_R_BRACKET)
+		{
 			state->depth_level--;
 			return 1;
 		}
 		//Expected ")" here...
 			return 0;
 	}
-	else if (token->token_type == T_L_S_BRACKET) {
+	else if(token->token_type == T_L_S_BRACKET)
+	{
 		state->depth_level++;
 
 		/* Give round, preference of P_Unknown aka 0, to keep it on the top of expression. */
-		node = p_create_node (state, token, p_make_precedence_p (state, P_Unknown), p_get_associativity (token), NULL, pf_do_round);
-		p_insert_into_tree_unary (state, node);
 
-		if (!expression (state))
+		node = p_create_node(state, token, p_make_precedence_p(state, P_Unknown), p_get_associativity(token), NULL, pf_do_round);
+		p_insert_into_tree_unary(state, node);
+
+		if(!expression(state))
 			return 0;
-		token = l_get_next_token (state->lexer);
-		if (token->token_type == T_R_S_BRACKET) {
+		token = l_get_next_token(state->lexer);
+		if(token->token_type == T_R_S_BRACKET)
+		{
 			state->depth_level--;
 			return 1;
 		}
 		//Expected "]" here...
 			return 0;
 	}
-	else if (token->token_type == T_L_C_BRACKET) {
+	else if(token->token_type == T_L_C_BRACKET)
+	{
 		state->depth_level++;
 
 		/* Give fraction, preference of P_Unknown aka 0, to keep it on the top of expression. */
-		node = p_create_node (state, token, p_make_precedence_p (state, P_Unknown), p_get_associativity (token), NULL, pf_do_fraction);
-		p_insert_into_tree_unary (state, node);
 
-		if (!expression (state))
+		node = p_create_node(state, token, p_make_precedence_p(state, P_Unknown), p_get_associativity(token), NULL, pf_do_fraction);
+		p_insert_into_tree_unary(state, node);
+
+		if(!expression(state))
 			return 0;
-		token = l_get_next_token (state->lexer);
-		if (token->token_type == T_R_C_BRACKET) {
+		token = l_get_next_token(state->lexer);
+		if(token->token_type == T_R_C_BRACKET)
+		{
 			state->depth_level--;
 			return 1;
 		}
 		//Expected "}" here...
 			return 0;
 	}
-	else if (token->token_type == T_ABS) {
+	else if(token->token_type == T_ABS)
+	{
 		state->depth_level++;
 
 		/* Give abs, preference of P_Unknown aka 0, to keep it on the top of expression. */
-		node = p_create_node (state, token, p_make_precedence_p (state, P_Unknown), p_get_associativity (token), NULL, pf_do_abs);
-		p_insert_into_tree_unary (state, node);
 
-		if (!expression (state))
+		node = p_create_node(state, token, p_make_precedence_p(state, P_Unknown), p_get_associativity(token), NULL, pf_do_abs);
+		p_insert_into_tree_unary(state, node);
+
+		if(!expression(state))
 			return 0;
-		token = l_get_next_token (state->lexer);
-		if (token->token_type == T_ABS) {
+		token = l_get_next_token(state->lexer);
+		if(token->token_type == T_ABS)
+		{
 			state->depth_level--;
 			return 1;
 		}
 		//Expected "|" here...
 			return 0;
 	}
-	else if (token->token_type == T_NOT) {
-
+	else if(token->token_type == T_NOT)
+	{
 		/* NOT expression */
-		node = p_create_node (state, token, p_make_precedence_p (state, P_Not), p_get_associativity (token), NULL, pf_do_not);
-		p_insert_into_tree_unary (state, node);
 
-		if (!expression (state))
+		node = p_create_node(state, token, p_make_precedence_p(state, P_Not), p_get_associativity(token), NULL, pf_do_not);
+		p_insert_into_tree_unary(state, node);
+
+		if(!expression(state))
 			return 0;
 		return 1;
 	}
-	else if (token->token_type == T_NUMBER) {
+	else if(token->token_type == T_NUMBER)
+	{
 		/* NUMBER */
-		node = p_create_node (state, token, p_make_precedence_t (state, token->token_type), p_get_associativity (token), NULL, pf_constant);
-		p_insert_into_tree (state, node);
 
-		token = l_get_next_token (state->lexer);
-		l_roll_back (state->lexer);
+		node = p_create_node(state, token, p_make_precedence_t(state, token->token_type), p_get_associativity(token), NULL, pf_constant);
+		p_insert_into_tree(state, node);
 
-		if (token->token_type == T_FUNCTION
-		 || token->token_type == T_VARIABLE
-		 || token->token_type == T_SUB_NUMBER
-		 || token->token_type == T_ROOT
-		 || token->token_type == T_ROOT_3
-		 || token->token_type == T_ROOT_4) {
+		token = l_get_next_token(state->lexer);
+		l_roll_back(state->lexer);
 
+		if(token->token_type == T_FUNCTION
+		 ||token->token_type == T_VARIABLE
+		 ||token->token_type == T_SUB_NUMBER
+		 ||token->token_type == T_ROOT
+		 ||token->token_type == T_ROOT_3
+		 ||token->token_type == T_ROOT_4)
+		{
 			/* NUMBER variable. */
-			node = p_create_node (state, NULL, p_make_precedence_p (state, P_Multiply), p_get_associativity_p (P_Multiply), NULL, pf_do_multiply);
-			p_insert_into_tree (state, node);
 
-			if (!variable (state))
+			node = p_create_node(state, NULL, p_make_precedence_p(state, P_Multiply), p_get_associativity_p(P_Multiply), NULL, pf_do_multiply);
+			p_insert_into_tree(state, node);
+
+			if(!variable(state))
 				return 0;
 			else
 				return 1;
 		}
-		else {
+		else
+		{
 			return 1;
 		}
 	}
-	else if (token->token_type == T_L_FLOOR) {
+	else if(token->token_type == T_L_FLOOR)
+	{
 		state->depth_level++;
-
 		/* Give floor, preference of P_Unknown aka 0, to keep it on the top of expression. */
-		node = p_create_node (state, NULL, p_make_precedence_p (state, P_Unknown), p_get_associativity_p (P_Unknown), NULL, pf_do_floor);
-		p_insert_into_tree_unary (state, node);
 
-		if (!expression (state))
+		node = p_create_node(state, NULL, p_make_precedence_p(state, P_Unknown), p_get_associativity_p(P_Unknown), NULL, pf_do_floor);
+		p_insert_into_tree_unary(state, node);
+
+		if(!expression(state))
 			return 0;
-		token = l_get_next_token (state->lexer);
-		if (token->token_type == T_R_FLOOR) {
+		token = l_get_next_token(state->lexer);
+		if(token->token_type == T_R_FLOOR)
+		{
 			state->depth_level--;
 			return 1;
 		}
 		//Expected ⌋ here...
 			return 0;
 	}
-	else if (token->token_type == T_L_CEILING) {
+	else if(token->token_type == T_L_CEILING)
+	{
 		state->depth_level++;
-
 		/* Give ceiling, preference of P_Unknown aka 0, to keep it on the top of expression. */
-		node = p_create_node (state, NULL, p_make_precedence_p (state, P_Unknown), p_get_associativity_p (P_Unknown), NULL, pf_do_ceiling);
-		p_insert_into_tree_unary (state, node);
 
-		if (!expression (state))
+		node = p_create_node(state, NULL, p_make_precedence_p(state, P_Unknown), p_get_associativity_p(P_Unknown), NULL, pf_do_ceiling);
+		p_insert_into_tree_unary(state, node);
+
+		if(!expression(state))
 			return 0;
-		token = l_get_next_token (state->lexer);
-		if (token->token_type == T_R_CEILING) {
+		token = l_get_next_token(state->lexer);
+		if(token->token_type == T_R_CEILING)
+		{
 			state->depth_level--;
 			return 1;
 		}
 		//Expected ⌉ here...
 			return 0;
 	}
-	else if (token->token_type == T_SUBTRACT) {
+	else if(token->token_type == T_SUBTRACT)
+	{
 		/* UnaryMinus expression */
 
-		node = p_create_node (state, token, p_make_precedence_p (state, P_UnaryMinus), p_get_associativity_p (P_UnaryMinus), NULL, pf_unary_minus);
-		p_insert_into_tree_unary (state, node);
+		node = p_create_node(state, token, p_make_precedence_p(state, P_UnaryMinus), p_get_associativity_p(P_UnaryMinus), NULL, pf_unary_minus);
+		p_insert_into_tree_unary(state, node);
 
-		if (!expression_1 (state))
+		if(!expression_1(state))
 			return 0;
 		return 1;
 	}
-	else if (token->token_type == T_ADD) {
-		token = l_get_next_token (state->lexer);
-		if (token->token_type == T_NUMBER) {
+	else if(token->token_type == T_ADD)
+	{
+		token = l_get_next_token(state->lexer);
+		if(token->token_type == T_NUMBER)
+		{
 			/* UnaryPlus expression */
 			/* Ignore T_ADD. It is not required. */
 
-			node = p_create_node (state, token, p_make_precedence_t (state, token->token_type), p_get_associativity (token), NULL, pf_constant);
-			p_insert_into_tree (state, node);
+			node = p_create_node(state, token, p_make_precedence_t(state, token->token_type), p_get_associativity(token), NULL, pf_constant);
+			p_insert_into_tree(state, node);
 			return 1;
 		}
-		else {
-		//TODO: ERROR..
+		else
+		{
 			return 0;
 		}
 	}
-	else {
-		l_roll_back (state->lexer);
-		if (!variable (state))
+	else
+	{
+		l_roll_back(state->lexer);
+		if(!variable(state))
 			return 0;
 		else
 			return 1;
 }
 
 static guint
-expression_2 (ParserState* state)
+expression_2(ParserState* state)
 {
 	LexerToken* token;
 	ParseNode* node;
-	token = l_get_next_token (state->lexer);
-	if (token->token_type == T_L_R_BRACKET) {
-
+	token = l_get_next_token(state->lexer);
+	if(token->token_type == T_L_R_BRACKET)
+	{
 		/* expression "(" expression ")" */
-		node = p_create_node (state, NULL, p_make_precedence_p (state, P_Multiply), p_get_associativity_p (P_Multiply), NULL, pf_do_multiply);
-		p_insert_into_tree (state, node);
+
+		node = p_create_node(state, NULL, p_make_precedence_p(state, P_Multiply), p_get_associativity_p(P_Multiply), NULL, pf_do_multiply);
+		p_insert_into_tree(state, node);
 
 		state->depth_level++;
-		if (!expression (state))
+		if(!expression(state))
 			return 0;
-		token = l_get_next_token (state->lexer);
-		if (token->token_type == T_R_R_BRACKET) {
+		token = l_get_next_token(state->lexer);
+		if(token->token_type == T_R_R_BRACKET)
+		{
 			state->depth_level--;
-			if (!expression_2 (state))
+			if(!expression_2(state))
 				return 0;
 			return 1;
 		}
-		else {
+		else
+		{
 			return 0;
 		}
 	}
-	else if (token->token_type == T_POWER) {
-
+	else if(token->token_type == T_POWER)
+	{
 		/* expression "^" expression */
-		node = p_create_node (state, token, p_make_precedence_t (state, token->token_type), p_get_associativity (token), NULL, pf_do_x_pow_y);
-		p_insert_into_tree (state, node);
 
-		if (!expression_1 (state))
+		node = p_create_node(state, token, p_make_precedence_t(state, token->token_type), p_get_associativity(token), NULL, pf_do_x_pow_y);
+		p_insert_into_tree(state, node);
+
+		if(!expression_1(state))
 			return 0;
-		if (!expression_2 (state))
+		if(!expression_2(state))
 			return 0;
 		return 1;
 		
 	}
-	else if (token->token_type == T_SUP_NUMBER) {
-
+	else if(token->token_type == T_SUP_NUMBER)
+	{
 		/* expression T_SUP_NUMBER */
-		node = p_create_node (state, NULL, p_make_precedence_p (state, P_Power), p_get_associativity_p (P_Power), NULL, pf_do_x_pow_y_int);
-		p_insert_into_tree (state, node);
 
-		node = p_create_node (state, token, p_make_precedence_p (state, P_NumberVariable), p_get_associativity_p (P_NumberVariable), NULL, pf_none);
-		p_insert_into_tree (state, node);
+		node = p_create_node(state, NULL, p_make_precedence_p(state, P_Power), p_get_associativity_p(P_Power), NULL, pf_do_x_pow_y_int);
+		p_insert_into_tree(state, node);
+
+		node = p_create_node(state, token, p_make_precedence_p(state, P_NumberVariable), p_get_associativity_p(P_NumberVariable), NULL, pf_none);
+		p_insert_into_tree(state, node);
 
-		if (!expression_2 (state))
+		if(!expression_2(state))
 			return 0;
 		return 1;	
 	}
-	else if (token->token_type == T_NSUP_NUMBER) {
-
+	else if(token->token_type == T_NSUP_NUMBER)
+	{
 		/* expression T_NSUP_NUMBER */
-		node = p_create_node (state, NULL, p_make_precedence_p (state, P_Power), p_get_associativity_p (P_Power), NULL, pf_do_x_pow_y_int);
-		p_insert_into_tree (state, node);
 
-		node = p_create_node (state, token, p_make_precedence_p (state, P_NumberVariable), p_get_associativity_p (P_NumberVariable), NULL, pf_none);
-		p_insert_into_tree (state, node);
+		node = p_create_node(state, NULL, p_make_precedence_p(state, P_Power), p_get_associativity_p(P_Power), NULL, pf_do_x_pow_y_int);
+		p_insert_into_tree(state, node);
+
+		node = p_create_node(state, token, p_make_precedence_p(state, P_NumberVariable), p_get_associativity_p(P_NumberVariable), NULL, pf_none);
+		p_insert_into_tree(state, node);
 
-		if (!expression_2 (state))
+		if(!expression_2(state))
 			return 0;
 		return 1;
 	}
-	else if (token->token_type == T_FACTORIAL) {
-
+	else if(token->token_type == T_FACTORIAL)
+	{
 		/* expression T_FACTORIAL */
-		node = p_create_node (state, token, p_make_precedence_t (state, token->token_type), p_get_associativity (token), NULL, pf_do_factorial);
-		p_insert_into_tree_unary (state, node);
 
-		if (!expression_2 (state))
+		node = p_create_node(state, token, p_make_precedence_t(state, token->token_type), p_get_associativity(token), NULL, pf_do_factorial);
+		p_insert_into_tree_unary(state, node);
+
+		if(!expression_2(state))
 			return 0;
 		return 1;	
 	}
-	else if (token->token_type == T_MULTIPLY) {
-
+	else if(token->token_type == T_MULTIPLY)
+	{
 		/* expression T_MULTIPLY expression */
-		node = p_create_node (state, token, p_make_precedence_t (state, token->token_type), p_get_associativity (token), NULL, pf_do_multiply);
-		p_insert_into_tree (state, node);
 
-		if (!expression_1 (state))
+		node = p_create_node(state, token, p_make_precedence_t(state, token->token_type), p_get_associativity(token), NULL, pf_do_multiply);
+		p_insert_into_tree(state, node);
+
+		if(!expression_1(state))
 			return 0;
-		if (!expression_2 (state))
+		if(!expression_2(state))
 			return 0;
 		return 1;
 	}
-	else if (token->token_type == T_PERCENTAGE) {
-
+	else if(token->token_type == T_PERCENTAGE)
+	{
 		/* expression % */
-		node = p_create_node (state, token, p_make_precedence_t (state, token->token_type), p_get_associativity (token), NULL, pf_do_percent);
-		p_insert_into_tree_unary (state, node);
 
-		if (!expression_2 (state))
+		node = p_create_node(state, token, p_make_precedence_t(state, token->token_type), p_get_associativity(token), NULL, pf_do_percent);
+		p_insert_into_tree_unary(state, node);
+
+		if(!expression_2(state))
 			return 0;
 		return 1;
 	}
-	else if (token->token_type == T_AND) {
-
+	else if(token->token_type == T_AND)
+	{
 		/* expression T_AND expression */
-		node = p_create_node (state, token, p_make_precedence_t (state, token->token_type), p_get_associativity (token), NULL, pf_do_and);
-		p_insert_into_tree (state, node);
 
-		if (!expression_1 (state))
+		node = p_create_node(state, token, p_make_precedence_t(state, token->token_type), p_get_associativity(token), NULL, pf_do_and);
+		p_insert_into_tree(state, node);
+
+		if(!expression_1(state))
 			return 0;
-		if (!expression_2 (state))
+		if(!expression_2(state))
 			return 0;
 		return 1;
 	}
-	else if (token->token_type == T_OR) {
-
+	else if(token->token_type == T_OR)
+	{
 		/* expression T_OR expression */
-		node = p_create_node (state, token, p_make_precedence_t (state, token->token_type), p_get_associativity (token), NULL, pf_do_or);
-		p_insert_into_tree (state, node);
 
-		if (!expression_1 (state))
+		node = p_create_node(state, token, p_make_precedence_t(state, token->token_type), p_get_associativity(token), NULL, pf_do_or);
+		p_insert_into_tree(state, node);
+
+		if(!expression_1(state))
 			return 0;
-		if (!expression_2 (state))
+		if(!expression_2(state))
 			return 0;
 		return 1;
 	}
-	else if (token->token_type == T_XOR) {
-
+	else if(token->token_type == T_XOR)
+	{
 		/* expression T_XOR expression */
-		node = p_create_node (state, token, p_make_precedence_t (state, token->token_type), p_get_associativity (token), NULL, pf_do_xor);
-		p_insert_into_tree (state, node);
 
-		if (!expression_1 (state))
+		node = p_create_node(state, token, p_make_precedence_t(state, token->token_type), p_get_associativity(token), NULL, pf_do_xor);
+		p_insert_into_tree(state, node);
+
+		if(!expression_1(state))
 			return 0;
-		if (!expression_2 (state))
+		if(!expression_2(state))
 			return 0;
 		return 1;
 	}
-	else if (token->token_type == T_DIVIDE) {
-
+	else if(token->token_type == T_DIVIDE)
+	{
 		/* expression T_DIVIDE expression */
-		node = p_create_node (state, token, p_make_precedence_t (state, token->token_type), p_get_associativity (token), NULL, pf_do_divide);
-		p_insert_into_tree (state, node);
 
-		if (!expression_1 (state))
+		node = p_create_node(state, token, p_make_precedence_t(state, token->token_type), p_get_associativity(token), NULL, pf_do_divide);
+		p_insert_into_tree(state, node);
+
+		if(!expression_1(state))
 			return 0;
-		if (!expression_2 (state))
+		if(!expression_2(state))
 			return 0;
 		return 1;
 	}
-	else if (token->token_type == T_MOD) {
-
+	else if(token->token_type == T_MOD)
+	{
 		/* expression T_MOD expression */
-		node = p_create_node (state, token, p_make_precedence_t (state, token->token_type), p_get_associativity (token), NULL, pf_do_mod);
-		p_insert_into_tree (state, node);