Source code of all lines this node spans (excluding children).

 @return [String]
545823
def source_code
      next_node_line =
        if next_node
          next_node.line - 1
        else
          @document.source_lines.count + 1
        end

      @document.source_lines[@line - 1...next_node_line]
               .join("\n")
               .gsub(/^\s*\z/m, '') # Remove blank lines at the end
    end
338353
def text(parent, indent = nil, multiline_or_print = true)
      # Try to see if we can match a multiline operator. If we can accept_stripped only
      # multiline, which is the case for filters, undo the operation.
      if accept :multiline
        multiline = true
      elsif multiline_or_print
        return nil unless lookahead :print_lookahead
      end

      # Get text node type
      type = accept(:print) ? :print : :text

      # Get leading whitespace
      leading_whitespace = accept(:leading_whitespace)

      # Get trailing whitespace
      trailing_whitespace = accept(:trailing_whitespace)

      # Check if the text or print node is escaped or unescaped
      escaped = accept(:unescaped_value) ? false : true

      # Get text value
      value = accept :line_feed
      value = value[1..-1] if value[0] == '\\'

      # Create the text node using input data
      text_node = [
        :plain,
        type,
        {
          value: value.strip,
          escaped: escaped,
          leading_whitespace: leading_whitespace,
          trailing_whitespace: trailing_whitespace
        },
        nil,
        indent
      ]

      # If we have a multiline node, get all the text which has higher
      # indentation than our indentation node.
      if multiline
        text_node[@options][:value] += accept(:newline) || ''
        text_node[@options][:value] += get_indented_lines(indent)
        text_node[@options][:value].strip!
      elsif value.empty?
        # If our value is empty and we're not going to add any more lines to
        # our buffer, skip the node
        return nil
      end

      # Increase indentation if this is an inline text node
      text_node[@indent] += @settings[:indent] unless multiline_or_print

      # Add text node to the parent element
      parent[@children] << text_node
    end
1335685
function split_lines_by_child_nodes(lines)
{
	// determine lines with indentation = 0 (child node entry lines)
	const node_entry_lines = lines.map((line, index) => 
	{
		return { tabs: line.tabs, index }
	})
	.filter(line => line.tabs === 0)
	.map(line => line.index)

	// deduce corresponding child node ending lines
	const node_ending_lines = node_entry_lines.map(line_index => line_index - 1)
	node_ending_lines.shift()
	node_ending_lines.push(lines.length - 1)

	// each child node boundaries in terms of starting line index and ending line index
	const from_to = zip(node_entry_lines, node_ending_lines)

	// now lines are split by child nodes
	return from_to.map(from_to => lines.slice(from_to[0], from_to[1] + 1))
}
227861
def node(parent, indent = nil)
      return unless (name = lookahead(:node_lookahead) ||
                            lookahead(:shorthand_lookahead))

      # Skip node if it's a reserved keyword
      return nil if KEYWORDS.include? name[0].to_sym

      # Accept either explicit node_name or implicit :div node_name
      # with shorthand attributes
      if (node_name = accept :node)
        node_name = node_name.to_sym
        shorthand = shorthand_attributes
      elsif (shorthand = shorthand_attributes)
        node_name = :div
      end

      # Node creation options
      options = {}

      # Get leading whitespace
      options[:recursive] = accept(:recursive)

      # Get leading whitespace
      options[:leading_whitespace] = accept_stripped(:leading_whitespace)

      # Get trailing whitespace
      options[:trailing_whitespace] = accept_stripped(:trailing_whitespace)

      # Get wrapped node attributes
      atts = attributes(shorthand) || {}

      # Inherit attributes from definition
      options[:extension] = extend_attributes

      # Get unwrapped node attributes
      options[:attributes] = attributes_assignments atts, false

      # Create node
      current_node = [:node, node_name, options, [], indent]

      # Check for self enclosing tags and definitions
      def_check = !@definitions.keys.include?(node_name) &&
                  Settings::SELF_ENCLOSING.include?(node_name)

      # Check if the node is explicitly self enclosing
      if (close = accept_stripped :self_enclosing) || def_check
        current_node[@options][:self_enclosing] = true

        unless close.nil? || close.strip.empty?
          undo close
          Logger.error :parse, @code, @i, @j, :self_enclosing
        end
      end

      # Check whether we have explicit inline elements and add them
      # with increased base indentation
      if accept :inline_child
        # Inline node element
        Logger.error :parse,
                     @code,
                     @i,
                     @j,
                     :inline_child unless node current_node, indent
      elsif comment current_node, indent
        # Accept same line comments
      else
        # Accept inline text element
        text current_node, indent, false
      end

      # Add the current node to the root
      root current_node, indent

      # Add the parsed node to the parent
      parent[@children] << current_node
    end
688185
def parse
      @lines.each do |line|
        if m = line.match(R_ATTRIBUTE)
          @attrs << {:name => m[1].strip, :type => m[2].strip, :desc => m[4].strip}
        elsif m = line.match(R_ATTRIBUTE_NEXT_LINE)
          @attrs[-1][:desc] += " #{m[1].strip}"
        end
      end
    end
