def construct_tag(tokens)
      raise ArgumentError, "tokens == nil" if tokens.nil?
      if tokens.empty?
        parse_error("Internal Error: empty token list", @tokenizer.line_no, UNKNOWN_POSITION)
      end
			
      first_token = tokens.first
      if first_token.literal?
        first_token = Token.new("content")
        tokens.insert(0, first_token)
				
      elsif first_token.type != :IDENTIFIER
        expecting_but_got(
          "IDENTIFIER",
          "#{first_token.type} (#{first_token.text})",
          first_token.line,
          first_token.position)
      end
			
      tag = nil
      if tokens.size == 1
        tag = Tag.new(first_token.text)
				
      else
        values_start_index = 1
        second_token = tokens[1]
				
        if second_token.type == :COLON
          if tokens.size == 2 or tokens[2].type != :IDENTIFIER
            parse_error(
              "Colon (:) encountered in unexpected location.",
              second_token.line,
              second_token.position)
          end
					
          third_token = tokens[2];
          tag = Tag.new(first_token.text, third_token.text)
          values_start_index = 3
					
        else
          tag = Tag.new(first_token.text)
        end
				
        # read values
        attribute_start_index = add_tag_values(tag, tokens, values_start_index)
				
        # read attributes
        if attribute_start_index < tokens.size
          add_tag_attributes(tag, tokens, attribute_start_index)
        end
      end
			
      return tag
    end
def construct_tag(tokens)
      raise ArgumentError, "tokens == nil" if tokens.nil?
      if tokens.empty?
        parse_error("Internal Error: empty token list", @tokenizer.line_no, UNKNOWN_POSITION)
      end
			
      first_token = tokens.first
      if first_token.literal?
        first_token = Token.new("content")
        tokens.insert(0, first_token)
				
      elsif first_token.type != :IDENTIFIER
        expecting_but_got(
          "IDENTIFIER",
          "#{first_token.type} (#{first_token.text})",
          first_token.line,
          first_token.position)
      end
			
      tag = nil
      if tokens.size == 1
        tag = Tag.new(first_token.text)
				
      else
        values_start_index = 1
        second_token = tokens[1]
				
        if second_token.type == :COLON
          if tokens.size == 2 or tokens[2].type != :IDENTIFIER
            parse_error(
              "Colon (:) encountered in unexpected location.",
              second_token.line,
              second_token.position)
          end
					
          third_token = tokens[2];
          tag = Tag.new(first_token.text, third_token.text)
          values_start_index = 3
					
        else
          tag = Tag.new(first_token.text)
        end
				
        # read values
        attribute_start_index = add_tag_values(tag, tokens, values_start_index)
				
        # read attributes
        if attribute_start_index < tokens.size
          add_tag_attributes(tag, tokens, attribute_start_index)
        end
      end
			
      return tag
    end
Construct a Tag (but not its children) from a string of tokens

 Throws SdlParseError if some bad syntax is found.