private void build(Syntax lexerSyntax)
		throws LexerException, SyntaxException
	{
		SyntaxSeparation.IntArray deleteIndexes = new SyntaxSeparation.IntArray(lexerSyntax.size());
		if (DEBUG)
			System.err.println("Processing lexer rules: \n"+lexerSyntax);

		// resolve scanner rules to Consumers and put it into a hashtable
		this.charConsumers = new Hashtable(lexerSyntax.size());
		for (int i = 0; i < lexerSyntax.size(); i++)
			translateLexerRule(lexerSyntax.getRule(i), i, deleteIndexes);
		deleteIndexes.removeIndexesFrom(lexerSyntax);
		
		// check for unresolved repeatable and nullable rules and delete them from lexer syntax
		for (int i = 0; i < lexerSyntax.size(); i++)	{
			Rule rule = lexerSyntax.getRule(i);
			String nonterm = rule.getNonterminal();
			if (checkNullableRule(nonterm, rule, i, deleteIndexes) == false)
				if (checkRepeatableRule(nonterm, rule, i, deleteIndexes) == false)
					throw new LexerException("Found no character consumer for nullable or repeatable rule "+rule);
		}
		deleteIndexes.removeIndexesFrom(lexerSyntax);
		
		if (lexerSyntax.size() > 0)	{	// not all rules have been resolved to character consumers
			throw new LexerException("Could not process rules in lexer syntax: "+lexerSyntax);
		}

		// resolve all symbolic consumer references after all consumers have been created
		Map done = new Hashtable();	// beware of recursion
		for (Iterator it = charConsumers.entrySet().iterator(); it.hasNext(); )	{
			Consumer cc = (Consumer) ((Map.Entry)it.next()).getValue();
			cc.resolveConsumerReferences(charConsumers, done);
		}
	}