498337
def lines(self) -> str:
        """"""
        if self.definition is None:
            return ''
        source = ''
        lines = self.definition.source
        offset = self.definition.start  # type: ignore
        lines_stripped = list(reversed(list(dropwhile(is_blank,
                                                      reversed(lines)))))
        numbers_width = len(str(offset + len(lines_stripped)))
        line_format = '{{:{}}}:{{}}'.format(numbers_width)
        for n, line in enumerate(lines_stripped):
            if line:
                line = ' ' + line
            source += line_format.format(n + offset, line)
            if n > 5:
                source += '        ...\n'
                break
        return source
1320414
def to_md
      # Usually ruby is extremely readable, but I think "-1" means "give me all the 
      # trailing blank lines" is surprisingly opaque.  That's what the -1 does...
      lines = @text.split("\n", -1)
      lines.collect do |line|
        result = line
 
        # Leave lines that start with 4 spaces alone.  These are code blocks and
        # should pass through unchanged.
        unless result =~ /^\s{4,}/
 
          # Convert headers
          result.sub!(/^(=){1,6}/) { |s| "#" * s.length} unless result =~ /^={7,}/
 
          # Convert strong to have two stars
          # The matching pair of stars should start with a single star that is either at
          # the beginning of the line or not following a backslash, have at least one
          # non-star and non-backslash in between, then end in one star
          result.gsub!(/(\A|[^\\\*])\*([^\*]*[^\*\\])\*/, '\1**\2**')

          # Convert inline code spans to use backticks
          result.gsub!(/(\A|[^\\])\+([^\+]+)\+/, '\1`\2`')

          # Convert bare http:, mailto: and ftp: links
          result.gsub!(/(\A|\s)(http:|https:|mailto:|ftp:)(\S*)/, '\1[\2\3](\2\3)')

          # Convert bare www to an http: link
          result.gsub!(/(\A|\s)www\.(\S*)/, '\1[www.\2](http://www.\2)')

          # Convert link: links to refer to local files
          result.gsub!(/(\A|\s)link:(\S*)/, '\1[\2](\2)')

          # Convert multi word labels surrounded by {} with a url
          result.gsub!(/\{([^\}]*)\}\[(\S*)\]/, '[\1](\2)')

          # Convert one word labels with a url
          result.gsub!(/(\A|\s)([^\{\s]\S*)\[(\S*)\]/, '\1[\2](\3)')

        end
        
        result
      end.join("\n")
    end
802890
def lines(self):
        
        # Cache, because this one is reused very often.
        if self._cache.lines is None:
            self._cache.lines = _ImmutableLineList(self.text.split('\n'))

        return self._cache.lines
718367
def parse_tree_line(line)
      mode, _type, sha, size, *name = line.split(/\s+/)
      BlobEntry.new(sha, name.join(' '), size.to_i, mode.to_i(8))
    end
110865
function parse_children(lines, parent_node_names)
{
	// preprocess the lines (filter out comments, blank lines, etc)
	lines = filter_lines_for_parsing(lines)

	// return empty object if there are no lines to parse
	if (lines.length === 0)
	{
		return {}
	}

	// parse each child node's lines
	return split_lines_by_child_nodes(lines).map(function(lines)
	{
		// the first line is this child node's name (or names)
		const declaration_line = lines.shift()

		// check for excessive indentation of the first child style class
		if (declaration_line.tabs !== 0)
		{
			throw new Error(`Excessive indentation (${declaration_line.tabs} more "tabs" than needed) at line ${declaration_line.index}: "${declaration_line.original_line}"`)
		}

		// style class name declaration
		const declaration = declaration_line.line

		// child nodes' names
		const names = declaration.split(',').map(name => name.trim())

		// style class nesting validation
		validate_child_style_class_types(parent_node_names, names)

		// parse own CSS styles and recursively parse all child nodes
		const style_json = parse_style_class(lines, names)

		// generate style json for this child node (or child nodes)
		return names.map(function(node_declaration)
		{
			// parse this child node name
			const { name, is_a_modifier } = parse_node_name(node_declaration)

			// clone the style JSON object for this child node
			const json = extend({}, style_json)

			// set the modifier flag if it's the case
			if (is_a_modifier)
			{
				json._is_a_modifier = true
			}

			// this child node's style JSON object
			return { name, json }
		})
	})
	// convert an array of arrays to a flat array
	.reduce(function(array, child_array)
	{
		return array.concat(child_array);
	}, 
	[])
	// combine all the child nodes into a single JSON object
	.reduce(function(nodes, node)
	{
		// if style already exists for this child node, extend it
		if (nodes[node.name])
		{
			extend(nodes[node.name], node.json)
		}
		else
		{
			nodes[node.name] = node.json
		}
		
		return nodes
	}, 
	{})
}
164146
def parse_ruby_code(outer_delimiters)
      code = String.new
      end_re = if outer_delimiters.is_a?(Regexp)
                 outer_delimiters
               else
                 /\A\s*[#{Regexp.escape outer_delimiters.to_s}]/
               end
      delimiters = []
      string_start_quote_char = nil

      until @line.empty? || (delimiters.empty? && @line =~ end_re)
        char = @line[0]

        # backslash escaped delimiter
        if char == '\\' && RUBY_ALL_DELIMITERS.include?(@line[1])
          code << @line.slice!(0, 2)
          next
        end

        case char
        when RUBY_START_DELIMITERS_RE
          if RUBY_NOT_NESTABLE_DELIMITERS.include?(char) && delimiters.last == char
            # end char of not nestable delimiter
            delimiters.pop
            string_start_quote_char = nil
          else
            # diving into nestable delimiters
            delimiters << char if string_start_quote_char.nil?

            # mark start char of the not nestable delimiters, for example strings
            if RUBY_NOT_NESTABLE_DELIMITERS.include?(char) && string_start_quote_char.nil?
              string_start_quote_char = char
            end
          end

        when RUBY_END_DELIMITERS_RE
          # rising
          delimiters.pop if char == RUBY_DELIMITERS_REVERSE[delimiters.last]
        end

        code << @line.slice!(0)
      end

      syntax_error('Unexpected end of ruby code') unless delimiters.empty?

      code.strip
    end
120803
protected function generateTraitUsesLines()
    {
        $code = array();
        foreach ($this->traitUses as $use) {
            $use->setIndentationString($this->getIndentationString());
            $use->setIndentationLevel($this->getIndentationLevel() + 1);
            $code[] = $use->generate();
            $code[] = null;
        }

        return $code;
    }
343594
def format
      rows = @children
      rows = @children[1..-1] if @skip_first_row
      rows ||= []
      rows = rows.collect { |row| row.format }.join("\n")

      return nil if rows.length == 0
      rows
    end
1198669
def contents
      c = StringIO.new
      @lines.each do |l| 
        c.puts l if l
      end
      c.string
    end
1295356
def lines
      ret = [Attributes::HEADER]
      # Sort by name, but id goes first
      @attrs.sort_by{|x| x[:name] == 'id' ? '_' : x[:name]}.each do |row|
        line = "# * #{row[:name]} [#{row[:type]}]#{row[:desc].to_s.empty? ? "" : " - #{row[:desc]}"}"
        # split into lines that don't exceed 80 chars
        lt = wrap_text(line, MAX_CHARS_PER_LINE-3).split("\n")
        line = ([lt[0]] + lt[1..-1].map{|x| "#   #{x}"}).join("\n")
        ret << line
      end
      ret
    end
696268
def markup_code(tokens)
            src = ""
            tokens.each do |t|
                next unless t
                #    p t.class
                #        style = STYLE_MAP[t.class]
                style = case t
                when RubyToken::TkCONSTANT then "ruby-constant"
                when RubyToken::TkKW       then "ruby-keyword kw"
                when RubyToken::TkIVAR     then "ruby-ivar"
                when RubyToken::TkOp       then "ruby-operator"
                when RubyToken::TkId       then "ruby-identifier"
                when RubyToken::TkNode     then "ruby-node"
                when RubyToken::TkCOMMENT  then "ruby-comment cmt"
                when RubyToken::TkREGEXP   then "ruby-regexp re"
                when RubyToken::TkSTRING   then "ruby-value str"
                when RubyToken::TkVal      then "ruby-value"
                else
                    nil
                end

                text = CGI.escapeHTML(t.text)

                if style
                    src << "<span class=\"#{style}\">#{text}</span>"
                else
                    src << text
                end
            end

            add_line_numbers(src)
            src
        end
686910
def readFileLines
      puts "Reading source file #{@fileName} ..."
      lineNumber = 0
      File.open(@fileName).each_line do |line|
        line.chomp!
        lineNumber += 1 # track line numbers for when Ruby code needs to be executed (i.e. to populate stack traces)
        #puts "line #{lineNumber}: #{line}"
        commentLineMatch = COMMENT_LINE_REGEX.match(line)
        if commentLineMatch # it matches the Regenerate command line regex (but might not actually be a command ...)
          parsedCommandLine = ParsedRegenerateCommentLine.new(line, commentLineMatch)
          #puts "parsedCommandLine = #{parsedCommandLine}"
          if parsedCommandLine.isRegenerateCommentLine # if it is a Regenerate command line
            parsedCommandLine.checkIsValid # check it is valid, and then, 
            processCommandLine(parsedCommandLine, lineNumber) # process the command line
          else
            processTextLine(line, lineNumber) # process a text line which is not a Regenerate command line
          end
        else
          processTextLine(line, lineNumber) # process a text line which is not a Regenerate command line
        end
      end
      # After processing all source lines, the only unfinished page component permitted is a static HTML component.
      finishAtEndOfSourceFile
      #puts "Finished reading #{@fileName}."
    end