@@ -0,0 +1,1936 @@
+package infrastructure;%0D%0A%0D%0Aimport infrastructure.json.JsonElement;%0D%0Aimport infrastructure.json.JsonStructure;%0D%0Aimport java.util.LinkedList;%0D%0Aimport java.util.List;%0D%0A%0D%0A/**%0D%0A *%0D%0A * @author Lucas%0D%0A */%0D%0Apublic class SemanticListener %7B%0D%0A    %0D%0A    protected JsonStructure root;%0D%0A    protected List%3CString%3E  errors;%0D%0A    protected boolean       validate;%0D%0A%0D%0A    public SemanticListener(JsonStructure _root) %7B%0D%0A        root     = _root;%0D%0A        errors   = new LinkedList%3C%3E();%0D%0A        validate = false;%0D%0A    %7D%0D%0A%0D%0A    public boolean isValid() %7B%0D%0A        Validate();%0D%0A        return errors.isEmpty();%0D%0A    %7D%0D%0A    %0D%0A    public LinkedList%3CString%3E Validate() %7B%0D%0A        if (!validate) %7B%0D%0A            validate = true;%0D%0A        %0D%0A            // does validation over root%0D%0A            RuleOnlyOneField();%0D%0A        %7D%0D%0A        %0D%0A        return new LinkedList%3C%3E(errors);%0D%0A    %7D%0D%0A%0D%0A    %0D%0A    protected boolean RuleOnlyOneField() %7B%0D%0A        return RuleOnlyOneField(root);%0D%0A    %7D%0D%0A    %0D%0A    protected boolean RuleOnlyOneField(JsonStructure node) %7B%0D%0A%0D%0A        boolean hasErrors = false;%0D%0A        List%3CJsonElement%3E innerElements = new LinkedList%3C%3E(node.values);%0D%0A        %0D%0A        while(!innerElements.isEmpty()) %7B%0D%0A            JsonElement pivot = innerElements.get(0);%0D%0A            %0D%0A            int i = 1;%0D%0A            while (i %3C innerElements.size()) %7B%0D%0A                JsonElement current = innerElements.get(i);%0D%0A                %0D%0A                if (pivot.name.toLowerCase().equals(current.name.toLowerCase())) %7B%0D%0A                    hasErrors = true;%0D%0A                    errors.add(%22Semantic error: redeclaration of field %5C%22%22 + pivot.name + %22%5C%22.%22);%0D%0A                    innerElements.remove(i);%0D%0A                %7D else %7B%0D%0A                    i++;%0D%0A                %7D%0D%0A            %7D%0D%0A        %7D%0D%0A%0D%0A        return !hasErrors;%0D%0A    %7D%0D%0A    %0D%0A    protected boolean RuleProductsPricesAndTaxesMatchTotal(JsonStructure node) %7B%0D%0A        return false;%0D%0A    %7D%0D%0A%7D%0D%0A

Add SemanticListener class