本文整理汇总了C#中Mono.TextEditor.Highlighting.Span类的典型用法代码示例。如果您正苦于以下问题:C# Span类的具体用法?C# Span怎么用?C# Span使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Span类属于Mono.TextEditor.Highlighting命名空间,在下文中一共展示了Span类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DefaultFoundSpanEnd
void DefaultFoundSpanEnd (Span span, int offset, int length)
{
PopSpan ();
}
示例2: CreatePreprocessorSpan
public static Span CreatePreprocessorSpan ()
{
var result = new Span ();
result.TagColor = "text.preprocessor";
result.Color = "text.preprocessor";
result.Rule = "String";
result.StopAtEol = true;
return result;
}
示例3: DefaultFoundSpanBegin
void DefaultFoundSpanBegin (Span span, int offset, int length)
{
PushSpan (span, GetRule (span));
}
示例4: FoundSpanEnd
public void FoundSpanEnd (Span span, int offset, int length)
{
curChunk.Length = offset - curChunk.Offset;
curChunk.Style = GetStyle (curChunk) ?? GetChunkStyle (span);
AddChunk (ref curChunk, 0, defaultStyle);
curChunk.Offset = offset;
curChunk.Length = length;
curChunk.Style = span.TagColor ?? GetChunkStyle (span);
AddChunk (ref curChunk, 0, defaultStyle);
spanParser.PopSpan ();
}
示例5: ScanSpanEnd
protected override bool ScanSpanEnd(Span cur, ref int i)
{
return base.ScanSpanEnd(cur, ref i);
}
示例6: ScanSpanEnd
protected virtual bool ScanSpanEnd (Span cur, ref int i)
{
int textOffset = i - StartOffset;
if (cur.End != null) {
RegexMatch match = cur.End.TryMatch (CurText, textOffset);
if (match.Success) {
FoundSpanEnd (cur, i, match.Length);
i += match.Length - 1;
return true;
}
}
if (cur.Exit != null) {
RegexMatch match = cur.Exit.TryMatch (CurText, textOffset);
if (match.Success) {
FoundSpanExit (cur, i, match.Length);
i += match.Length - 1;
return true;
}
}
return false;
}
示例7: FoundSpanBegin
public void FoundSpanBegin (Span span, int offset, int length)
{
curChunk.Length = offset - curChunk.Offset;
curChunk.Style = GetStyle (curChunk);
if (string.IsNullOrEmpty (curChunk.Style)) {
// Span tmpSpan = spanParser.SpanStack.Count > 0 ? spanParser.SpanStack.Pop () : null;
curChunk.Style = GetSpanStyle ();
// if (tmpSpan != null)
// spanParser.SpanStack.Push (tmpSpan);
}
AddChunk (ref curChunk, 0, curChunk.Style);
Rule spanRule = spanParser.GetRule (span);
if (spanRule == null)
throw new Exception ("Rule " + span.Rule + " not found in " + span);
spanParser.PushSpan (span, spanRule);
curChunk.Offset = offset;
curChunk.Length = length;
curChunk.Style = span.TagColor ?? GetChunkStyle (span);
curChunk.SpanStack.Push (span);
AddChunk (ref curChunk, 0, curChunk.Style);
foreach (SemanticRule semanticRule in spanRule.SemanticRules) {
semanticRule.Analyze (this.doc, line, curChunk, offset, line.EndOffset);
}
}
示例8: PushSpan
public void PushSpan (Span span, Rule rule)
{
spanStack.Push (span);
ruleStack.Push (rule);
CurRule = rule;
CurSpan = span;
if (rule.Name == "InterpolatedString" || rule.Name == "InterpolatedVerbatimString")
interpolatedBraces.Push(0);
}
示例9: ScanSpanEnd
protected virtual bool ScanSpanEnd (Span cur, ref int i)
{
int textOffset = i - StartOffset;
if (cur.End != null) {
if (interpolatedBraces.Count > 0) {
char ch = CurText [textOffset];
if (ch == '{')
interpolatedBraces.Push (interpolatedBraces.Pop () + 1);
else if (ch == '}')
interpolatedBraces.Push (interpolatedBraces.Pop () - 1);
if (interpolatedBraces.Peek () >= 1)
return false;
}
RegexMatch match = cur.End.TryMatch (CurText, textOffset);
if (match.Success) {
FoundSpanEnd (cur, i, match.Length);
i += System.Math.Max (0, match.Length - 1);
return true;
}
}
if (cur.Exit != null) {
RegexMatch match = cur.Exit.TryMatch (CurText, textOffset);
if (match.Success) {
FoundSpanExit (cur, i, match.Length);
i += System.Math.Max (0, match.Length - 1);
return true;
}
}
return false;
}
示例10: FoundSpanBegin
public void FoundSpanBegin (Span span, int offset, int length)
{
curChunk.Length = offset - curChunk.Offset;
curChunk.Style = GetStyle (curChunk) ?? GetSpanStyle ();
AddChunk (ref curChunk, 0, curChunk.Style);
curChunk.Offset = offset;
curChunk.Length = length;
curChunk.Style = GetChunkStyle (span);
AddChunk (ref curChunk, 0, curChunk.Style);
Rule spanRule = spanParser.GetRule (span);
if (spanRule == null)
throw new Exception ("Rule " + span.Rule + " not found in " + span);
foreach (SemanticRule semanticRule in spanRule.SemanticRules) {
semanticRule.Analyze (this.doc, line, curChunk, offset, line.EndOffset);
}
}
示例11: EndsWithContinuation
bool EndsWithContinuation (Span span, LineSegment line)
{
return !span.StopAtEol || span.StopAtEol && !string.IsNullOrEmpty (span.Continuation) &&
line != null && doc.GetTextAt (line).Trim ().EndsWith (span.Continuation);
}
示例12: ScanSpanEnd
protected virtual bool ScanSpanEnd (Span cur, int i)
{
if (cur.End != null) {
RegexMatch match = cur.End.TryMatch (doc, i);
if (match.Success) {
OnFoundSpanEnd (cur, i, match.Length);
spanStack.Pop ();
if (ruleStack.Count > 1) // rulStack[1] is always syntax mode
ruleStack.Pop ();
return true;
}
}
if (cur.Exit != null) {
RegexMatch match = cur.Exit.TryMatch (doc, i);
if (match.Success) {
spanStack.Pop ();
if (ruleStack.Count > 1) // rulStack[1] is always syntax mode
ruleStack.Pop ();
OnFoundSpanExit (cur, i, match.Length);
return true;
}
}
return false;
}
示例13: OnFoundSpanEnd
public virtual void OnFoundSpanEnd (Span span, int offset, int length)
{
if (FoundSpanEnd != null)
FoundSpanEnd (span, offset, length);
}
示例14: OnFoundSpanBegin
public virtual void OnFoundSpanBegin (Span span, int offset, int length)
{
if (FoundSpanBegin != null)
FoundSpanBegin (span, offset, length);
}
示例15: PushSpan
public void PushSpan (Span span, Rule rule)
{
spanStack.Push (span);
ruleStack.Push (rule);
this.CurRule = rule;
this.CurSpan = span;
}