public ForeignAction(int offset, int argumentCount, ForeignContextRef context = null) { this.ContextRef = context ?? ForeignContextRef.None; this.Offset = offset; this.ArgumentCount = argumentCount; this.Joint = new Joint(); }
public bool Match(ForeignContextRef reference) { if (reference == null) { throw new ArgumentNullException("reference"); } return(reference.UniqueName == this.UniqueName); }
public Matcher( string pattern, SymbolBase outcome = null, ForeignContextRef context = null, Condition nextCondition = null, Disambiguation disambiguation = Disambiguation.Undefined) : this( ScanPattern.CreateRegular(pattern), outcome, context, nextCondition, disambiguation) { }
public ForeignContext Resolve(ForeignContextRef reference) { var matching = this.Where(c => c.Match(reference)); int count = matching.Count(); switch (count) { case 0: return(null); case 1: return(matching.First()); default: throw new InvalidOperationException( "Ambiguous context reference: " + reference.UniqueName); } }
public Matcher( ScanPattern pattern, SymbolBase outcome = null, ForeignContextRef context = null, Condition nextCondition = null, Disambiguation disambiguation = Disambiguation.Undefined) { this.Pattern = pattern; this.Outcome = outcome; this.Context = context; this.NextCondition = nextCondition; if (disambiguation == Disambiguation.Undefined) { this.Disambiguation = pattern.DefaultDisambiguation; } else { this.Disambiguation = disambiguation; } this.Joint = new Joint(); }
public ForeignAction(int argumentCount, ForeignContextRef context = null) : this(0, argumentCount, context) { }
public bool Equals(ForeignContextRef other) { return(other != null && UniqueName == other.UniqueName); }
public bool Provides(ForeignContextRef reference) { return(this.Any(c => c.Match(reference))); }