public ProductionRuleCaptureGeneralStructuralItem(IProductionRuleSource[] references, IOilexerGrammarProductionRuleEntry rule, ResultedDataType defaultResultType) : base(references, rule, defaultResultType) { }
public ProductionRuleCaptureReferenceStructuralItem(TRef initialReference, IOilexerGrammarProductionRuleEntry rule, ResultedDataType defaultResultType) : this(new TRef[1] { initialReference }, rule, defaultResultType) { }
public ProductionRuleCaptureReferenceStructuralItem(TRef[] references, IOilexerGrammarProductionRuleEntry rule, ResultedDataType defaultResultType) : base(rule) { this.ResultType = defaultResultType; this.references = references; }
public ICaptureTokenStructure Concat(ICaptureTokenStructuralItem item) { var k = (from s in item.Sources let sN = s as INamedFiniteAutomataSource where sN != null && !string.IsNullOrEmpty(sN.Name) select sN).FirstOrDefault(); if (item.ResultType == ResultedDataType.PassThrough) { return(this.Union((ICaptureTokenStructure)item)); } else if (k == null) { return(this); } var result = new CaptureTokenStructure(); int?offsetIndex = null; foreach (var element in this) { if (k.Name == element.Value.Name) { if (element.Value.BucketIndex == null) { element.Value.BucketIndex = offsetIndex = 1; } else { offsetIndex = element.Value.BucketIndex; } result._Add(element.Value.BucketName, element.Value); } else { result._Add(element.Key, element.Value); } } if (!result.ContainsKey(k.Name)) { if (offsetIndex == null) { result._Add(k.Name, item); } else { item.BucketIndex = offsetIndex + 1; result._Add(item.BucketName, item); } } var first = this.Values.FirstOrDefault(); if (this.Count > 0 && first != null && (first.ResultType == ResultedDataType.FlagEnumerationItem || first.ResultType == ResultedDataType.EnumerationItem)) { if (first.ResultType == ResultedDataType.EnumerationItem) { first.ResultType = ResultedDataType.FlagEnumerationItem; } if (item.ResultType == ResultedDataType.EnumerationItem) { item.ResultType = ResultedDataType.FlagEnumerationItem; } } ResultedDataType resultDataType = ResultedDataType.Enumeration; foreach (var value in result.Values) { if (resultDataType == ResultedDataType.Enumeration && !(value.ResultType == ResultedDataType.EnumerationItem || value.ResultType == ResultedDataType.FlagEnumerationItem)) { resultDataType = ResultedDataType.ComplexType; } } result.ResultedTypeName = this.ResultedTypeName; result.ResultType = resultDataType; return(result); }