public static ProgramObject parseRightXor(ProgramObject s1, ProgramObject s2, ProgramObject leftExpression) { var left = (Symbole)s1; var right = (Symbole)s2; left.addRelation(new RightXor(right, leftExpression)); right.addRelation(new RightXor(left, leftExpression)); return(null); }
public LeftAnd(ProgramObject s1, ProgramObject s2) { this.s1 = s1; this.s2 = s2; this.type = ProgramObjectType.Relation; }
private void parseRightExpression(ProgramObject leftExpression) { bool not = false; if (currentToken.tokenType == TokenType.Not) { not = true; currentToken = lexer.nextToken(); } if (currentToken.tokenType == TokenType.Symbol) { var s1 = core.getSymbole(currentToken.value) ?? new Symbole(currentToken.value); currentToken = lexer.nextToken(); if (currentToken.tokenType == TokenType.Eol) { if (not) { s1.addRelation(new RightInvert(leftExpression)); } else { s1.addRelation(new RightNormal(leftExpression)); } } else if (currentToken.tokenType == TokenType.And) { currentToken = lexer.nextToken(); if (currentToken.tokenType == TokenType.Symbol) { var s2 = core.getSymbole(currentToken.value) ?? new Symbole(currentToken.value); currentToken = lexer.nextToken(); s2.addRelation(new RightAnd(s1, leftExpression)); s1.addRelation(new RightAnd(s2, leftExpression)); } else { throw new UnexpectedTokenException(currentToken.value); } } else if (currentToken.tokenType == TokenType.Or) { currentToken = lexer.nextToken(); if (currentToken.tokenType == TokenType.Symbol) { var s2 = core.getSymbole(currentToken.value) ?? new Symbole(currentToken.value); currentToken = lexer.nextToken(); s1.addRelation(new RightOr(s2, leftExpression)); s2.addRelation(new RightOr(s1, leftExpression)); } else { throw new UnexpectedTokenException(currentToken.value); } } else if (currentToken.tokenType == TokenType.Xor) { currentToken = lexer.nextToken(); if (currentToken.tokenType == TokenType.Symbol) { var s2 = core.getSymbole(currentToken.value) ?? new Symbole(currentToken.value); currentToken = lexer.nextToken(); s1.addRelation(new RightXor(s2, leftExpression)); s2.addRelation(new RightXor(s1, leftExpression)); } else { throw new UnexpectedTokenException(currentToken.value); } } else { throw new UnexpectedTokenException(currentToken.value); } } else { throw new UnexpectedTokenException(currentToken.value); } }