当前位置: 首页>>代码示例>>C#>>正文


C# LineInfo类代码示例

本文整理汇总了C#中LineInfo的典型用法代码示例。如果您正苦于以下问题:C# LineInfo类的具体用法?C# LineInfo怎么用?C# LineInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LineInfo类属于命名空间,在下文中一共展示了LineInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Initialize

		protected internal virtual void Initialize(Symbol symbol, LineInfo position) {
			if (symbol == null) {
				throw new ArgumentNullException("symbol");
			}
			this.symbol = symbol;
			this.position = position;
		}
开发者ID:avonwyss,项目名称:bsn-goldparser,代码行数:7,代码来源:SemanticToken.cs

示例2: Parse

		/// <summary>
		/// Parse node contents add return a fresh node.
		/// </summary>
		/// <param name="parent">Node that this is a subnode to. Can be null</param>
		/// <param name="prototypes">A list with node types</param>
		/// <param name="line">Line to parse</param>
		/// <param name="offset">Where to start the parsing. Will be set to where the next node should start parsing</param>
		/// <returns>A node corresponding to the bla bla; null if parsing failed.</returns>
		/// <exception cref="CodeGeneratorException"></exception>
		public override Node Parse(NodeList prototypes, Node parent, LineInfo line, ref int offset)
		{
			if (offset > line.Data.Length - 1)
				throw new CodeGeneratorException(line.LineNumber, line.Data, "Tried to parse after end of line");

			if (line.Data[offset] != '_')
				throw new CodeGeneratorException(line.LineNumber, line.Data, "Not a PartialNode");

			// From the first " sign (offset + 2) find the next " sign
			int pos = -1;
			for (int i = offset + 2; i < line.Data.Length; ++i)
			{
				if (line.Data[i] == '\"')
				{
					pos = i;
					break;
				}
			}
			if (pos == -1)
				throw new CodeGeneratorException(line.LineNumber, line.Data, "PartialNode does not contain an end paranthesis.");

			// Cut out the data between the two above found " signs and then start processing the address
			// The address is converted from the format /example/example/ to \\example\\example.haml
			PartialNode node = (PartialNode)prototypes.CreateNode("_", parent);
			node._target = line.Data.Substring(offset + 2, pos - offset - 2);
			if (node._target[node._target.Length - 1] == '/')
				node._target = node._target.Substring(0, node._target.Length - 1);
			if (node._target[0] == '/')
				node._target = node._target.Substring(1);
			node._target = node._target.Replace("/", "\\\\");
			node._target += ".haml";

			offset = pos + 1;
			return node;
		}
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:44,代码来源:PartialNode.cs

示例3: Read

		public string Read(int count, out LineInfo position) {
			position = new LineInfo(bufferPosition+bufferOffset, line, column);
			if (count == 0) {
				return string.Empty;
			}
			if (!EnsureBuffer(count-1)) {
				throw new ArgumentOutOfRangeException("count");
			}
			rollbackBufferOffset = bufferOffset;
			rollbackBufferPosition = bufferPosition;
			rollbackColumn = column;
			rollbackLine = line;
			rollbackPrevious = previous;
			var result = new string(buffer, bufferOffset, count);
			for (int i = 0; i < count; i++) {
				char current = buffer[bufferOffset++];
				switch (current) {
				case '\r':
					HandleNewline(current, '\n');
					break;
				case '\n':
					HandleNewline(current, '\r');
					break;
				default:
					column++;
					previous = current;
					break;
				}
			}
			return result;
		}
开发者ID:avonwyss,项目名称:bsn-goldparser,代码行数:31,代码来源:TextBuffer.cs

示例4: Parse

 /// <summary>
 /// Parse node contents add return a fresh node.
 /// </summary>
 /// <param name="prototypes">List containing all node types</param>
 /// <param name="parent">Node that this is a subnode to. Can be null</param>
 /// <param name="line">Line to parse</param>
 /// <param name="offset">Where to start the parsing. Should be set to where the next node should start parsing.</param>
 /// <returns>A node corresponding to the bla bla; null if parsing failed.</returns>
 /// <exception cref="Exceptions.CodeGeneratorException"></exception>
 public override Node Parse(NodeList prototypes, Node parent, LineInfo line, ref int offset)
 {
     offset = line.Data.Length;
     return new DocTypeTag(
         @"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"">".Replace("\"", "\"\""),
         parent);
 }
