コード例 #1
0
 public ForeignAction(int offset, int argumentCount, ForeignContextRef context = null)
 {
     this.ContextRef    = context ?? ForeignContextRef.None;
     this.Offset        = offset;
     this.ArgumentCount = argumentCount;
     this.Joint         = new Joint();
 }
コード例 #2
0
        public bool Match(ForeignContextRef reference)
        {
            if (reference == null)
            {
                throw new ArgumentNullException("reference");
            }

            return(reference.UniqueName == this.UniqueName);
        }
コード例 #3
0
ファイル: Matcher.cs プロジェクト: sucaba/IronTextLibrary
 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)
 {
 }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
ファイル: Matcher.cs プロジェクト: sucaba/IronTextLibrary
        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();
        }
コード例 #6
0
 public ForeignAction(int argumentCount, ForeignContextRef context = null)
     : this(0, argumentCount, context)
 {
 }
コード例 #7
0
 public bool Equals(ForeignContextRef other)
 {
     return(other != null && UniqueName == other.UniqueName);
 }
コード例 #8
0
 public bool Provides(ForeignContextRef reference)
 {
     return(this.Any(c => c.Match(reference)));
 }