本文整理汇总了C#中CodeLocation类的典型用法代码示例。如果您正苦于以下问题:C# CodeLocation类的具体用法?C# CodeLocation怎么用?C# CodeLocation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CodeLocation类属于命名空间,在下文中一共展示了CodeLocation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Read
internal override void Read(NetIncomingMessage Message)
{
base.Read(Message);
Language = (CodeLanguage)Enum.Parse(typeof(CodeLanguage), Message.ReadString());
Location = (CodeLocation)Enum.Parse(typeof(CodeLocation), Message.ReadString());
Source = Message.ReadString();
}
开发者ID:CloneDeath,项目名称:FantasyScape,代码行数:7,代码来源:CodeFile.cs
示例2: Whitespace
/// <summary>
/// Initializes a new instance of the Whitespace class.
/// </summary>
/// <param name="text">The whitespace text.</param>
/// <param name="location">The location of the whitespace in the code.</param>
/// <param name="parent">The parent code unit.</param>
/// <param name="generated">True if the token is inside of a block of generated code.</param>
internal Whitespace(
string text,
CodeLocation location,
Reference<ICodePart> parent,
bool generated)
: base(text,
CsTokenType.WhiteSpace,
CsTokenClass.Whitespace,
location,
parent,
generated)
{
Param.AssertValidString(text, "text");
Param.AssertNotNull(location, "location");
Param.AssertNotNull(parent, "parent");
Param.Ignore(generated);
for (int i = 0; i < text.Length; ++i)
{
if (text[i] == ' ')
{
++this.spaceCount;
}
else if (text[i] == '\t')
{
++this.tabCount;
}
}
}
开发者ID:katerina-marchenkova,项目名称:my,代码行数:36,代码来源:Whitespace.cs
示例3: SearchBackward
static DToken SearchBackward(TextDocument doc, int caretOffset, CodeLocation caret,out DToken lastToken)
{
var ttp = doc.GetText(0, caretOffset);
var sr = new StringReader(ttp);
var lexer = new Lexer(sr);
lexer.NextToken();
var stk=new Stack<DToken>();
while (lexer.LookAhead.Kind!=DTokens.EOF)
{
if (lexer.LookAhead.Kind == DTokens.OpenParenthesis || lexer.LookAhead.Kind==DTokens.OpenSquareBracket || lexer.LookAhead.Kind==DTokens.OpenCurlyBrace)
stk.Push(lexer.LookAhead);
else if (lexer.LookAhead.Kind == DTokens.CloseParenthesis || lexer.LookAhead.Kind == DTokens.CloseSquareBracket || lexer.LookAhead.Kind == DTokens.CloseCurlyBrace)
{
if (stk.Peek().Kind == getOppositeBracketToken( lexer.LookAhead.Kind))
stk.Pop();
}
lexer.NextToken();
}
lastToken = lexer.CurrentToken;
sr.Close();
lexer.Dispose();
if (stk.Count < 1)
return null;
return stk.Pop();
}
开发者ID:cessationoftime,项目名称:D-IDE,代码行数:33,代码来源:DBracketSearcher.cs
示例4: ParserError
public ParserError(bool IsSemanticError, string Message, int KeyToken, CodeLocation ErrorLocation)
{
IsSemantic = IsSemanticError;
this.Message = Message;
this.Token = KeyToken;
this.Location = ErrorLocation;
}
开发者ID:DinrusGroup,项目名称:D_Parser,代码行数:7,代码来源:ParserError.cs
示例5: Constructor
public void Constructor(string filename, int line, int column)
{
var location = new CodeLocation(filename, line, column);
Assert.AreEqual(filename, location.Path);
Assert.AreEqual(line, location.Line);
Assert.AreEqual(column, location.Column);
}
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:7,代码来源:CodeLocationTest.cs
示例6: Argument
/// <summary>
/// Initializes a new instance of the Argument class.
/// </summary>
/// <param name="name">The optional name of the argument.</param>
/// <param name="modifiers">Modifers applied to this argument.</param>
/// <param name="argumentExpression">The expression that forms the body of the argument.</param>
/// <param name="location">The location of the argument in the code.</param>
/// <param name="parent">The parent code part.</param>
/// <param name="tokens">The tokens that form the argument.</param>
/// <param name="generated">Indicates whether the argument is located within a block of generated code.</param>
internal Argument(
CsToken name,
ParameterModifiers modifiers,
Expression argumentExpression,
CodeLocation location,
Reference<ICodePart> parent,
CsTokenList tokens,
bool generated)
{
Param.Ignore(name);
Param.Ignore(modifiers);
Param.AssertNotNull(argumentExpression, "argumentExpression");
Param.AssertNotNull(location, "location");
Param.AssertNotNull(parent, "parent");
Param.Ignore(tokens);
Param.Ignore(generated);
this.name = name;
this.modifiers = modifiers;
this.argumentExpression = argumentExpression;
this.location = location;
this.parent = parent;
this.tokens = tokens;
this.generated = generated;
}
开发者ID:katerina-marchenkova,项目名称:my,代码行数:35,代码来源:Argument.cs
示例7: GetNextMetaBlockOrStatStmt
public ISyntaxRegion GetNextMetaBlockOrStatStmt(CodeLocation until)
{
if (nextStatStmt == null && StaticStatementEnum != null) {
if (StaticStatementEnum.MoveNext ())
nextStatStmt = StaticStatementEnum.Current;
else
StaticStatementEnum = null;
}
if (nextMetaDecl == null && MetaBlockEnum != null) {
if (MetaBlockEnum.MoveNext ())
nextMetaDecl = MetaBlockEnum.Current;
else
MetaBlockEnum = null;
}
ISyntaxRegion sr;
if (nextStatStmt != null) {
if (nextMetaDecl == null)
sr = nextStatStmt;
else
sr = nextStatStmt.First (nextMetaDecl);
} else if (nextMetaDecl != null)
sr = nextMetaDecl;
else
return null;
return sr.Location < until ? sr : null;
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:29,代码来源:ConditionsFrame.cs
示例8: ForStatement
public void ForStatement()
{
var code = @"module A; // 1
void main(){
for(
int
i= // 5
0;
i<100;
i++)
{ // 10
}";
var mod = DParser.ParseString(code);
var main = mod["main"].First() as DMethod;
var l = new CodeLocation(1,4);
var off = DocumentHelper.LocationToOffset(code,l);
ParserTrackerVariables ptr;
CodeLocation caretLoc;
//var parsedBlock = AbstractCompletionProvider.FindCurrentCaretContext(code,main, off,l,out ptr, out caretLoc);
/*
* a) Test if completion popup would open in each code situation
* b) Test in which case iteration variables can be found.
*/
//TODO
}
开发者ID:EnergonV,项目名称:D_Parser,代码行数:29,代码来源:CompletionTests.cs
示例9: SearchBrackets
public static BracketSearchResult SearchBrackets(TextDocument doc, int caretOffset, TextLocation caret)
{
var caretLocation = new CodeLocation(caret.Column, caret.Line);
try
{
if (caretOffset < 1 || caretOffset>=doc.TextLength-2)
return null;
// Search backward
DToken lastToken=null;
var tk_start = SearchBackward(doc, caretOffset, caretLocation,out lastToken);
if (tk_start == null)
return null;
// Search forward
var tk_end = SearchForward(doc,
doc.GetOffset(lastToken.EndLocation.Line,lastToken.EndLocation.Column),
lastToken.EndLocation,
getOppositeBracketToken(tk_start.Kind));
if (tk_end == null)
return null;
int start = doc.GetOffset(tk_start.Location.Line, tk_start.Location.Column),
end = doc.GetOffset(tk_end.Location.Line, tk_end.Location.Column);
return new BracketSearchResult(start, 1, end, 1);
}
catch { return null; }
}
开发者ID:cessationoftime,项目名称:D-IDE,代码行数:31,代码来源:DBracketSearcher.cs
示例10: Set
public void Set(IBlockNode b, CodeLocation caret)
{
scopedBlock = b;
Caret = caret;
ConditionalCompilation.EnumConditions(DeclarationCondititons, b, ctxt, caret);
}
开发者ID:DinrusGroup,项目名称:D_Parser,代码行数:7,代码来源:ContextFrame.cs
示例11: EVException
public EVException([CallerFilePath] string callerFilePath = "",
[CallerLineNumber] int callerLineNumber = 0,
[CallerMemberName] string callerMemberName = "")
{
CodeLocation codeLocation = new CodeLocation(callerFilePath, callerLineNumber, callerMemberName);
this.AddNamedProperty("EVExceptionConstructionLocation", codeLocation.ToString());
}
开发者ID:Rajeshbharathi,项目名称:CGN.Paralegal,代码行数:7,代码来源:EVException.cs
示例12: FindFitting
public IEnumerable<DMethod> FindFitting(ResolverContextStack ctxt, CodeLocation currentLocation, ISemantic firstArgument, string nameFilter = null)
{
if (IsProcessing)
return null;
var preMatchList = new List<DMethod>();
bool dontUseNameFilter = nameFilter == null;
lock(CachedMethods)
foreach (var kv in CachedMethods)
{
// First test if arg is matching the parameter
if ((dontUseNameFilter || kv.Key.Name == nameFilter) &&
ResultComparer.IsImplicitlyConvertible(firstArgument, kv.Value, ctxt))
preMatchList.Add(kv.Key);
}
// Then filter out methods which cannot be accessed in the current context
// (like when the method is defined in a module that has not been imported)
var mv = new MatchFilterVisitor<DMethod>(ctxt, preMatchList);
mv.IterateThroughScopeLayers(currentLocation);
return mv.filteredList;
}
开发者ID:gavin-norman,项目名称:Mono-D,代码行数:26,代码来源:UFCSCache.cs
示例13: ApplySolution
/// <summary>
/// Inserts import statement into correct place
/// </summary>
static void ApplySolution(string import, Document doc)
{
var eData = DResolverWrapper.GetEditorData(doc);
var loc = new CodeLocation(0, DParser.FindLastImportStatementEndLocation(eData.SyntaxTree, eData.ModuleCode).Line + 1);
doc.Editor.Insert(doc.Editor.GetLine(loc.Line).Offset, import.Trim() + doc.Editor.EolMarker);
//IOInterface.InsertIntoCode(loc, "import " + mod.ModuleName + ";\n");
}
开发者ID:rikkimax,项目名称:Mono-D,代码行数:11,代码来源:ImportSymbol.cs
示例14: MultiplicationOperator
/// <summary>
/// Initializes a new instance of the MultiplicationOperator class.
/// </summary>
/// <param name="document">The parent document.</param>
/// <param name="text">The text of the item.</param>
/// <param name="location">The location of the item.</param>
/// <param name="generated">Indicates whether the item is generated.</param>
internal MultiplicationOperator(CsDocument document, string text, CodeLocation location, bool generated)
: base(document, text, OperatorCategory.Arithmetic, OperatorType.Multiplication, location, generated)
{
Param.AssertNotNull(document, "document");
Param.AssertValidString(text, "text");
Param.AssertNotNull(location, "location");
Param.Ignore(generated);
}
开发者ID:jonthegiant,项目名称:StyleCop,代码行数:15,代码来源:MultiplicationOperator.cs
示例15: Comment
public Comment(Type commentType, string comment, bool commentStartsLine, CodeLocation startPosition, CodeLocation endPosition)
{
this.CommentType = commentType;
this.CommentText = comment;
this.CommentStartsLine = commentStartsLine;
this.StartPosition = startPosition;
this.EndPosition = endPosition;
}
开发者ID:EnergonV,项目名称:D_Parser,代码行数:8,代码来源:DToken.cs
示例16: ElementHeaderLine
/// <summary>
/// Initializes a new instance of the ElementHeaderLine class.
/// </summary>
/// <param name="document">The parent document.</param>
/// <param name="text">The text of the item.</param>
/// <param name="location">The location of the item.</param>
/// <param name="generated">Indicates whether the item is generated.</param>
internal ElementHeaderLine(CsDocument document, string text, CodeLocation location, bool generated)
: base(document, text, CommentType.ElementHeaderLine, location, generated)
{
Param.AssertNotNull(document, "document");
Param.AssertValidString(text, "text");
Param.AssertNotNull(location, "location");
Param.Ignore(generated);
}
开发者ID:jonthegiant,项目名称:StyleCop,代码行数:15,代码来源:XmlHeaderLine.cs
示例17: PointerOperator
/// <summary>
/// Initializes a new instance of the PointerOperator class.
/// </summary>
/// <param name="document">The parent document.</param>
/// <param name="text">The text of the item.</param>
/// <param name="location">The location of the item.</param>
/// <param name="generated">Indicates whether the item is generated.</param>
internal PointerOperator(CsDocument document, string text, CodeLocation location, bool generated)
: base(document, text, OperatorCategory.Reference, OperatorType.Pointer, location, generated)
{
Param.AssertNotNull(document, "document");
Param.AssertValidString(text, "text");
Param.AssertNotNull(location, "location");
Param.Ignore(generated);
}
开发者ID:jonthegiant,项目名称:StyleCop,代码行数:15,代码来源:PointerOperator.cs
示例18: ConditionalQuestionMarkOperator
/// <summary>
/// Initializes a new instance of the ConditionalQuestionMarkOperator class.
/// </summary>
/// <param name="document">The parent document.</param>
/// <param name="text">The text of the item.</param>
/// <param name="location">The location of the item.</param>
/// <param name="generated">Indicates whether the item is generated.</param>
internal ConditionalQuestionMarkOperator(CsDocument document, string text, CodeLocation location, bool generated)
: base(document, text, OperatorCategory.Conditional, OperatorType.ConditionalQuestionMark, location, generated)
{
Param.AssertNotNull(document, "document");
Param.AssertValidString(text, "text");
Param.AssertNotNull(location, "location");
Param.Ignore(generated);
}
开发者ID:jonthegiant,项目名称:StyleCop,代码行数:15,代码来源:ConditionalQuestionMarkOperator.cs
示例19: SimpleToken
/// <summary>
/// Initializes a new instance of the SimpleToken class.
/// </summary>
/// <param name="document">The parent document.</param>
/// <param name="text">The token string.</param>
/// <param name="tokenType">The token type.</param>
/// <param name="location">The location of the token within the code document.</param>
/// <param name="generated">True if the token is inside of a block of generated code.</param>
internal SimpleToken(CsDocument document, string text, int tokenType, CodeLocation location, bool generated)
: base(new CodeUnitProxy(document), tokenType, location)
{
Param.Ignore(document, text, tokenType, location, generated);
this.Text = text;
this.Generated = generated;
}
开发者ID:jonthegiant,项目名称:StyleCop,代码行数:16,代码来源:SimpleToken.cs
示例20: BitwiseComplementOperator
/// <summary>
/// Initializes a new instance of the BitwiseComplementOperator class.
/// </summary>
/// <param name="document">The parent document.</param>
/// <param name="text">The text of the item.</param>
/// <param name="location">The location of the item.</param>
/// <param name="generated">Indicates whether the item is generated.</param>
internal BitwiseComplementOperator(CsDocument document, string text, CodeLocation location, bool generated)
: base(document, text, OperatorCategory.Unary, OperatorType.BitwiseComplement, location, generated)
{
Param.AssertNotNull(document, "document");
Param.AssertValidString(text, "text");
Param.AssertNotNull(location, "location");
Param.Ignore(generated);
}
开发者ID:jonthegiant,项目名称:StyleCop,代码行数:15,代码来源:BitwiseComplementOperator.cs
注:本文中的CodeLocation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论