/// <summary> /// /// </summary> /// <param name="first"></param> /// <returns></returns> public static EXPRESSION parse(Token first, iSCOPE context) { return(LOGICAL.parse(first, context)); }
public static new EXPRESSION parse(Token first, iSCOPE context) { EXPRESSION result = RELATIONAL.parse(first, context); if (result == null) { return(null); } Span begin = result.span; while (true) { Token token = get(); switch (token.code) { case TokenCode.Ampersand: case TokenCode.AmpAmp: case TokenCode.Vertical: case TokenCode.VertVert: forget(); break; case TokenCode.Identifier: Category cat = new Category(CategoryCode.operatorr); if (token.image == "or") { forget(); Token second = get(); if (second.code == TokenCode.Else) { forget(); token = new Token(new Span(token, second), TokenCode.Vertical, "or else", cat); } else { token = new Token(token.span, TokenCode.VertVert, "or", cat); } break; } else if (token.image == "and") { forget(); Token second = get(); if (second.code == TokenCode.Then) { forget(); token = new Token(new Span(token, second), TokenCode.Ampersand, "and then", cat); } else { token = new Token(token.span, TokenCode.AmpAmp, "and", cat); } break; } else { goto Out; } default: goto Out; } EXPRESSION right = RELATIONAL.parse(null, context); result = new LOGICAL(token, result, right); result.setSpan(begin, right.span); } Out: return(result); }