开发者ID:Horlos,项目名称:web-server,代码行数:16,代码来源:DocTypeTag.cs

示例5: TextToken

		private readonly string text; // Token text.

		internal TextToken(Symbol symbol, LineInfo position, string text) {
			if (symbol == null) {
				throw new ArgumentNullException("symbol");
			}
			if (text == null) {
				throw new ArgumentNullException("text");
			}
			this.symbol = symbol;
			this.position = position;
			this.text = this.symbol.Name.Equals(text, StringComparison.Ordinal) ? this.symbol.Name : text; // "intern" short strings which are equal to the terminal name
		}
开发者ID:avonwyss,项目名称:bsn-goldparser,代码行数:13,代码来源:TextToken.cs

示例6: NewLine

	private LineInfo NewLine ( int i ) {
		if ( lIndex >= 999 ) {
			lIndex = 0;
		}
		
		LineInfo newLine = new LineInfo ( i, lineHeight );
		lines[lIndex] = ( newLine );
		height += lineHeight;
		lIndex++;
		return newLine;
	}
开发者ID:flashwade03,项目名称:opengui,代码行数:11,代码来源:OGTextInfo.cs

示例7: Parse

        /// <summary>
        /// Parse node contents add return a fresh node.
        /// </summary>
        /// <param name="prototypes">List containing all node types</param>
        /// <param name="parent">Node that this is a subnode to. Can be null</param>
        /// <param name="line">Line to parse</param>
        /// <param name="offset">Where to start the parsing. Should be set to where the next node should start parsing.</param>
        /// <returns>A node corresponding to the bla bla; null if parsing failed.</returns>
        /// <exception cref="Exceptions.CodeGeneratorException"></exception>
        public override Node Parse(NodeList prototypes, Node parent, LineInfo line, ref int offset)
        {
            // text on tag rows are identified by a single space.
            if (parent != null && line.Data[offset] == ' ')
                ++offset;

            TextNode node = new TextNode(parent, line.Data.Substring(offset));
            if (parent == null)
                node.LineInfo = line;
            offset = line.Data.Length;
            return node;
        }
开发者ID:Horlos,项目名称:web-server,代码行数:21,代码来源:TextNode.cs

