public Find ( OperatorShape shape, object op, bool cacheWordOp = true, bool les3InfixOp = false ) : Precedence | ||
shape | OperatorShape | Specifies which precedence table and rules to use
/// (Prefix, Suffix or Infix). Note: when this is Suffix, "suf" must not be
/// part of the name in |
op | object | Parsed form of the operator. op must be a Symbol, but /// the parameter has type object to avoid casting Token.Value in the parser. |
cacheWordOp | bool | |
les3InfixOp | bool | |
return | Precedence |
private Precedence PrefixPrecedenceOf(Token t) { if (t.TypeInt == (int)TT.BQString) { return(LesPrecedence.Prefix); } return(_prec.Find(OperatorShape.Prefix, t.Value)); }
protected Precedence PrefixPrecedenceOf(Token t) { if (t.TypeInt == (int)TT.BQOperator) { return(LesPrecedence.Prefix); } return(_prec.Find(OperatorShape.Prefix, t.Value)); }
protected Precedence PrefixPrecedenceOf(Token t) { var prec = _prec.Find(OperatorShape.Prefix, t.Value); if (prec == LesPrecedence.Other) { ErrorSink.Write(Severity.Error, F.Id(t), "Operator `{0}` cannot be used as a prefix operator", t.Value); } return(prec); }
private Precedence?GetPrecedenceIfOperator(LNode node, OperatorShape shape, Precedence context) { int ac = node.ArgCount; if ((ac == (int)shape || ac == -(int)shape) && HasSimpleTargetWithoutPAttrs(node)) { var bs = node.BaseStyle; var op = node.Name; bool naturalOp = LesPrecedenceMap.IsNaturalOperator(op); if (bs == NodeStyle.Operator || (naturalOp && bs != NodeStyle.PrefixNotation)) { var result = _prec.Find(shape, op); if (bs == NodeStyle.Operator && !naturalOp) { result = LesPrecedence.Backtick; } else if (!result.CanAppearIn(context)) { result = LesPrecedence.Backtick; } if (!result.CanAppearIn(context) || !result.CanMixWith(context)) { return(null); } return(result); } } return(null); }
private Precedence?GetPrecedenceIfOperator(ILNode node, OperatorShape shape, Precedence context) { int ac = node.ArgCount(); if ((ac == (int)shape || ac == -(int)shape) && HasTargetIdWithoutPAttrs(node)) { var bs = node.BaseStyle(); var op = node.Name; bool naturalOp = LesPrecedenceMap.IsNaturalOperator(op.Name); if ((naturalOp && bs != NodeStyle.PrefixNotation) || (bs == NodeStyle.Operator && node.Name != null)) { var result = _prec.Find(shape, op); if (!result.CanAppearIn(context) || !result.CanMixWith(context)) { return(null); } return(result); } } return(null); }