示例8: FunctionImportEntityTypeMapping

 internal FunctionImportEntityTypeMapping(IEnumerable<EntityType> isOfTypeEntityTypes,
     IEnumerable<EntityType> entityTypes, IEnumerable<FunctionImportEntityTypeMappingCondition> conditions,
     Collection<FunctionImportReturnTypePropertyMapping> columnsRenameList,
     LineInfo lineInfo)
     : base(columnsRenameList, lineInfo)
 {
     this.IsOfTypeEntityTypes = new ReadOnlyCollection<EntityType>(
         EntityUtil.CheckArgumentNull(isOfTypeEntityTypes, "isOfTypeEntityTypes").ToList());
     this.EntityTypes = new ReadOnlyCollection<EntityType>(
         EntityUtil.CheckArgumentNull(entityTypes, "entityTypes").ToList());
     this.Conditions = new ReadOnlyCollection<FunctionImportEntityTypeMappingCondition>(
         EntityUtil.CheckArgumentNull(conditions, "conditions").ToList());
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:13,代码来源:FunctionImportMapping.ReturnTypeRenameMapping.cs

示例9: GivenModeIsAlwaysQuotedWhenLineInfoIsNotQuotedThenAnExceptionIsThrown

        public void GivenModeIsAlwaysQuotedWhenLineInfoIsNotQuotedThenAnExceptionIsThrown() {
            var fi = new Mock<FieldInfo>();
            fi.Setup(f => f.FieldType).Returns(typeof (string));
            var fieldUnderTest = new DelimitedField(fi.Object, ";") {
                QuoteChar = '%',
                QuoteMode = QuoteMode.AlwaysQuoted
            };
            var invalidLineInfo = new LineInfo("Hello, World") {
                mReader = new ForwardReader(new Mock<IRecordReader>().Object, 0),
            };

            Assert.Throws<BadUsageException>(() => fieldUnderTest.ExtractFieldString(invalidLineInfo));
        } 
开发者ID:calebillman,项目名称:FileHelpers,代码行数:13,代码来源:DelimitedFieldTests.cs

示例10: AddMe

        /// <summary>
        /// Creates a DIV node and add's the specified node to it.
        /// </summary>
        /// <param name="prototypes">Contains all prototypes for each control char. used to instanciate new nodes.</param>
        /// <param name="parent">parent node</param>
        /// <param name="line">current line information</param>
        /// <param name="me">node to add to the DIV node</param>
        /// <returns>current node</returns>
        public Node AddMe(NodeList prototypes, Node parent, LineInfo line, Node me)
        {
            if (parent == null)
            {
                TagNode tag = (TagNode)prototypes.CreateNode("%", null);
                tag.Name = "div";
                tag.LineInfo = line;
                tag.AddModifier(me);
                return tag;
            }

            return me;
        }
开发者ID:Horlos,项目名称:web-server,代码行数:21,代码来源:ChildNode.cs

示例11: IsMultiLine

        /// <summary>
        /// Determines if this node spans over multiple lines.
        /// </summary>
        /// <param name="line">contains line information (and text)</param>
        /// <param name="isContinued">true if the previous line was continued.</param>
        /// <returns>true if this line continues onto the next.</returns>
        public override bool IsMultiLine(LineInfo line, bool isContinued)
        {
            string trimmed = line.Data.TrimEnd();
            if (trimmed.Length == 0)
                return false;

            if (trimmed.EndsWith("|"))
            {
                line.TrimRight(1);
                return true;
            }

            return false;
        }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:20,代码来源:NewLineRule.cs

示例12: IsMultiLine

        /// <summary>
        /// Determines if this node spans over multiple lines.
        /// </summary>
        /// <param name="line">contains line information (and text)</param>
        /// <param name="isContinued">true if the previous line was continued.</param>
        /// <returns>true if this line continues onto the next.</returns>
        public override bool IsMultiLine(LineInfo line, bool isContinued)
        {
            // hack to dont include code
            // a more proper way would have bene to scan after each tag
            if (!isContinued)
            {
                char ch = line.Data[0];
                if (ch != '#' && ch != '%' && ch != '.')
                    return false;
            }

            bool inQuote = false;
            bool inAttribute = false;
            if (isContinued && line.Data.IndexOf('{') == -1)
                inAttribute = true;
            foreach (char ch in line.Data)
            {
                if (ch == '"')
                    inQuote = !inQuote;
                else if (ch == '{' && !inQuote)
                {
                    if (inAttribute)
						throw new CodeGeneratorException(line.LineNumber, line.Data,
                            "Found another start of attributes, but no close tag. Have you forgot one '}'?");
                    inAttribute = true;
                }
                else if (ch == '}' && !inQuote)
                    inAttribute = false;
            }

            if (inQuote)
				throw new CodeGeneratorException(line.LineNumber, line.Data, "Attribute quotes can not span over multiple lines.");

            if (inAttribute)
            {
                //todo: Attach a log writer.
                //Console.WriteLine("Attribute is not closed, setting unfinished rule");
                line.UnfinishedRule = this;

            	line.Data.TrimEnd();
				if (line.Data.EndsWith("|"))
					line.TrimRight(1);
				
				return true;
            }

            return inAttribute;
        }
开发者ID:kow,项目名称:Aurora-Sim,代码行数:54,代码来源:AttributesRule.cs

示例13: Parse

        /// <summary>
        /// Parse node contents add return a fresh node.
        /// </summary>
        /// <param name="prototypes">List containing all node types</param>
        /// <param name="parent">Node that this is a subnode to. Can be null</param>
        /// <param name="line">Line to parse</param>
        /// <param name="offset">Where to start the parsing. Should be set to where the next node should start parsing.</param>
        /// <returns>A node corresponding to the bla bla; null if parsing failed.</returns>
        /// <exception cref="CodeGeneratorException"></exception>
        public override Node Parse(NodeList prototypes, Node parent, LineInfo line, ref int offset)
        {
            if (offset > line.Data.Length)
                throw new CodeGeneratorException(line.LineNumber, line.Data, "Too little data");

            int pos = line.Data.Length;
            ++offset;
            string code = line.Data.Substring(offset, pos - offset);
            offset = pos;

            SilentCodeNode node = (SilentCodeNode)prototypes.CreateNode("-", parent);
            node._code = code;
            if (parent != null)
                node.LineInfo = line;
            return node;
        }
开发者ID:Horlos,项目名称:web-server,代码行数:25,代码来源:SilentCodeNode.cs

示例14: parse

		/// <summary>
		/// The general idea is to create a regex based of the "Format: "-line in .ass file. Which
		/// then can be used to easily filter the required information (namely timestamps, text and
		/// actor).
		/// </summary>
		/// <param name="settings">Settings.</param>
		/// <param name="rawLines">Raw lines.</param>
		public List<LineInfo> parse(Settings settings, LinkedList<String> rawLines) {
			List<LineInfo> lines = new List<LineInfo> ();

			string formatRegex = GetFormatRegex (rawLines);
			if (formatRegex == null)
				return null;

			// parse every line with format regex and save lines in LineInfo
			foreach(string rawLine in rawLines) {
				Match lineMatch = Regex.Match(rawLine, formatRegex, RegexOptions.IgnoreCase | RegexOptions.Compiled);

				if (!lineMatch.Success)
					continue;

				string startTimeString = lineMatch.Groups ["StartTime"].ToString ().Trim ();
				string endTimeString = lineMatch.Groups ["EndTime"].ToString ().Trim ();
				string nameString = lineMatch.Groups ["Name"].ToString ().Trim ();
				string textString = lineMatch.Groups ["Text"].ToString ().Trim ();

				if (settings.IgnoreStyledSubLines &&
						textString.StartsWith ("{") // NOTE: this is a really big hint for styled subtitles but might create false-negatives -- research common patterns in subtitle files
						&& !textString.StartsWith ("{\\b1}") // bold
						&& !textString.StartsWith ("{\\u1}") // underline
						&& !textString.StartsWith ("{\\i1}") // italics
						&& !textString.StartsWith ("{\\an8}") // text align: up
						) {
					continue;
				}

				// remove styling in subtitles
				textString = Regex.Replace(textString, "{.*?}", "");


				if (textString == "")
					continue; // ignore lines without text

				// generate line info
				LineInfo li = new LineInfo(parseTime(startTimeString), parseTime(endTimeString), textString, new List<String>(new String[]{ nameString }));
				lines.Add(li);



			}


			return lines;
		}
开发者ID:ChangSpivey,项目名称:SubtitleMemorize,代码行数:54,代码来源:SubtitleParserASS.cs

示例15: Parse

        /// <summary>
        /// Parse node contents add return a fresh node.
        /// </summary>
        /// <param name="prototypes">List containing all node types</param>
        /// <param name="parent">Node that this is a subnode to. Can be null</param>
        /// <param name="line">Line to parse</param>
        /// <param name="offset">Where to start the parsing. Should be set to where the next node should start parsing.</param>
        /// <returns>A node corresponding to the bla bla; null if parsing failed.</returns>
        /// <exception cref="CodeGeneratorException"></exception>
        public override Node Parse(NodeList prototypes, Node parent, LineInfo line, ref int offset)
        {
            if (offset > line.Data.Length - 1)
                throw new CodeGeneratorException(line.LineNumber, line.Data, "Too little data");

            int pos = GetEndPos(offset, line.Data);
            if (pos == -1)
                pos = line.Data.Length;

            ++offset;
            string name = line.Data.Substring(offset, pos - offset);
            offset = pos;

            ClassNode node = (ClassNode)prototypes.CreateNode(".", parent);
            node._name = name;
            return AddMe(prototypes, parent, line, node);
        }
开发者ID:Horlos,项目名称:web-server,代码行数:26,代码来源:ClassNode.cs


注:本文中的LineInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。